-
Notifications
You must be signed in to change notification settings - Fork 36.2k
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] Default fPayAtLeastCustomFee to false #6708
Conversation
d911ab9
to
a607781
Compare
Concept ACK on better/more flexible fee handling for RPC test. |
@@ -2164,7 +2164,7 @@ UniValue settxfee(const UniValue& params, bool fHelp) | |||
if (fHelp || params.size() < 1 || params.size() > 1) | |||
throw runtime_error( | |||
"settxfee amount\n" | |||
"\nSet the transaction fee per kB.\n" | |||
"\nSet the transaction fee per kB. (Overwrites the paytxfee parameter)\n" |
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.
What's the reason of removing the help string 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.
Can you elaborate? The trivial commit shouldn't remove anything. It's a cherry-pick from my cleanup-txfee-params
branch.
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.
Right. Did recognized it the wrong way around. This looks good.
Would supersede #6649 (@MarcoFalke maybe include title and description from #6649 in this PR). |
a607781
to
e24df5f
Compare
@@ -41,7 +41,7 @@ CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE; | |||
unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET; | |||
bool bSpendZeroConfChange = true; | |||
bool fSendFreeTransactions = false; | |||
bool fPayAtLeastCustomFee = true; | |||
bool fPayAtLeastCustomFee = false; |
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.
You shouldn't change this default in a pull whose goal is to improve the tests.
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.
The tests need this to be false
but you are right: This PR is not merge ready as of now. This needs at least one follow up commit but I am not sure which path to take:
- Option 1: Make this PR change the default and do the required things (i.e. adjust release notes et al.)
- Option 2: Introduce a command line parameter (or rpc?) to overwrite the default. (I am not sure if we want yet another param to keep track of... )
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.
How this is usually done is to add a hidden command line option to override this setting. This is how most of the tests work that need special setup, for special tests.
On the other hand it is not good to have the entire wallet test depend on a non-standard setting, so then it'd have to be a new test.
Isn't there already a PR to change the default?
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.
Yes, this PR depends on and replaces #6649, thus fixes #6479.
I'd propose to rename this PR to "Default fPayAtLeastCustomFee to false" and go with Option 1? It seems better to get rid of this fixed-fee-regardless-of-tx-size approach completely. To cite @sipa :
[fixed fee amount per transaction] wouldn't make sense. You're paying for space inside blocks, and miners prioritize transactions based on fee per byte. As you don't know the size of a transaction before creating it, specifying its exact fee would likely lead to unexpected behaviour.
– Pieter Wuille Aug 5 at 12:40 [1]
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, agreed. So it probably makes sense to make these tests changes part of #6649, as I assume it would solve the Travis issue there too?
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.
@laanwj Other PR is closed now. Everything is included in this one.
I've coded quite a few regtests for a related project, which is based on Core. If Instead of just changing the default, I would really like if there were options to set all fee related values via RPC or CLI:
Since it's already fully configurable via the GUI, adding an options such as Ideally the settings are visible somewhere (e.g. via |
If there is no valid reason to keep it (or set the default to true) bitcoin-core should not encourage bad practice (Not to mention the documentation inconsistencies: Both, Introducing a CLI/RPC parameter is trivial but serves no purpose, if there is no compelling reason to do so. We could still leave the flag in the source code for some grace period to let people modify it by hand if they really need it? |
@MarcoFalke: from a practical perspective, say I'd wanted to create transactions with 0.005 BTC fixed fees, how could I do this? Unless I'm missing something here, I'd need to 1. estimate the size of the transaction, 2. then set an estimated fee/kB, 3. select enough coins, 4. create the transaction, and repeat until the estimated size equals the actual size. The issue here is that a different fee/size impacts the coin selection, thus also impacts the size. |
@dexX7 The current code does not support that (without the fragile assumption that coin selection won't pick enough dust to drive the transaction size over a kB), but if it's a use-case that should be supported, I think it should be treated as an entirely separate issue, with a "payExactFee". On the other hand, this PR is extremely useful. I process hundreds of bitcoin transactions per day with bitcoin core over rpc, and it has strongly been requested that some of the transactions I send with higher and lower fees, depending on user requirements. Thanks to the estimatefee logic, I know exactly the fees per kilobyte I want to be using, but the current fPayAtLeastCusomFee setting makes it impossible to use. Strongly in support of this change. |
@dexX7 But you could also use |
concept ACK |
This allows for much finer control of the transaction fees per kilobyte as it prevent small transactions using a fee that is more appropriate for one that is of a kilobyte. This also allows controlling the fee per kilobyte over rpc such that: bitcoin-cli settxfee `bitcoin-cli estimatefee 2` would make sense, while currently it grossly fails often by a factor of x3
b7d549e
to
66b670d
Compare
# allow the node's estimation to be at most 2 bytes off | ||
if fee > fee_per_byte * (tx_size + 2): | ||
raise AssertionError("Fee of %s BTC too high! (Should be %s BTC)"%(str(fee), str(target_fee))) | ||
return curr_balance |
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 will produce the smallest diff but if it is preferred to make check_fee_amount()
independent of curr_balance
. I.e. def check_fee_amount(self, actual_fee, fee_per_byte, tx_size):
, it could later also be used by other classes in the framework.
Closing this because its superseded by #7096 which includes some of this PRs work. @dexX7: There is no way to set an absolute fee over RPC. IMO this is the right thing. Absolute fees are not something we should encourage for |
All fees in bitcoin core are specified in BTC/kB but
-paytxfee
silently ([init.cpp]) ignores this rule due tofPayAtLeastCustomFee = true
.This PR will:
fPayAtLeastCustomFee
to falsecheck_amount()
(Previously only fee == fee per 1000 bytes was asserted)
-payatleastcustomfee
For completeness: Copy of #6649 description:
This allows for much finer control of the transaction fees per kilobyte
as it prevent small transactions using a fee that is more appropriate
for one that is of a kilobyte.
This also allows controlling the fee per kilobyte over rpc such that:
would make sense, while currently it grossly fails often by a factor of x3
This fixes issue #6479, and has minimal impact as dynamic fees are currently the default. This default can be overriden in the qt wallet, although I have trouble imagining where that is useful. Possibly the entire concept of fPayAtLeastCustomFee can be removed in a later version.