From b96ee276651bd080d4a9a8a51b6666a78bb39fa1 Mon Sep 17 00:00:00 2001 From: Murch Date: Wed, 17 Apr 2024 17:13:22 -0400 Subject: [PATCH] Remove calls to other Coin Selection algorithms --- src/wallet/spend.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp index c617fd047da54..15411a3ec0270 100644 --- a/src/wallet/spend.cpp +++ b/src/wallet/spend.cpp @@ -694,44 +694,14 @@ util::Result ChooseSelectionResult(interfaces::Chain& chain, co // Maximum allowed weight int max_inputs_weight = MAX_STANDARD_TX_WEIGHT - (coin_selection_params.tx_noinputs_size * WITNESS_SCALE_FACTOR); - // SFFO frequently causes issues in the context of changeless input sets: skip BnB when SFFO is active - if (!coin_selection_params.m_subtract_fee_outputs) { - if (auto bnb_result{SelectCoinsBnB(groups.positive_group, nTargetValue, coin_selection_params.m_cost_of_change, max_inputs_weight)}) { - results.push_back(*bnb_result); - } else append_error(bnb_result); - } - // As Knapsack and SRD can create change, also deduce change weight. max_inputs_weight -= (coin_selection_params.change_output_size * WITNESS_SCALE_FACTOR); - // The knapsack solver has some legacy behavior where it will spend dust outputs. We retain this behavior, so don't filter for positive only here. - if (auto knapsack_result{KnapsackSolver(groups.mixed_group, nTargetValue, coin_selection_params.m_min_change_target, coin_selection_params.rng_fast, max_inputs_weight)}) { - results.push_back(*knapsack_result); - } else append_error(knapsack_result); - - if (coin_selection_params.m_effective_feerate > CFeeRate{3 * coin_selection_params.m_long_term_feerate}) { // Minimize input set for feerates of at least 3×LTFRE (default: 30 ṩ/vB+) - if (auto cg_result{CoinGrinder(groups.positive_group, nTargetValue, coin_selection_params.m_min_change_target, max_inputs_weight)}) { - cg_result->ComputeAndSetWaste(coin_selection_params.min_viable_change, coin_selection_params.m_cost_of_change, coin_selection_params.m_change_fee); - results.push_back(*cg_result); - } else { - append_error(cg_result); - } - } - // Allow Largest First to spend UTXOs with negative effective value at any feerate if (auto lf_result{LargestFirst(groups.mixed_group, nTargetValue, coin_selection_params.m_min_change_target, max_inputs_weight)}) { results.push_back(*lf_result); } else append_error(lf_result); - // Allow SandCompactor to spend UTXOs with negative effective value at any feerate - if (auto sc_result{SandCompactor(groups.mixed_group, nTargetValue, coin_selection_params.m_min_change_target, max_inputs_weight)}) { - results.push_back(*sc_result); - } else append_error(sc_result); - - if (auto srd_result{SelectCoinsSRD(groups.positive_group, nTargetValue, coin_selection_params.m_change_fee, coin_selection_params.rng_fast, max_inputs_weight)}) { - results.push_back(*srd_result); - } else append_error(srd_result); - if (results.empty()) { // No solution found, retrieve the first explicit error (if any). // future: add 'severity level' to errors so the worst one can be retrieved instead of the first one.