From 1707f01309094eddec93b38d0377cd95156112de Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Sat, 24 Feb 2024 16:25:32 +0700 Subject: [PATCH] fix: follow-up changes from bitcoin/bitcoin#22220 for maxapsfee --- src/wallet/wallet.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 315d52a688..75d5938e61 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4694,18 +4694,18 @@ std::shared_ptr CWallet::Create(interfaces::Chain& chain, interfaces::C if (gArgs.IsArgSet("-maxapsfee")) { const std::string max_aps_fee{gArgs.GetArg("-maxapsfee", "")}; - CAmount n = 0; if (max_aps_fee == "-1") { - n = -1; - } else if (!ParseMoney(max_aps_fee, n)) { + walletInstance->m_max_aps_fee = -1; + } else if (std::optional max_fee = ParseMoney(max_aps_fee)) { + if (max_fee.value() > HIGH_APS_FEE) { + 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.")); + } + walletInstance->m_max_aps_fee = max_fee.value(); + } else { error = AmountErrMsg("maxapsfee", max_aps_fee); return nullptr; } - if (n > HIGH_APS_FEE) { - 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.")); - } - walletInstance->m_max_aps_fee = n; } if (gArgs.IsArgSet("-fallbackfee")) {