Conversation
Require replacement transactions to pay a strictly higher absolute fee and meet the required replacement fee rate after coin selection.
Raise absolute fee values used by fee bump tests to satisfy the updated replacement fee-rate requirement
busayo-OD
reviewed
Sep 18, 2026
busayo-OD
left a comment
There was a problem hiding this comment.
Thanks for working on this! There are a few things around the fee validation logic that I wanted to mention.
| } | ||
| } | ||
|
|
||
| if matches!(fee_policy, FeePolicy::FeeAmount(_)) { |
There was a problem hiding this comment.
This FeeAmount check appears twice consecutively. The duplicate block can be removed.
|
|
||
| if matches!(fee_policy, FeePolicy::FeeAmount(_)) { | ||
| if let Some(previous_fee) = params.bumping_fee { | ||
| let required_feerate = FeeRate::from_sat_per_kwu( |
There was a problem hiding this comment.
This enforces a fee-rate floor (previous_rate + 1 sat/vB) rather than the BIP125 fee requirements. These differ when the replacement's weight changes, so the resulting minimum fee can be either higher or lower than the BIP125 requirement.
|
|
||
| if matches!(fee_policy, FeePolicy::FeeAmount(_)) { | ||
| if let Some(previous_fee) = params.bumping_fee { | ||
| let required_feerate = FeeRate::from_sat_per_kwu( |
There was a problem hiding this comment.
I’m wondering if this should use the final realized fee instead of the requested fee_amount, since dust handling can add excess to the actual fee.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes issue #549
Description
Previously,
Wallet::create_txonly checksfee < previous_fee.absolutewhen bumping a fee withTxBuilder::fee_absolute. This misses out on 2 arms of theFeePolicy::FeeRatearm, causing transactions to be built without error, but then be rejected by BIP125 replacement policy (rule 4: must pay for its own bandwidth at the incremental relay fee; Bitcoin Core additionally requires a higher fee rate than the original).Wallet::create_txnow:FeeRate::BROADCAST_MIN.This ensures that the appropriate fee error is returned when
TxBuilder::fee_absoluteattempts to build replacement transactions that do not satisfy the required absolute fee and incremental relay fee rulesNotes to the reviewers
The selected
fee_policyis retained so absolute-fee replacements can be validated after coin selection. The final transaction weight is used to ensure the replacement fee rate exceeds the original fee rate by the required incremental relay fee.Appropriate regression tests were added, and the absolute-fee values were updated in tests:
test_bump_fee_reduce_changetest_bump_fee_absolute_force_add_inputThese fixtures previously passed the absolute-fee-only check but no longer satisfy the final replacement fee-rate requirement.
Changelog notice
Wallet::create_txenforces a strictly higher replacement fee and validates the final replacement fee rate after coin selection.Before submitting