Skip to content

Commit fdba53e

Browse files
committed
merge bitcoin#25003: fix coin_selection:aps_create_tx_internal calling logic
1 parent 0b915e7 commit fdba53e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/wallet/spend.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,12 +1067,13 @@ std::optional<CreatedTransactionResult> CreateTransaction(
10671067
}
10681068

10691069
std::optional<CreatedTransactionResult> txr_grouped = CreateTransactionInternal(wallet, vecSend, change_pos, error2, tmp_cc, fee_calc_out, sign, nExtraPayloadSize);
1070+
// if fee of this alternative one is within the range of the max fee, we use this one
1071+
const bool use_aps{txr_grouped.has_value() ? (txr_grouped->fee <= txr_ungrouped->fee + wallet.m_max_aps_fee) : false};
1072+
TRACE5(coin_selection, aps_create_tx_internal, wallet.GetName().c_str(), use_aps, txr_grouped.has_value(),
1073+
txr_grouped.has_value() ? txr_grouped->fee : 0, txr_grouped.has_value() ? txr_grouped->change_pos : 0);
10701074
if (txr_grouped) {
1071-
// if fee of this alternative one is within the range of the max fee, we use this one
1072-
const bool use_aps = txr_grouped->fee <= txr_ungrouped->fee + wallet.m_max_aps_fee;
10731075
wallet.WalletLogPrintf("Fee non-grouped = %lld, grouped = %lld, using %s\n",
10741076
txr_ungrouped->fee, txr_grouped->fee, use_aps ? "grouped" : "non-grouped");
1075-
TRACE5(coin_selection, aps_create_tx_internal, wallet.GetName().c_str(), use_aps, true, txr_grouped->fee, txr_grouped->change_pos);
10761077
if (use_aps) return txr_grouped;
10771078
}
10781079
}

0 commit comments

Comments
 (0)