From 44cc75f80ee7805a117e9298a182af1a44bcbff4 Mon Sep 17 00:00:00 2001 From: Karl-Johan Alm Date: Tue, 3 Mar 2020 14:09:02 +0900 Subject: wallet: error if an explicit fee rate was given but the needed fee rate differed This avoids cases where a user requests a fee rate below the minimum and is silently overruled by the wallet. --- src/wallet/wallet.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/wallet/wallet.cpp') diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index a893548971..894cd510d9 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2729,6 +2729,12 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, CTransac // Get the fee rate to use effective values in coin selection CFeeRate nFeeRateNeeded = GetMinimumFeeRate(*this, coin_control, &feeCalc); + // Do not, ever, assume that it's fine to change the fee rate if the user has explicitly + // provided one + if (coin_control.m_feerate && nFeeRateNeeded > *coin_control.m_feerate) { + error = strprintf(_("Fee rate (%s) is lower than the minimum fee rate setting (%s)"), coin_control.m_feerate->ToString(), nFeeRateNeeded.ToString()); + return false; + } nFeeRet = 0; bool pick_new_inputs = true; -- cgit v1.2.3