Skip to content

refactor(afs)!: decouple anti-fee-sniping from create_psbt#56

Closed
aagbotemi wants to merge 1 commit into
bitcoindevkit:masterfrom
aagbotemi:refactor/anti-fee-sniping-decouple
Closed

refactor(afs)!: decouple anti-fee-sniping from create_psbt#56
aagbotemi wants to merge 1 commit into
bitcoindevkit:masterfrom
aagbotemi:refactor/anti-fee-sniping-decouple

Conversation

@aagbotemi
Copy link
Copy Markdown
Collaborator

@aagbotemi aagbotemi commented May 9, 2026

Summary

Decouples BIP-326 anti-fee-sniping from Selection::create_psbt, addressing
post-merge review on #5 :

Changelog notice

Removed:

  • PsbtParams::enable_anti_fee_sniping
  • Selection::create_psbt_with_rng
  • CreatePsbtError::InvalidLockTime
  • CreatePsbtError::UnsupportedVersion

Added:

  • pub fn apply_anti_fee_sniping(...) — now part of the public API at
    the crate root.
  • pub enum AntiFeeSnipingError { UnsupportedVersion(Version) } — the
    single failure mode AFS can produce.
  • Selection::apply_anti_fee_sniping_with_rng(&self, psbt, tip_height, rng)
  • Selection::apply_anti_fee_sniping(&self, psbt, tip_height)

Rename:

  • utils.rs renamed to anti_fee_sniping.rs for discoverability.

Checklists

@aagbotemi aagbotemi self-assigned this May 9, 2026
@aagbotemi aagbotemi added api Changes the public API enhancement New feature or request labels May 9, 2026
Copy link
Copy Markdown
Member

@evanlinjin evanlinjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this. Due to #57, I propose that we just remove the complex PsbtParams field relationships in this PR and leave moving AFS out in a separate PR.

struct PsbtParams {
    /// Documentation explaining:
    /// * `None` means no AFS.
    /// * Contained is the tip height.
    anti_fee_sniping: Option<absolute::Height>,
}

@aagbotemi
Copy link
Copy Markdown
Collaborator Author

Thanks for the review. I'll update the PR

@aagbotemi
Copy link
Copy Markdown
Collaborator Author

Closed in favor of #65

@aagbotemi aagbotemi closed this May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Changes the public API enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants