-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Fixes for bumpfee and minimum fees (use incrementalRelayFee for BIP 125 (RBF) replacement) #9589
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
Conversation
ryanofsky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK fa005cce2b7a8e02cedc7356d2d1933b94c26c39
src/wallet/rpcwallet.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be a good idea to update getnetworkinfo to return the incremental relay fee?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think from a user perspective, it might be easier to keep incremental relay fee as something that is kind of unknown to them and is effectively just the hard coded 1000 sat / KB, however if we ever think it makes sense to have people changing it (or we think the default needs changing it), then it would be time to expose it. I realize that's not a perfect solution, but I also think confusing people with too many random minimums isn't ideal either... At least the error message for bumpfee outputs what the needed increment is..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be good to have this if only so this documentation can be less vague. If I'm trying to write an RPC call that passes a totalFee and the documentation just says I need to "pay a new relay fee", what am I supposed to do at the point to find out what value I need to pass for the call to complete reliably? Search for "bitcoin relay fee"? Look at the source code? I think I'd be better off with documentation that says I need to increase the fee by at least the amount returned in getnetworkinfo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok done
src/wallet/rpcwallet.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not directly related, but CTxOut IsDust and GetDustThreshold methods still take arguments named minRelayTxFee. Would seem like a good idea to rename those to dustRelayFee.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/wallet/rpcwallet.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider keeping the :: prefix for global variables. As someone new to the code who doesn't have all the global variables memorized, I think the prefix is very helpful for readability, especially in a large function like bumpfee with similar sounding local variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok i don't mind doing that, but will just do for the changes introduced in this PR here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, that sounds fine to me.
|
utACK fa005cc, agree with the nits. |
fa005cc to
de6400d
Compare
|
Only change is adding |
|
Took @ryanofsky's suggestion to add the incremental fee to getnetworkinfo and also added a commit that fixed an issue with block min tx fee in a test. |
a144322 to
72af459
Compare
ryanofsky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 72af459a53f83d507aa83c93cd3ef8aad2e1c7e0
src/wallet/rpcwallet.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo getnetowrkinfo
72af459 to
fe8e8ef
Compare
|
typo fixed |
|
re-utACK fe8e8ef |
|
utACK fe8e8ef |
|
utACK fe8e8ef
|
|
Perhaps also update the comments in |
|
This is minor, but this comment could be fixed in |
| if (nNewFeeRate.GetFeePerK() < nOldFeeRate.GetFeePerK() + ::minRelayTxFee.GetFeePerK()) { | ||
| nNewFeeRate = CFeeRate(nOldFeeRate.GetFeePerK() + ::minRelayTxFee.GetFeePerK()); | ||
| // new fee rate must be at least old rate + minimum incremental relay rate | ||
| if (nNewFeeRate.GetFeePerK() < nOldFeeRate.GetFeePerK() + ::incrementalRelayFee.GetFeePerK()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change (while correct) exposes a bug in the logic, where we weren't otherwise comparing nNewFeeRate to either minTxFee or minRelayTxFee -- we should probably either add a call to compare against GetRequiredFee(), or rewrite the above to just use CWallet::GetMinimumFee.
Separately -- I now realize that we're also not comparing nNewFeeRate to maxTxFee either? That seems like a separate bug in bumpfee...
|
I added two new commits at the end to address the bugs @sdaftuar identified, hopefully this will help the prior review of the other commits remain useful. I didn't bother addressing the nits, b/c I'd like to get this merged ASAP and want to concentrate on the important parts. |
|
re-ACK 9412ca4e7baba5130baaf173b5f189c240f1408a |
|
I don't think we should ever allow maxTxFee to be violated. Apart from the minor issue of slightly confusing semantics if maxTxFee is only enforced on totalFee and not an automatically generated one, the maxTxFee limit is the only thing preventing us from generating infinitely high (bounded only by the change output) fees if the user keeps calling bumpfee in a loop. (Moreover, I believe a fee in excess of maxTxFee will be rejected by the mempool, and currently bumpfee does not handle this gracefully -- I'll open another PR to clean up the handling in this case.) |
Use the wallet's fee calculation logic to properly clamp fee against minimums and maximums when calculating the fee for a bumpfee transaction. Unless totalFee is explictly given, in which case, manually check against min, but do nothing to adjust given fee. In all cases do a final check against maxTxFee (after adding any incremental amount).
9412ca4 to
e8021ec
Compare
|
OK sorry for all the churn.. Modified last commit to check against maxTxFee in all cases Diff from 9412ca4 is here: http://pastebin.com/C1db37i3 |
|
ACK e8021ec |
|
Concept ACK on the last diff. Thanks @sdaftuar for raising the issue with maxTxFee! |
|
utACK e8021ec much nicer to use wallet's GetMinimumFee functions, thanks. |
btcdrak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK e8021ec
This commit includes several minor fixups from #9380.
Most importantly the change to
AcceptToMemoryPoolWorkerto useincrementalRelayFeewas an oversight that was left out of #9380.bumpfeeis adapted for that change and the changes from #9380,Also includes fixes for #8456
Please tag as a bug fix for 0.14
Edited to reflect additional changes.