Skip to content

feat: Add absolute fee target to TargetFee#44

Merged
evanlinjin merged 1 commit intobitcoindevkit:masterfrom
evanlinjin:feature/absolute-fee-target
Apr 24, 2026
Merged

feat: Add absolute fee target to TargetFee#44
evanlinjin merged 1 commit intobitcoindevkit:masterfrom
evanlinjin:feature/absolute-fee-target

Conversation

@evanlinjin
Copy link
Copy Markdown
Member

Summary

  • Adds TargetFee::absolute field as a minimum absolute fee floor, checked independently alongside the existing feerate and replacement constraints
  • Adds CoinSelector::absolute_excess() method and integrates it into excess() via .min() so the most binding constraint wins
  • Handles the absolute constraint in LowestFee::bound() for correct branch-and-bound behavior

Use cases:

  • Payjoin (BIP 78): The receiver must not decrease the original transaction's absolute fee when adding inputs
  • Application-level policy minimums: Supports bdk_wallet's TxBuilder::fee_absolute() API where users set a fee floor regardless of feerate

Extracted from #38 (package context changes excluded).

Test plan

  • cargo test — all existing tests pass
  • cargo test --no-default-features — no_std builds pass
  • cargo clippy — clean

🤖 Generated with Claude Code

Add a `TargetFee::absolute` field that acts as a minimum absolute fee
floor, checked independently alongside the existing feerate and
replacement constraints. This supports use cases like Payjoin (BIP 78),
where the receiver must not decrease the original transaction's absolute
fee, and application-level policy minimums.

Changes:
- Add `absolute: u64` field to `TargetFee`
- Add `CoinSelector::absolute_excess()` method
- Integrate absolute excess into `CoinSelector::excess()` via `.min()`
- Account for absolute fee in `CoinSelector::implied_fee()`
- Handle absolute constraint in `LowestFee::bound()` for correct
  branch-and-bound behavior

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@evanlinjin evanlinjin marked this pull request as draft March 30, 2026 18:54
@evanlinjin evanlinjin self-assigned this Mar 30, 2026
@evanlinjin evanlinjin marked this pull request as ready for review March 31, 2026 04:09
@evanlinjin evanlinjin requested a review from LLFourn March 31, 2026 04:10
@evanlinjin evanlinjin merged commit a2c9abc into bitcoindevkit:master Apr 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant