Skip to content

Conversation

@morcos
Copy link
Contributor

@morcos morcos commented Jan 19, 2017

This commit includes several minor fixups from #9380.

Most importantly the change to AcceptToMemoryPoolWorker to use incrementalRelayFeewas an oversight that was left out of #9380.

bumpfee is 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.

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK fa005cce2b7a8e02cedc7356d2d1933b94c26c39

Copy link
Contributor

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?

Copy link
Contributor Author

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..

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok done

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that has annoyed me a few times as well and I was going to change it, but @jtimon has #9279 which I was hoping would eventually get merged and make it go away all together.

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

@maflcko
Copy link
Member

maflcko commented Jan 20, 2017

utACK fa005cc, agree with the nits.

@maflcko maflcko added this to the 0.14.0 milestone Jan 20, 2017
@morcos
Copy link
Contributor Author

morcos commented Jan 20, 2017

Only change is adding :: to global variables

@morcos
Copy link
Contributor Author

morcos commented Jan 20, 2017

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.

@morcos morcos changed the title Use incrementalRelayFee for BIP 125 (RBF) replacement logic Fixes for minimum fees (use incrementalRelayFee for BIP 125 (RBF) replacement) Jan 20, 2017
Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 72af459a53f83d507aa83c93cd3ef8aad2e1c7e0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo getnetowrkinfo

@morcos
Copy link
Contributor Author

morcos commented Jan 20, 2017

typo fixed

@morcos morcos mentioned this pull request Jan 23, 2017
@ryanofsky
Copy link
Contributor

re-utACK fe8e8ef

@TheBlueMatt
Copy link
Contributor

utACK fe8e8ef

@jtimon
Copy link
Contributor

jtimon commented Jan 23, 2017

per-commit utACK: de6400d fe8e8ef 6b331e6

@maflcko
Copy link
Member

maflcko commented Jan 24, 2017 via email

@sdaftuar
Copy link
Member

Perhaps also update the comments in CTransaction::GetDustThreshold()? The comment there is pretty old I guess, referring to CTransaction::minRelayTxFee. Anyway some explanation of the dustRelayFee would be helpful there.

@sdaftuar
Copy link
Member

This is minor, but this comment could be fixed in policyestimator_tests.cpp, line 190 (minRelayTxFee should be incrementalRelayFee):

// evict that transaction which should set a mempool min fee of minRelayTxFee + feeV[5]

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()) {
Copy link
Member

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...

@morcos
Copy link
Contributor Author

morcos commented Jan 26, 2017

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.

@maflcko
Copy link
Member

maflcko commented Jan 26, 2017

re-ACK 9412ca4e7baba5130baaf173b5f189c240f1408a

@sdaftuar
Copy link
Member

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).
@morcos
Copy link
Contributor Author

morcos commented Jan 26, 2017

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

@sdaftuar
Copy link
Member

ACK e8021ec

@maflcko
Copy link
Member

maflcko commented Jan 26, 2017

Concept ACK on the last diff. Thanks @sdaftuar for raising the issue with maxTxFee!

@morcos morcos changed the title Fixes for minimum fees (use incrementalRelayFee for BIP 125 (RBF) replacement) Fixes for bumpfee and minimum fees (use incrementalRelayFee for BIP 125 (RBF) replacement) Jan 26, 2017
@TheBlueMatt
Copy link
Contributor

utACK e8021ec much nicer to use wallet's GetMinimumFee functions, thanks.

Copy link
Contributor

@btcdrak btcdrak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK e8021ec

@laanwj laanwj merged commit e8021ec into bitcoin:master Jan 30, 2017
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants