diff options
author | furszy <matiasfurszyfer@protonmail.com> | 2022-08-03 19:04:36 -0300 |
---|---|---|
committer | furszy <matiasfurszyfer@protonmail.com> | 2023-03-06 09:45:40 -0300 |
commit | 6a302d40dfcc33b15bf27a1d3fcc04bfd3cbda44 (patch) | |
tree | f532e7e41b8d128dd176904d531c86f7a3c1786c /src/bench/coin_selection.cpp | |
parent | bd91ed1cb2cc804f824d1b204513ac2afb7d5e28 (diff) | |
download | bitcoin-6a302d40dfcc33b15bf27a1d3fcc04bfd3cbda44.tar.xz |
wallet: single output groups filtering and grouping process
Optimizes coin selection by performing the "group outputs"
procedure only once, outside the "attempt selection" process.
Avoiding the repeated execution of the 'GroupOutputs' operation
that occurs on each coin eligibility filters (up to 8 of them);
then for every coin vector type plus one for all the coins together.
This also let us not perform coin selection over coin eligibility
filtered groups that don't add new elements.
(because, if the previous round failed, and the subsequent one has
the same coins, then this new round will fail again).
Diffstat (limited to 'src/bench/coin_selection.cpp')
-rw-r--r-- | src/bench/coin_selection.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bench/coin_selection.cpp b/src/bench/coin_selection.cpp index 8a78783517..265d4bf655 100644 --- a/src/bench/coin_selection.cpp +++ b/src/bench/coin_selection.cpp @@ -75,8 +75,9 @@ static void CoinSelection(benchmark::Bench& bench) /*tx_noinputs_size=*/ 0, /*avoid_partial=*/ false, }; + auto group = wallet::GroupOutputs(wallet, available_coins, coin_selection_params, {{filter_standard}})[filter_standard]; bench.run([&] { - auto result = AttemptSelection(wallet, 1003 * COIN, filter_standard, available_coins, coin_selection_params, /*allow_mixed_output_types=*/true); + auto result = AttemptSelection(1003 * COIN, group, coin_selection_params, /*allow_mixed_output_types=*/true); assert(result); assert(result->GetSelectedValue() == 1003 * COIN); assert(result->GetInputSet().size() == 2); |