Skip to content

Commit e2f429e

Browse files
committed
wallet: Replace nFeeRateNeeded with effective_fee
Make sure that all fee calculations use the same feerate. coin_selection_params.effective_fee is the variable we use for all fee calculations, so get rid of remaining nFeeRateNeeded usages and just directly set coin_selection_params.effective_fee. Does not change behavior.
1 parent 1a6a0b0 commit e2f429e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/wallet/wallet.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,11 +2807,11 @@ bool CWallet::CreateTransactionInternal(
28072807
CFeeRate discard_rate = GetDiscardRate(*this);
28082808

28092809
// Get the fee rate to use effective values in coin selection
2810-
CFeeRate nFeeRateNeeded = GetMinimumFeeRate(*this, coin_control, &feeCalc);
2810+
coin_selection_params.effective_fee = GetMinimumFeeRate(*this, coin_control, &feeCalc);
28112811
// Do not, ever, assume that it's fine to change the fee rate if the user has explicitly
28122812
// provided one
2813-
if (coin_control.m_feerate && nFeeRateNeeded > *coin_control.m_feerate) {
2814-
error = strprintf(_("Fee rate (%s) is lower than the minimum fee rate setting (%s)"), coin_control.m_feerate->ToString(FeeEstimateMode::SAT_VB), nFeeRateNeeded.ToString(FeeEstimateMode::SAT_VB));
2813+
if (coin_control.m_feerate && coin_selection_params.effective_fee > *coin_control.m_feerate) {
2814+
error = strprintf(_("Fee rate (%s) is lower than the minimum fee rate setting (%s)"), coin_control.m_feerate->ToString(FeeEstimateMode::SAT_VB), coin_selection_params.effective_fee.ToString(FeeEstimateMode::SAT_VB));
28152815
return false;
28162816
}
28172817
if (feeCalc.reason == FeeReason::FALLBACK && !m_allow_fallback_fee) {
@@ -2893,7 +2893,6 @@ bool CWallet::CreateTransactionInternal(
28932893
} else {
28942894
coin_selection_params.change_spend_size = (size_t)change_spend_size;
28952895
}
2896-
coin_selection_params.effective_fee = nFeeRateNeeded;
28972896
if (!SelectCoins(vAvailableCoins, nValueToSelect, setCoins, nValueIn, coin_control, coin_selection_params, bnb_used))
28982897
{
28992898
// If BnB was used, it was the first pass. No longer the first pass and continue loop with knapsack.

0 commit comments

Comments
 (0)