Skip to content
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

Merged
merged 1 commit into from Apr 27, 2019

Conversation

jnewbery
Copy link
Contributor

@jnewbery jnewbery commented Apr 9, 2019

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

@jnewbery
Copy link
Contributor Author

jnewbery commented Apr 9, 2019

Builds on #15638. Only the last commit is for this PR.

EDIT: base PR is merged. I've rebased on master.

@jnewbery jnewbery changed the title Mmove maxtxfee from node Move maxtxfee from node to wallet Apr 9, 2019
@jnewbery jnewbery changed the title Move maxtxfee from node to wallet [wallet] Move maxtxfee from node to wallet Apr 9, 2019
@maflcko
Copy link
Member

maflcko commented Apr 9, 2019

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.

@jnewbery
Copy link
Contributor Author

jnewbery commented Apr 9, 2019

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

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 9, 2019

Needs rebase

@jnewbery
Copy link
Contributor Author

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

@jnewbery jnewbery force-pushed the remove_maxtxfeerate_from_node branch from 71862f4 to e3abaa3 Compare April 10, 2019 13:59
@jnewbery
Copy link
Contributor Author

Rebased on master. This is ready for review.

@maflcko
Copy link
Member

maflcko commented Apr 10, 2019

Many tests fail. Do they pass locally in valgrind?

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 10, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #15870 (wallet: Only fail rescan when blocks have actually been pruned by MarcoFalke)
  • #15845 (wallet: Fast rescan with BIP157 block filters by MarcoFalke)
  • #15764 (Native descriptor wallets by achow101)
  • #15713 (refactor: Replace chain relayTransactions/submitMemoryPool by higher method by ariard)
  • #12419 (Force distinct destinations in CWallet::CreateTransaction by promag)
  • #12096 ([rpc] [wallet] Allow specifying the output index when using bumpfee by kallewoof)

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.

@jnewbery
Copy link
Contributor Author

jnewbery commented Apr 10, 2019

Many tests fail.

You're right. Investigating now.

EDIT: I wasn't initializing g_max_tx_fee properly. Should be fixed now.

@jnewbery jnewbery closed this Apr 10, 2019
@jnewbery jnewbery reopened this Apr 10, 2019
@jnewbery jnewbery force-pushed the remove_maxtxfeerate_from_node branch from e3abaa3 to bef4ce8 Compare April 10, 2019 21:27
Copy link
Member

@maflcko maflcko left a 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

src/wallet/wallet.h Outdated Show resolved Hide resolved
src/wallet/wallet.h Outdated Show resolved Hide resolved
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 bef4ce8. Could say explicitly in the PR description that this is just cleanup, and there's no change in behavior.

src/interfaces/wallet.cpp Outdated Show resolved Hide resolved
src/wallet/wallet.h Outdated Show resolved Hide resolved
@jnewbery
Copy link
Contributor Author

Moved the max tx fee option to be a per-wallet setting. This required adding a max_tx_fee parameter to CWalletTx::AcceptToMemoryPool() and CWalletTx::RelayTransaction() which is ugly. I hope we can remove clean those up in a future PR.

@jnewbery jnewbery force-pushed the remove_maxtxfeerate_from_node branch from bef4ce8 to 8c3e6f9 Compare April 11, 2019 15:54
@ryanofsky
Copy link
Contributor

This required adding a max_tx_fee parameter to CWalletTx::AcceptToMemoryPool() and CWalletTx::RelayTransaction() which is ugly

I think you could use the CWalletTx::pwallet pointer to avoid this.

@jnewbery jnewbery force-pushed the remove_maxtxfeerate_from_node branch from 8c3e6f9 to 65b6d9c Compare April 11, 2019 16:41
@jnewbery
Copy link
Contributor Author

jnewbery commented Apr 11, 2019

I think you could use the CWalletTx::pwallet pointer to avoid this.

You're right. Thanks. Will fix. EDIT: Fixed.

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 a9706d1

@@ -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; }
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

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)",
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 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.

Copy link
Contributor Author

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
Copy link
Contributor

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.

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

Copy link
Contributor

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") + " " +
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@maflcko
Copy link
Member

maflcko commented Apr 18, 2019

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.
@maflcko maflcko closed this Apr 18, 2019
@maflcko maflcko reopened this Apr 18, 2019
@jnewbery jnewbery force-pushed the remove_maxtxfeerate_from_node branch from a9706d1 to 5c759c7 Compare April 18, 2019 15:46
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 5c759c7. Changes since last review: updated commit message and an error message and method name.

Copy link
Contributor

@meshcollider meshcollider left a 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"))
{
Copy link
Contributor

Choose a reason for hiding this comment

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

μ-nit: bracket

Copy link
Contributor Author

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!

@maflcko
Copy link
Member

maflcko commented Apr 27, 2019

utACK 5c759c7

Show signature
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

utACK 5c759c73b2602c7fde1c50dbafe5525904c1b64c
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUgH2Qv+Kd6E9UhzyxVnWAqNzwS2wa1QyycdibAkaOTJbgV5+gUDpeuSyM+3MN4O
ecc1rrxPKPYTvklpvh/+TE9bBQFaTFqAUFVd1O/rNDt8kadwH4J9C+SsRfoczy9v
wai1EfizUZpyh+xWHaRFmZw8xAjgfxw8o+gaRQDHKvsMTWQ+vWzFtBmyToj6CFK4
EFOu5Y4QBMqfJU2iOJO4V2TUEF4CsWxyg/jt87oCjkrbJ/YklfdKMwb7vOOXLXB4
bhvB2q/hxQeC18oGGTzFlF6Jle61yuXjJEhuMkbrWtodJEtHXsscEtiA0+Icx8v4
GpJQE86srtleBovqYe5GcVu9WIDowoavI3hdlDDFrCvpbCTcSD85poi/YVZFBYD4
ZI1TV87FTzorhIsv/P1M9C/bl4ubMYOSfMmqNw5rC02C25ccOM/I0f86OcjWqvAZ
d8juOFqXCDkOgONIlbI7V54z58KTFEVKvrQT4XTe+kvBUdzKUd+vo4YTf7lnd28l
Ij7w3w/T
=28zR
-----END PGP SIGNATURE-----

maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Apr 27, 2019
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
@maflcko maflcko merged commit 5c759c7 into bitcoin:master Apr 27, 2019
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 1, 2019
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request May 27, 2020
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
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Oct 30, 2021
…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
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Oct 30, 2021
…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
kwvg added a commit to kwvg/dash that referenced this pull request Dec 3, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Dec 4, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Dec 6, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Dec 8, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Dec 8, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Dec 8, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Dec 11, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Dec 12, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Dec 12, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Dec 12, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Dec 12, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Dec 12, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Dec 12, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

-maxtxfee should not be used by both node and wallet
6 participants