aboutsummaryrefslogtreecommitdiff
path: root/src/bench
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2018-03-05 16:42:49 -0500
committerAndrew Chow <achow101-github@achow101.com>2018-03-13 12:39:27 -0400
commit6a34ff5335786615771ca423134a484b04831c4e (patch)
treeed5aaec39589b9ac50272d0844bd0c19e564ccc2 /src/bench
parentfab04887c22cf71a4b15ac0b0a127e150229d686 (diff)
downloadbitcoin-6a34ff5335786615771ca423134a484b04831c4e.tar.xz
Have SelectCoinsMinConf and SelectCoins use BnB or Knapsack and use it
Allows SelectCoinsMinConf and SelectCoins be able to switch between using BnB or Knapsack for choosing coins. Has SelectCoinsMinConf do the preprocessing necessary to support either BnB or Knapsack. This includes calculating the filtering the effective values for each input. Uses BnB in CreateTransaction to find an exact match for the output. If BnB fails, it will fallback to the Knapsack solver.
Diffstat (limited to 'src/bench')
-rw-r--r--src/bench/coin_selection.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bench/coin_selection.cpp b/src/bench/coin_selection.cpp
index 55ff7b61f1..605d9e3e66 100644
--- a/src/bench/coin_selection.cpp
+++ b/src/bench/coin_selection.cpp
@@ -44,8 +44,11 @@ static void CoinSelection(benchmark::State& state)
std::set<CInputCoin> setCoinsRet;
CAmount nValueRet;
+ bool bnb_used;
CoinEligibilityFilter filter_standard(1, 6, 0);
- bool success = wallet.SelectCoinsMinConf(1003 * COIN, filter_standard, vCoins, setCoinsRet, nValueRet);
+ CoinSelectionParams coin_selection_params(false, 34, 148, CFeeRate(0), 0);
+ bool success = wallet.SelectCoinsMinConf(1003 * COIN, filter_standard, vCoins, setCoinsRet, nValueRet, coin_selection_params, bnb_used)
+ || wallet.SelectCoinsMinConf(1003 * COIN, filter_standard, vCoins, setCoinsRet, nValueRet, coin_selection_params, bnb_used);
assert(success);
assert(nValueRet == 1003 * COIN);
assert(setCoinsRet.size() == 2);