Skip to content

Commit

Permalink
wallet: error if an explicit fee rate was given but the needed fee ra…
Browse files Browse the repository at this point in the history
…te differed

This avoids cases where a user requests a fee rate below the minimum and is silently overruled by the wallet.
  • Loading branch information
kallewoof committed Mar 7, 2020
1 parent 3f82659 commit f6f525c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/wallet/wallet.cpp
Expand Up @@ -2659,6 +2659,12 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std

// 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) {
strFailReason = strprintf("Fee rate is too low for the current minimum required feerate. Increase it to at least %s.", nFeeRateNeeded.ToString());
return false;
}

nFeeRet = 0;
bool pick_new_inputs = true;
Expand Down

0 comments on commit f6f525c

Please sign in to comment.