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] Move maxtxfee from node to wallet #15778
[wallet] Move maxtxfee from node to wallet #15778
Conversation
EDIT: base PR is merged. I've rebased on master. |
This only requires d38cfdf of the other pull request. The other pull request has a lot of conflicts and might need a long time for review to get in, so I'd prefer if you just cherry-picked that commit and your maxtxfee changes here. Review can then happen here instead of the larger pull request. No strong opinion, though. |
Thanks for looking at this @MarcoFalke . I'm in no rush for this to get merged, and would much prefer to see progress on #15638, so I'm going to try to avoid causing rebases for Russ. (incidentally, 15638 is a very easy review. It's almost entirely move-only and all the commits are well commented, so in theory at least it should be possible to review/merge quite quickly). |
Needs rebase |
This now requires rebase. I plan not to do that until #15638 is merged. Review is still welcomed for the last commit (although ACKs will need to be refreshed after rebase). |
71862f4
to
e3abaa3
Compare
Rebased on master. This is ready for review. |
Many tests fail. Do they pass locally in valgrind? |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
You're right. Investigating now. EDIT: I wasn't initializing |
e3abaa3
to
bef4ce8
Compare
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, some style comments
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 bef4ce8. Could say explicitly in the PR description that this is just cleanup, and there's no change in behavior.
Moved the max tx fee option to be a per-wallet setting. This required adding a |
bef4ce8
to
8c3e6f9
Compare
I think you could use the CWalletTx::pwallet pointer to avoid this. |
8c3e6f9
to
65b6d9c
Compare
You're right. Thanks. |
65b6d9c
to
a9706d1
Compare
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 a9706d1
src/interfaces/wallet.cpp
Outdated
@@ -464,6 +464,7 @@ class WalletImpl : public Wallet | |||
bool IsWalletFlagSet(uint64_t flag) override { return m_wallet->IsWalletFlagSet(flag); } | |||
OutputType getDefaultAddressType() override { return m_wallet->m_default_address_type; } | |||
OutputType getDefaultChangeType() override { return m_wallet->m_default_change_type; } | |||
CAmount getMaxTxFee() override { return m_wallet->m_default_max_tx_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.
Maybe call this getDefaultMaxTxFee for consistency. Also because I could imagine a GUI interface that allows overriding this and doesn't treat it as a hard limit.
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.
done
src/wallet/feebumper.cpp
Outdated
if (new_fee > max_tx_fee) { | ||
errors.push_back(strprintf("Specified or calculated fee %s is too high (cannot be higher than maxTxFee %s)", | ||
errors.push_back(strprintf("Specified or calculated fee %s is too high (cannot be higher than maxtxfee %s)", |
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 tweaking this error message is the only change in behavior in the pr. Might be good to note in the commit message that the commit doesn't change behavior except for this.
Also I might suggest writing -maxtxfee instead of maxtxfee to suggest that this is referring to an argument/config setting. It could help someone find the relevant manpage / help documentation.
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.
updated commit log
@@ -502,8 +502,6 @@ void SetupServerArgs() | |||
gArgs.AddArg("-mocktime=<n>", "Replace actual time with <n> seconds since epoch (default: 0)", true, OptionsCategory::DEBUG_TEST); | |||
gArgs.AddArg("-maxsigcachesize=<n>", strprintf("Limit sum of signature cache and script execution cache sizes to <n> MiB (default: %u)", DEFAULT_MAX_SIG_CACHE_SIZE), true, OptionsCategory::DEBUG_TEST); | |||
gArgs.AddArg("-maxtipage=<n>", strprintf("Maximum tip age in seconds to consider node in initial block download (default: %u)", DEFAULT_MAX_TIP_AGE), true, OptionsCategory::DEBUG_TEST); | |||
gArgs.AddArg("-maxtxfee=<amt>", strprintf("Maximum total fees (in %s) to use in a single wallet transaction; setting this too low may abort large transactions (default: %s)", // TODO move setting to wallet |
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 is another change in behavior that might be worth noting in the commit message or release notes: that specifiying -maxtxfee will now result in an error in non-wallet builds.
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 don't think this is true. Doesn't defining -maxtxfee
in dummywallet.cpp ensure that there's no error?
I can change this so there is an error, which would effectively alert users that the -maxtxfee
setting is not used in non-wallet builds.
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.
re: #15778 (comment)
You're right, I just didn't pay attention to the dummywallet change. I think it probably shouldn't be an error to specify -maxtxfee, based on the way other wallet options are handled, though I could see reasons for doing it either way.
@@ -124,10 +126,6 @@ bool WalletInit::ParameterInteraction() const | |||
if (gArgs.GetArg("-prune", 0) && gArgs.GetBoolArg("-rescan", false)) | |||
return InitError(_("Rescans are not possible in pruned mode. You will need to use -reindex which will download the whole blockchain again.")); | |||
|
|||
if (::minRelayTxFee.GetFeePerK() > HIGH_TX_FEE_PER_KB) | |||
InitWarning(AmountHighWarn("-minrelaytxfee") + " " + |
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 can see how it makes sense to disable this particular warning about the -minrelaytxfee
setting in non-wallet builds even though it is not a wallet setting, because the warning message is about wallet behavior.
But would it make sense to to keep some warning about really high -minrelaytxfee settings even in non-wallet builds?
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 warning was added as a wallet warning in #8486.
This PR is meant to be a pure refactor (except for the updated log message) so I'm not going to add the suggested new warning for a high -minrelaytxfee
to the node, but agree that it could make sense to add it in a separate PR. I'd also suggest that in a follow-up PR we change this warning to only trigger if -minrelayfee
is greater than walletInstance->m_default_max_tx_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.
EDIT: these warnings will now show for each wallet at startup rather than just once for the node, so that's also a minor behaviour change when starting with multiple wallets.
For unknown reasons GitHub delivers a corrupt branch when fetching this pull request. This leads to erroneous conflict calculations in DrahtBot, and the ci systems unable to run. 8c3e6f9 is delivered, whereas this pull request was force pushed in the meantime. |
This commit moves the maxtxfee setting to the wallet. There is only one minor behavior change: - an error message in feebumper now refers to -maxtxfee instead of maxTxFee.
a9706d1
to
5c759c7
Compare
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 5c759c7. Changes since last review: updated commit message and an error message and method name.
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 5c759c7
@@ -4204,6 +4204,29 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain, | |||
return nullptr; | |||
} | |||
} | |||
|
|||
if (gArgs.IsArgSet("-maxtxfee")) | |||
{ |
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.
μ-nit: bracket
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.
Didn't catch this when moving the code from init.cpp. Sorry!
utACK 5c759c7 Show signature
|
5c759c7 [wallet] Move maxTxFee to wallet (John Newbery) Pull request description: Closes bitcoin#15355 Moves the `-maxtxfee` from the node to the wallet. See discussion in issue for details. This is a cleanup. There is no change in behaviour. Completes bitcoin#15620 ACKs for commit 5c759c: MarcoFalke: utACK 5c759c7 ryanofsky: utACK 5c759c7. Changes since last review: updated commit message and an error message and method name. meshcollider: utACK bitcoin@5c759c7 Tree-SHA512: 2f9b2729da3940a5cda994d3f3bc11ee1a52fcc1c5e9842ea0ea63e4eb0300e8416853046776311298bc449ba07554aa46f0f245ce28598a5b0bd7347c12e752
Summary: This commit moves the maxtxfee setting to the wallet. There is only one minor behavior change: - an error message in feebumper now refers to -maxtxfee instead of maxTxFee. Backport of Core [[bitcoin/bitcoin#15778 | PR15778]] Depends on D6266 Test Plan: ninja all check-all Reviewers: #bitcoin_abc, jasonbcox Reviewed By: #bitcoin_abc, jasonbcox Subscribers: jasonbcox Differential Revision: https://reviews.bitcoinabc.org/D6267
…llet 5c759c7 [wallet] Move maxTxFee to wallet (John Newbery) Pull request description: Closes bitcoin#15355 Moves the `-maxtxfee` from the node to the wallet. See discussion in issue for details. This is a cleanup. There is no change in behaviour. Completes bitcoin#15620 ACKs for commit 5c759c: MarcoFalke: utACK 5c759c7 ryanofsky: utACK 5c759c7. Changes since last review: updated commit message and an error message and method name. meshcollider: utACK bitcoin@5c759c7 Tree-SHA512: 2f9b2729da3940a5cda994d3f3bc11ee1a52fcc1c5e9842ea0ea63e4eb0300e8416853046776311298bc449ba07554aa46f0f245ce28598a5b0bd7347c12e752
…llet 5c759c7 [wallet] Move maxTxFee to wallet (John Newbery) Pull request description: Closes bitcoin#15355 Moves the `-maxtxfee` from the node to the wallet. See discussion in issue for details. This is a cleanup. There is no change in behaviour. Completes bitcoin#15620 ACKs for commit 5c759c: MarcoFalke: utACK 5c759c7 ryanofsky: utACK 5c759c7. Changes since last review: updated commit message and an error message and method name. meshcollider: utACK bitcoin@5c759c7 Tree-SHA512: 2f9b2729da3940a5cda994d3f3bc11ee1a52fcc1c5e9842ea0ea63e4eb0300e8416853046776311298bc449ba07554aa46f0f245ce28598a5b0bd7347c12e752
Closes #15355
Moves the
-maxtxfee
from the node to the wallet. See discussion in issue for details.This is a cleanup. There is no change in behaviour.
Completes #15620