@@ -29,16 +29,10 @@ BOOST_FIXTURE_TEST_SUITE(coinselector_tests, WalletTestingSetup)
2929
3030typedef std::set<CInputCoin> CoinSet;
3131
32- /* TODO: Revert current globals removal and backport pull requests implementing it */
3332static const CoinEligibilityFilter filter_standard (1 , 6 , 0 );
3433static const CoinEligibilityFilter filter_confirmed (1 , 1 , 0 );
3534static const CoinEligibilityFilter filter_standard_extra (6 , 6 , 0 );
3635
37- CoinSelectionParams coin_selection_params (/* change_output_size= */ 0 ,
38- /* change_spend_size= */ 0 , /* effective_feerate= */ CFeeRate(0 ),
39- /* long_term_feerate= */ CFeeRate(0 ), /* discard_feerate= */ CFeeRate(0 ),
40- /* tx_noinputs_size= */ 0, /* avoid_partial= */ false);
41-
4236static void add_coin (const CAmount& nValue, int nInput, std::vector<CInputCoin>& set)
4337{
4438 CMutableTransaction tx;
@@ -281,9 +275,10 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
281275 /* tx_noinputs_size= */ 0 , /* avoid_partial= */ false );
282276 {
283277 std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain .get (), /* coinjoin_loader = */ nullptr , " " , CreateMockWalletDatabase ());
284- wallet->SetupLegacyScriptPubKeyMan ();
285278 wallet->LoadWallet ();
286279 LOCK (wallet->cs_wallet );
280+ wallet->SetWalletFlag (WALLET_FLAG_DESCRIPTORS);
281+ wallet->SetupDescriptorScriptPubKeyMans ();
287282
288283 std::vector<COutput> coins;
289284 CoinSet setCoinsRet;
@@ -305,8 +300,9 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
305300 {
306301 std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain .get (), /* coinjoin_loader = */ nullptr , " " , CreateMockWalletDatabase ());
307302 wallet->LoadWallet ();
308- wallet->SetupLegacyScriptPubKeyMan ();
309303 LOCK (wallet->cs_wallet );
304+ wallet->SetWalletFlag (WALLET_FLAG_DESCRIPTORS);
305+ wallet->SetupDescriptorScriptPubKeyMans ();
310306
311307 std::vector<COutput> coins;
312308 CoinSet setCoinsRet;
@@ -327,8 +323,9 @@ BOOST_AUTO_TEST_CASE(knapsack_solver_test)
327323{
328324 std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain .get (), /* coinjoin_loader = */ nullptr , " " , CreateMockWalletDatabase ());
329325 wallet->LoadWallet ();
330- wallet->SetupLegacyScriptPubKeyMan ();
331326 LOCK (wallet->cs_wallet );
327+ wallet->SetWalletFlag (WALLET_FLAG_DESCRIPTORS);
328+ wallet->SetupDescriptorScriptPubKeyMans ();
332329
333330 CoinSet setCoinsRet, setCoinsRet2;
334331 CAmount nValueRet;
@@ -533,9 +530,9 @@ BOOST_AUTO_TEST_CASE(knapsack_solver_test)
533530 for (uint16_t j = 0 ; j < 676 ; j++)
534531 add_coin (coins, *wallet, amt);
535532
536- // We only create the wallet once to save time, but we still run the coin selection RUN_TESTS times.
537- for (int i = 0 ; i < RUN_TESTS; i++) {
538- BOOST_CHECK (KnapsackSolver (2000 , KnapsackGroupOutputs (coins, *wallet, filter_confirmed), setCoinsRet, nValueRet));
533+ // We only create the wallet once to save time, but we still run the coin selection RUN_TESTS times.
534+ for (int i = 0 ; i < RUN_TESTS; i++) {
535+ BOOST_CHECK (KnapsackSolver (2000 , KnapsackGroupOutputs (coins, *wallet, filter_confirmed), setCoinsRet, nValueRet));
539536
540537 if (amt - 2000 < MIN_CHANGE) {
541538 // needs more than one input:
@@ -607,8 +604,9 @@ BOOST_AUTO_TEST_CASE(ApproximateBestSubset)
607604{
608605 std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain .get (), /* coinjoin_loader = */ nullptr , " " , CreateMockWalletDatabase ());
609606 wallet->LoadWallet ();
610- wallet->SetupLegacyScriptPubKeyMan ();
611607 LOCK (wallet->cs_wallet );
608+ wallet->SetWalletFlag (WALLET_FLAG_DESCRIPTORS);
609+ wallet->SetupDescriptorScriptPubKeyMans ();
612610
613611 CoinSet setCoinsRet;
614612 CAmount nValueRet;
@@ -629,8 +627,9 @@ BOOST_AUTO_TEST_CASE(SelectCoins_test)
629627{
630628 std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain .get (), /* coinjoin_loader = */ nullptr , " " , CreateMockWalletDatabase ());
631629 wallet->LoadWallet ();
632- wallet->SetupLegacyScriptPubKeyMan ();
633630 LOCK (wallet->cs_wallet );
631+ wallet->SetWalletFlag (WALLET_FLAG_DESCRIPTORS);
632+ wallet->SetupDescriptorScriptPubKeyMans ();
634633
635634 // Random generator stuff
636635 std::default_random_engine generator;
0 commit comments