From 60d2ca72e3f4c56433c63b929a88e7a2def06399 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 16 Nov 2020 14:31:45 -0500 Subject: Return SelectionResult from SelectCoinsBnB Removes coins_out and value_ret has SelectCoinsBnB return a std::optional --- src/bench/coin_selection.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/bench') diff --git a/src/bench/coin_selection.cpp b/src/bench/coin_selection.cpp index fd5145950b..0ac8fc6b34 100644 --- a/src/bench/coin_selection.cpp +++ b/src/bench/coin_selection.cpp @@ -92,17 +92,14 @@ static void BnBExhaustion(benchmark::Bench& bench) { // Setup std::vector utxo_pool; - CoinSet selection; - CAmount value_ret = 0; bench.run([&] { // Benchmark CAmount target = make_hard_case(17, utxo_pool); - SelectCoinsBnB(utxo_pool, target, 0, selection, value_ret); // Should exhaust + SelectCoinsBnB(utxo_pool, target, 0); // Should exhaust // Cleanup utxo_pool.clear(); - selection.clear(); }); } -- cgit v1.2.3 From 9d9b101d2019d8237546eedd022e74519feb07bb Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Fri, 21 May 2021 18:39:41 -0400 Subject: Use SelectionResult in AttemptSelection Replace setCoinsRet and nValueRet with a SelectionResult in AttemptSelection --- src/bench/coin_selection.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/bench') diff --git a/src/bench/coin_selection.cpp b/src/bench/coin_selection.cpp index 0ac8fc6b34..686811d95b 100644 --- a/src/bench/coin_selection.cpp +++ b/src/bench/coin_selection.cpp @@ -54,12 +54,10 @@ static void CoinSelection(benchmark::Bench& bench) /* long_term_feerate= */ CFeeRate(0), /* discard_feerate= */ CFeeRate(0), /* tx_noinputs_size= */ 0, /* avoid_partial= */ false); bench.run([&] { - std::set setCoinsRet; - CAmount nValueRet; - bool success = AttemptSelection(wallet, 1003 * COIN, filter_standard, coins, setCoinsRet, nValueRet, coin_selection_params); - assert(success); - assert(nValueRet == 1003 * COIN); - assert(setCoinsRet.size() == 2); + auto result = AttemptSelection(wallet, 1003 * COIN, filter_standard, coins, coin_selection_params); + assert(result); + assert(result->GetSelectedValue() == 1003 * COIN); + assert(result->GetInputSet().size() == 2); }); } -- cgit v1.2.3