Skip to content

Commit 6ca51df

Browse files
committed
wallet: Use existing feerate instead of getting a new one
Courtesy of 1a6a0b0 from bitcoin#21083
1 parent 1930572 commit 6ca51df

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/wallet/spend.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,11 @@ bool CWallet::CreateTransactionInternal(
651651
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));
652652
return false;
653653
}
654+
if (feeCalc.reason == FeeReason::FALLBACK && !m_allow_fallback_fee) {
655+
// eventually allow a fallback fee
656+
error = _("Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee.");
657+
return false;
658+
}
654659

655660
int nBytes{0};
656661
{
@@ -802,7 +807,7 @@ bool CWallet::CreateTransactionInternal(
802807
txin.scriptSig = CScript();
803808
}
804809

805-
nFee = GetMinimumFee(*this, nBytes, coin_control, &feeCalc);
810+
nFee = coin_selection_params.m_effective_feerate.GetFee(nBytes);
806811

807812
return true;
808813
};
@@ -911,12 +916,6 @@ bool CWallet::CreateTransactionInternal(
911916
}
912917
}
913918

914-
if (feeCalc.reason == FeeReason::FALLBACK && !m_allow_fallback_fee) {
915-
// eventually allow a fallback fee
916-
error = _("Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee.");
917-
return false;
918-
}
919-
920919
if (nAmountLeft == nFeeRet) {
921920
// We either added the change amount to nFeeRet because the change amount was considered
922921
// to be dust or the input exactly matches output + fee.

0 commit comments

Comments
 (0)