-
Notifications
You must be signed in to change notification settings - Fork 810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wallet: add BIP125 RBF bump fee #1170
base: master
Are you sure you want to change the base?
Conversation
"Quick and dirty" isDoubleSpend() check evaluates to false if the conflicting tx has opted in to RBF. More verbose checks are still required for BIP125. General RBF tests added.
Implements and tests BIP125 rules specifically pertaining to fee requirements for replacement transactions. Valid replacements must pay a higher fee rate than the original TX, and also must pay for the bandwidth of all potentially evicted transactions in addition to its own bandwidth.
Implements two extra rules defined in BIP125: - The replacement transaction may only include an unconfirmed input if that input was included in one of the original transactions. - The number of original transactions to be replaced and their descendant transactions which will be evicted from the mempool must not exceed a total of 100 transactions.
All the BIP125 rules have been implemented to reject invalid replacement TXs. This is where the actual replacement happens, adding the replacement TX and evicting all the conflicts and their descendants.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1170 +/- ##
==========================================
+ Coverage 70.41% 70.85% +0.43%
==========================================
Files 174 174
Lines 27515 27609 +94
==========================================
+ Hits 19376 19563 +187
+ Misses 8139 8046 -93
☔ View full report in Codecov by Sentry. |
We only need to call the "quick and dirty test" if the user has set mempool RBF option to false. Do the Rule #1 check in verifyRBF() instead where it belongs. This leaves one loose end in maybeOrphan() that must be caught so we don't treat double-spends like orphans.
The current implementation improperly assumed that any unconfirmed inputs spent by the replacement TX were also spent by its direct conflict. It therefore did not account for the case where the replacement was spending an unconfirmed CHILD of its direct replacement. This would cause it to replace its own inputs which is an invalid mempool state and led to unexpected errors.
3b1dc6b
to
368195a
Compare
368195a
to
4d97480
Compare
This is awesome! |
Hello, thank you a lot @pinheadmz for your work and attention. I've been working on a RBF feature of my app using this branch. Yes, it works great. It would be totally complete with support of |
Bug reportBasically what I'm doing is inputs consolidation:
When I'm trying to perform an rbf on such tx, increasing fee significantly(passing 2000 rate to the rbf method and more), the error on node occures and rbf doesn't work Code of tx constructing:
My tx basically had:
I've tried to rbf it with this method Stacktrace:
It looks like the error appears when it tries to add inputs or subtract fee from existing change. With small txes and rates, everything works. Obviously, my code is not perfect, but i think |
And also I've another situation of not working. It's not really seems like a bug, but kinda strange behaviour.
In this case there will be no change output Stacktrace:
|
based on #811
CLI API:
HTTP API:
default incremental fee rate is network minRelay in s/vkB
default sign is true
default passphrase is null
Returns new TX JSON object. If sign is true, also signs and broadcasts
TODO: