aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/coinselection.h
diff options
context:
space:
mode:
authorMurch <murch@murch.one>2023-06-02 16:27:36 -0400
committerMurch <murch@murch.one>2023-06-21 16:19:19 -0400
commit941b8c6539d72890fd4e36fc900be9c300e1d737 (patch)
treeb96782e9367b8d9106e390bffde887f62ebb2d31 /src/wallet/coinselection.h
parenta36134fcc7b40671d538931f621c8c15ffacc3d2 (diff)
downloadbitcoin-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/coinselection.h')
-rw-r--r--src/wallet/coinselection.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wallet/coinselection.h b/src/wallet/coinselection.h
index 432d7d1431..afd868fc89 100644
--- a/src/wallet/coinselection.h
+++ b/src/wallet/coinselection.h
@@ -421,7 +421,7 @@ util::Result<SelectionResult> SelectCoinsBnB(std::vector<OutputGroup>& utxo_pool
* @param[in] max_weight The maximum allowed weight for a selection result to be valid
* @returns If successful, a valid SelectionResult, otherwise, util::Error
*/
-util::Result<SelectionResult> SelectCoinsSRD(const std::vector<OutputGroup>& utxo_pool, CAmount target_value, FastRandomContext& rng,
+util::Result<SelectionResult> SelectCoinsSRD(const std::vector<OutputGroup>& utxo_pool, CAmount target_value, CAmount change_fee, FastRandomContext& rng,
int max_weight);
// Original coin selection algorithm as a fallback