diff options
author | Murch <murch@murch.one> | 2023-06-02 16:27:36 -0400 |
---|---|---|
committer | Murch <murch@murch.one> | 2023-06-21 16:19:19 -0400 |
commit | 941b8c6539d72890fd4e36fc900be9c300e1d737 (patch) | |
tree | b96782e9367b8d9106e390bffde887f62ebb2d31 /src/wallet/spend.cpp | |
parent | a36134fcc7b40671d538931f621c8c15ffacc3d2 (diff) | |
download | bitcoin-941b8c6539d72890fd4e36fc900be9c300e1d737.tar.xz |
[bug] Increase SRD target by change_fee
I discovered via fuzzing of another coin selection approach that at
extremely high feerates SRD may find input sets that lead to
transactions without change outputs. This is an unintended outcome since
SRD is meant to always produce a transaction with a change output—we use
other algorithms to specifically search for changeless solutions.
The issue occures when the flat allowance of 50,000 ṩ for change is
insufficient to pay for the creation of a change output with a non-dust
amount, at and above 1,613 ṩ/vB. Increasing the change budget by
change_fees makes SRD behave as expected at any feerates.
Diffstat (limited to 'src/wallet/spend.cpp')
-rw-r--r-- | src/wallet/spend.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp index 99c6582f9c..a3728223fb 100644 --- a/src/wallet/spend.cpp +++ b/src/wallet/spend.cpp @@ -583,7 +583,7 @@ util::Result<SelectionResult> ChooseSelectionResult(const CAmount& nTargetValue, results.push_back(*knapsack_result); } else append_error(knapsack_result); - if (auto srd_result{SelectCoinsSRD(groups.positive_group, nTargetValue, coin_selection_params.rng_fast, max_inputs_weight)}) { + if (auto srd_result{SelectCoinsSRD(groups.positive_group, nTargetValue, coin_selection_params.m_change_fee, coin_selection_params.rng_fast, max_inputs_weight)}) { srd_result->ComputeAndSetWaste(coin_selection_params.min_viable_change, coin_selection_params.m_cost_of_change, coin_selection_params.m_change_fee); results.push_back(*srd_result); } else append_error(srd_result); |