Skip to content

Commit 6d6d278

Browse files
committed
Change SelectCoins_test to actually test SelectCoins
This was originally modified to use SelectCoinsMinConf in order to test both BnB and Knapsack at the same time. But since SelectCoins does both now, this is no longer necessary and we can revert back to actually testing SelectCoins.
1 parent 9d3bd74 commit 6d6d278

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/wallet/test/coinselector_tests.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ BOOST_AUTO_TEST_CASE(ApproximateBestSubset)
613613
// Tests that with the ideal conditions, the coin selector will always be able to find a solution that can pay the target value
614614
BOOST_AUTO_TEST_CASE(SelectCoins_test)
615615
{
616+
LOCK(testWallet.cs_wallet);
616617
testWallet.SetupLegacyScriptPubKeyMan();
617618

618619
// Random generator stuff
@@ -638,18 +639,14 @@ BOOST_AUTO_TEST_CASE(SelectCoins_test)
638639
CAmount target = rand.randrange(balance - 1000) + 1000;
639640

640641
// Perform selection
641-
CoinSelectionParams coin_selection_params_knapsack(/* change_output_size= */ 34,
642-
/* change_spend_size= */ 148, /* effective_feerate= */ CFeeRate(0),
643-
/* long_term_feerate= */ CFeeRate(0), /* discard_feerate= */ CFeeRate(0),
644-
/* tx_no_inputs_size= */ 0, /* avoid_partial= */ false);
645-
CoinSelectionParams coin_selection_params_bnb(/* change_output_size= */ 34,
646-
/* change_spend_size= */ 148, /* effective_feerate= */ CFeeRate(0),
647-
/* long_term_feerate= */ CFeeRate(0), /* discard_feerate= */ CFeeRate(0),
648-
/* tx_no_inputs_size= */ 0, /* avoid_partial= */ false);
642+
CoinSelectionParams cs_params(/* change_output_size= */ 34,
643+
/* change_spend_size= */ 148, /* effective_feerate= */ CFeeRate(0),
644+
/* long_term_feerate= */ CFeeRate(0), /* discard_feerate= */ CFeeRate(0),
645+
/* tx_no_inputs_size= */ 0, /* avoid_partial= */ false);
649646
CoinSet out_set;
650647
CAmount out_value = 0;
651-
BOOST_CHECK(testWallet.SelectCoinsMinConf(target, filter_standard, vCoins, out_set, out_value, coin_selection_params_bnb) ||
652-
testWallet.SelectCoinsMinConf(target, filter_standard, vCoins, out_set, out_value, coin_selection_params_knapsack));
648+
CCoinControl cc;
649+
BOOST_CHECK(testWallet.SelectCoins(vCoins, target, out_set, out_value, cc, cs_params));
653650
BOOST_CHECK_GE(out_value, target);
654651
}
655652
}

0 commit comments

Comments
 (0)