Skip to content

Commit 44cc75f

Browse files
committed
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.
1 parent ec79b5f commit 44cc75f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/wallet/wallet.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,6 +2729,12 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CTransac
27292729

27302730
// Get the fee rate to use effective values in coin selection
27312731
CFeeRate nFeeRateNeeded = GetMinimumFeeRate(*this, coin_control, &feeCalc);
2732+
// Do not, ever, assume that it's fine to change the fee rate if the user has explicitly
2733+
// provided one
2734+
if (coin_control.m_feerate && nFeeRateNeeded > *coin_control.m_feerate) {
2735+
error = strprintf(_("Fee rate (%s) is lower than the minimum fee rate setting (%s)"), coin_control.m_feerate->ToString(), nFeeRateNeeded.ToString());
2736+
return false;
2737+
}
27322738

27332739
nFeeRet = 0;
27342740
bool pick_new_inputs = true;

0 commit comments

Comments
 (0)