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
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.
There was a problem hiding this comment.
I missed removing this after testing. Good catch!.
|
|
||
| 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.
There was a problem hiding this comment.
The current implementation does a fee rate increment. I would go back to work on this.
Thank you!
|
|
||
| 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.
There was a problem hiding this comment.
The caller passes the requested fee_amount which will serve as the final realized fee. The check is placed after coin selection, just before the psbt is finalized, so dust handling should already be factored in.
There was a problem hiding this comment.
I think there may still be a case where fee_amount differs from the realized fee. I was able to reproduce this with a 720 sat requested fee resulting in a 1,000 sat realized fee due to dust handling. Since fee_amount isn't recomputed after coin selection, the check would still use 720 sat rather than the realized fee.
There was a problem hiding this comment.
Yeah, this was covered in the updates made in 94f3941
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