Skip to content

Commit

Permalink
wallet: Use existing feerate instead of getting a new one
Browse files Browse the repository at this point in the history
Courtesy of 1a6a0b0 from bitcoin#21083
  • Loading branch information
kwvg committed Feb 9, 2025
1 parent 1930572 commit 6ca51df
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/wallet/spend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,11 @@ bool CWallet::CreateTransactionInternal(
error = strprintf(_("Fee rate (%s) is lower than the minimum fee rate setting (%s)"), coin_control.m_feerate->ToString(FeeEstimateMode::DUFF_B), coin_selection_params.m_effective_feerate.ToString(FeeEstimateMode::DUFF_B));
return false;
}
if (feeCalc.reason == FeeReason::FALLBACK && !m_allow_fallback_fee) {
// eventually allow a fallback fee
error = _("Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee.");
return false;
}

int nBytes{0};
{
Expand Down Expand Up @@ -802,7 +807,7 @@ bool CWallet::CreateTransactionInternal(
txin.scriptSig = CScript();
}

nFee = GetMinimumFee(*this, nBytes, coin_control, &feeCalc);
nFee = coin_selection_params.m_effective_feerate.GetFee(nBytes);

return true;
};
Expand Down Expand Up @@ -911,12 +916,6 @@ bool CWallet::CreateTransactionInternal(
}
}

if (feeCalc.reason == FeeReason::FALLBACK && !m_allow_fallback_fee) {
// eventually allow a fallback fee
error = _("Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee.");
return false;
}

if (nAmountLeft == nFeeRet) {
// We either added the change amount to nFeeRet because the change amount was considered
// to be dust or the input exactly matches output + fee.
Expand Down

0 comments on commit 6ca51df

Please sign in to comment.