diff options
author | Andrew Chow <achow101-github@achow101.com> | 2022-05-26 13:07:38 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2022-05-26 13:49:52 -0400 |
commit | a0e8aff6051bfeaad38799058a2a46fa2e45911d (patch) | |
tree | 1747a0504edb68375eb6c7e4cdffc30673f22e32 /src | |
parent | 2642dee1364ddc9b174e0ccb6b7b37ae44899c2a (diff) | |
parent | 6b636730f4befee39d57fcfd51298f3015dbf563 (diff) | |
download | bitcoin-a0e8aff6051bfeaad38799058a2a46fa2e45911d.tar.xz |
Merge bitcoin/bitcoin#25003: tracing: fix `coin_selection:aps_create_tx_internal` calling logic
6b636730f4befee39d57fcfd51298f3015dbf563 tracing: fix `coin_selection:aps_create_tx_internal` calling logic (Sebastian Falbesoner)
Pull request description:
According to the documentation, the tracepoint `coin_selection:aps_create_tx_internal` "Is called when the second `CreateTransactionInternal` with Avoid Partial Spends enabled completes."
Currently it is only called if the second call to `CreateTransactionInternal` succeeds, i.e. the third parameter is always `true` and we don't get notified in the case that it fails. This PR fixes this by moving the tracepoint call and the `use_aps` boolean variable outside the if body.
ACKs for top commit:
achow101:
ACK 6b636730f4befee39d57fcfd51298f3015dbf563
furszy:
re-ACK 6b636730
Tree-SHA512: 453825123aa10748642c7dd94324ced2d07df0f4fac478b0947a34820b515ae300f75721679a90a164f3127029739df55c4de035c4567e663893c3c6dbdef216
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/spend.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp index fe36cfcc6b..6f79ae4e9b 100644 --- a/src/wallet/spend.cpp +++ b/src/wallet/spend.cpp @@ -997,12 +997,13 @@ std::optional<CreatedTransactionResult> CreateTransaction( tmp_cc.m_avoid_partial_spends = true; bilingual_str error2; // fired and forgotten; if an error occurs, we discard the results std::optional<CreatedTransactionResult> txr_grouped = CreateTransactionInternal(wallet, vecSend, change_pos, error2, tmp_cc, fee_calc_out, sign); + // if fee of this alternative one is within the range of the max fee, we use this one + const bool use_aps{txr_grouped.has_value() ? (txr_grouped->fee <= txr_ungrouped->fee + wallet.m_max_aps_fee) : false}; + TRACE5(coin_selection, aps_create_tx_internal, wallet.GetName().c_str(), use_aps, txr_grouped.has_value(), + txr_grouped.has_value() ? txr_grouped->fee : 0, txr_grouped.has_value() ? txr_grouped->change_pos : 0); if (txr_grouped) { - // if fee of this alternative one is within the range of the max fee, we use this one - const bool use_aps = txr_grouped->fee <= txr_ungrouped->fee + wallet.m_max_aps_fee; wallet.WalletLogPrintf("Fee non-grouped = %lld, grouped = %lld, using %s\n", txr_ungrouped->fee, txr_grouped->fee, use_aps ? "grouped" : "non-grouped"); - TRACE5(coin_selection, aps_create_tx_internal, wallet.GetName().c_str(), use_aps, true, txr_grouped->fee, txr_grouped->change_pos); if (use_aps) return txr_grouped; } } |