aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorKarl-Johan Alm <karljohan-alm@garage.co.jp>2020-03-03 14:09:02 +0900
committerKarl-Johan Alm <karljohan-alm@garage.co.jp>2020-05-05 14:09:20 +0900
commit44cc75f80ee7805a117e9298a182af1a44bcbff4 (patch)
treeec0e9e9d5f4c6d786654802965bd44b65999aaca /src/wallet/wallet.cpp
parentec79b5f86b22ad8f77c736f9bb76c2e4d7faeaa4 (diff)
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.
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp6
1 files changed, 6 insertions, 0 deletions
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<CRecipient>& 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;