fix: Inconsistent checking of RBF rules.#225
Closed
Anunayj wants to merge 4 commits intobitcoindevkit:masterfrom
Closed
fix: Inconsistent checking of RBF rules.#225Anunayj wants to merge 4 commits intobitcoindevkit:masterfrom
Anunayj wants to merge 4 commits intobitcoindevkit:masterfrom
Conversation
Two of the values in tests were too low for RBF based on BIP125.
BREAKING CHANGE: It might be better to add satisfaction_weight calculation to the wallet instead, or maybe to PsbtUtils?
This commit adds RBF policy based on BIP125 and Bitcoin Core's Replacement Policy. More specifically replacement transactions should: - Have a higher absolute fee than the original transaction (incentivizes miners). - Pay enough for their bandwidth (prevents DoS). - Have a higher feerate than conflicting transactions (BitcoinCore policy, incentivizes miners) The old implementation was checking bip125 rules partially based on the fee policy chosen in txbuilder, and also was following a wrong assumption that feerate >= previous_feerate + BROADCAST_MIN Also fixes a test based on the above assumption. Fixes: bitcoindevkit#192
This test documents the case where the replacement transaction has a feerate that is almost equal to the original transaction but is still RBF replaceable. The previous implementation would wrongly fail on this test.
Contributor
|
Nice job, although I am not sure how to tinker with this to make it non-breaking, but otherwise looks good. Would it be possible to migrate this to |
Member
|
There has already been work on this in bitcoindevkit/bdk-tx#1. Please take a look there. Reviews and tests will be helpful. Note that we are trying to put a feature-freeze on |
Member
|
Closing due to the |
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.
Description
This PR adds checks based on RBF policy (BIP125 and Bitcoin Core's Replacement Policy).
More specifically it checks transactions:
Fixes: #192
Notes to the reviewers
The addition of
satisfaction_weighttoCoinSelectionResultwould be a breaking change, it isn't entirely necessary, as I could duplicate that functionality in wallet itself by making anestimated_weight(psbt: Psbt)function, but this was one of the cleaner ways to go about this, and I'm not entirely sure how acceptable breaking changes are in the project.Changelog notice
Changed
bumping_fee.BREAKING
CoinSelectionResultnow has asatisfaction_weightfield, giving the max weight required to satisfy the selected inputsChecklists
All Submissions:
cargo fmtbefore committingcargo clippybefore committingNew Features:
Bugfixes: