Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/coinselector_tests.cpp
Show First 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(bnb_search_test) { | ||||
for (int i = 5; i <= 20; ++i) { | for (int i = 5; i <= 20; ++i) { | ||||
add_coin(i * CENT, i, utxo_pool); | add_coin(i * CENT, i, utxo_pool); | ||||
} | } | ||||
// Run 100 times, to make sure it is never finding a solution | // Run 100 times, to make sure it is never finding a solution | ||||
for (int i = 0; i < 100; ++i) { | for (int i = 0; i < 100; ++i) { | ||||
BOOST_CHECK(!SelectCoinsBnB(utxo_pool, 1 * CENT, 2 * CENT, selection, | BOOST_CHECK(!SelectCoinsBnB(utxo_pool, 1 * CENT, 2 * CENT, selection, | ||||
value_ret, not_input_fees)); | value_ret, not_input_fees)); | ||||
} | } | ||||
// Make sure that effective value is working in SelectCoinsMinConf when BnB | |||||
// is used | |||||
CoinSelectionParams coin_selection_params_bnb(true, 0, 0, | |||||
CFeeRate(3000 * SATOSHI), 0); | |||||
CoinSet setCoinsRet; | |||||
Amount nValueRet; | |||||
bool bnb_used; | |||||
empty_wallet(); | |||||
add_coin(m_wallet, SATOSHI); | |||||
// Make sure that it has a negative effective value. The next check should | |||||
// assert if this somehow got through. Otherwise it will fail | |||||
vCoins.at(0).nInputBytes = 40; | |||||
BOOST_CHECK(!m_wallet.SelectCoinsMinConf( | |||||
1 * CENT, filter_standard, vCoins, setCoinsRet, nValueRet, | |||||
coin_selection_params_bnb, bnb_used)); | |||||
} | } | ||||
BOOST_AUTO_TEST_CASE(knapsack_solver_test) { | BOOST_AUTO_TEST_CASE(knapsack_solver_test) { | ||||
CoinSet setCoinsRet, setCoinsRet2; | CoinSet setCoinsRet, setCoinsRet2; | ||||
Amount nValueRet; | Amount nValueRet; | ||||
bool bnb_used; | bool bnb_used; | ||||
LOCK(m_wallet.cs_wallet); | LOCK(m_wallet.cs_wallet); | ||||
▲ Show 20 Lines • Show All 454 Lines • Show Last 20 Lines |