0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-09 15:37:00 -04:00

[wallet]: update max_fee to max_tx_fee

- Also update `-maxapsfee` option from `max_fee` to `max_aps_fee`.
  This fixes the ambiguity in the variable name.
This commit is contained in:
ismaelsadeeq 2024-03-17 12:45:59 +01:00
parent 3db6882017
commit d3600accf9

View file

@ -3124,17 +3124,17 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
} }
if (args.IsArgSet("-maxapsfee")) { if (args.IsArgSet("-maxapsfee")) {
const std::string max_aps_fee{args.GetArg("-maxapsfee", "")}; const std::string max_aps_fee_str{args.GetArg("-maxapsfee", "")};
if (max_aps_fee == "-1") { if (max_aps_fee_str == "-1") {
walletInstance->m_max_aps_fee = -1; walletInstance->m_max_aps_fee = -1;
} else if (std::optional<CAmount> max_fee = ParseMoney(max_aps_fee)) { } else if (std::optional<CAmount> max_aps_fee = ParseMoney(max_aps_fee_str)) {
if (max_fee.value() > HIGH_APS_FEE) { if (max_aps_fee.value() > HIGH_APS_FEE) {
warnings.push_back(AmountHighWarn("-maxapsfee") + Untranslated(" ") + warnings.push_back(AmountHighWarn("-maxapsfee") + Untranslated(" ") +
_("This is the maximum transaction fee you pay (in addition to the normal fee) to prioritize partial spend avoidance over regular coin selection.")); _("This is the maximum transaction fee you pay (in addition to the normal fee) to prioritize partial spend avoidance over regular coin selection."));
} }
walletInstance->m_max_aps_fee = max_fee.value(); walletInstance->m_max_aps_fee = max_aps_fee.value();
} else { } else {
error = AmountErrMsg("maxapsfee", max_aps_fee); error = AmountErrMsg("maxapsfee", max_aps_fee_str);
return nullptr; return nullptr;
} }
} }
@ -3186,21 +3186,21 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
} }
if (args.IsArgSet("-maxtxfee")) { if (args.IsArgSet("-maxtxfee")) {
std::optional<CAmount> max_fee = ParseMoney(args.GetArg("-maxtxfee", "")); std::optional<CAmount> max_tx_fee = ParseMoney(args.GetArg("-maxtxfee", ""));
if (!max_fee) { if (!max_tx_fee) {
error = AmountErrMsg("maxtxfee", args.GetArg("-maxtxfee", "")); error = AmountErrMsg("maxtxfee", args.GetArg("-maxtxfee", ""));
return nullptr; return nullptr;
} else if (max_fee.value() > HIGH_MAX_TX_FEE) { } else if (max_tx_fee.value() > HIGH_MAX_TX_FEE) {
warnings.push_back(strprintf(_("%s is set very high! Fees this large could be paid on a single transaction."), "-maxtxfee")); warnings.push_back(strprintf(_("%s is set very high! Fees this large could be paid on a single transaction."), "-maxtxfee"));
} }
if (chain && CFeeRate{max_fee.value(), 1000} < chain->relayMinFee()) { if (chain && CFeeRate{max_tx_fee.value(), 1000} < chain->relayMinFee()) {
error = strprintf(_("Invalid amount for %s=<amount>: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"), error = strprintf(_("Invalid amount for %s=<amount>: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"),
"-maxtxfee", args.GetArg("-maxtxfee", ""), chain->relayMinFee().ToString()); "-maxtxfee", args.GetArg("-maxtxfee", ""), chain->relayMinFee().ToString());
return nullptr; return nullptr;
} }
walletInstance->m_max_tx_fee = max_fee.value(); walletInstance->m_max_tx_fee = max_tx_fee.value();
} }
if (args.IsArgSet("-consolidatefeerate")) { if (args.IsArgSet("-consolidatefeerate")) {