@@ -40,8 +40,6 @@ extern RPCHelpMan getrawchangeaddress();
4040extern RPCHelpMan getaddressinfo ();
4141extern RPCHelpMan addmultisigaddress ();
4242
43- extern RecursiveMutex cs_wallets;
44-
4543// Ensure that fee levels defined in the wallet are at least as high
4644// as the default levels for node policy.
4745static_assert (DEFAULT_TRANSACTION_MINFEE >= DEFAULT_MIN_RELAY_TX_FEE, " wallet minimum fee is smaller than default relay fee" );
@@ -605,12 +603,7 @@ BOOST_FIXTURE_TEST_CASE(ListCoins, ListCoinsTestingSetup)
605603
606604BOOST_FIXTURE_TEST_CASE (wallet_disableprivkeys, TestChain100Setup)
607605{
608- NodeContext node;
609- node.fee_estimator = std::make_unique<CBlockPolicyEstimator>();
610- node.mempool = std::make_unique<CTxMemPool>(node.fee_estimator .get ());
611- auto chain = interfaces::MakeChain (node);
612- const std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(chain.get (), m_node.coinjoin_loader .get (), " " , CreateDummyWalletDatabase ());
613- wallet->SetupLegacyScriptPubKeyMan ();
606+ const std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(m_node.chain .get (), m_node.coinjoin_loader .get (), " " , CreateDummyWalletDatabase ()); wallet->SetupLegacyScriptPubKeyMan ();
614607 wallet->SetMinVersion (FEATURE_LATEST);
615608 wallet->SetWalletFlag (WALLET_FLAG_DISABLE_PRIVATE_KEYS);
616609 BOOST_CHECK (!wallet->TopUpKeyPool (1000 ));
@@ -637,19 +630,15 @@ static size_t CalculateNestedKeyhashInputSize(bool use_max_sig)
637630 // Create outer P2SH script for the output
638631 CScript script_pubkey = GetScriptForRawPubKey (pubkey);
639632
640- NodeContext node;
641- node.fee_estimator = std::make_unique<CBlockPolicyEstimator>();
642- node.mempool = std::make_unique<CTxMemPool>(node.fee_estimator .get ());
643- auto chain = interfaces::MakeChain (node);
644- CWallet wallet (chain.get (), /* coinjoin_loader=*/ nullptr , " " , CreateDummyWalletDatabase ());
645- AddKey (wallet, key);
646- auto spk_man = wallet.GetLegacyScriptPubKeyMan ();
647- spk_man->AddCScript (inner_script);
633+ // Add inner-script to key store and key to watchonly
634+ FillableSigningProvider keystore;
635+ keystore.AddCScript (inner_script);
636+ keystore.AddKeyPubKey (key, pubkey);
648637
649638 // Fill in dummy signatures for fee calculation.
650639 SignatureData sig_data;
651640
652- if (!ProduceSignature (*spk_man , use_max_sig ? DUMMY_MAXIMUM_SIGNATURE_CREATOR : DUMMY_SIGNATURE_CREATOR, script_pubkey, sig_data)) {
641+ if (!ProduceSignature (keystore , use_max_sig ? DUMMY_MAXIMUM_SIGNATURE_CREATOR : DUMMY_SIGNATURE_CREATOR, script_pubkey, sig_data)) {
653642 // We're hand-feeding it correct arguments; shouldn't happen
654643 assert (false );
655644 }
@@ -805,7 +794,6 @@ BOOST_FIXTURE_TEST_CASE(CreateWalletWithoutChain, BasicTestingSetup)
805794BOOST_FIXTURE_TEST_CASE (ZapSelectTx, TestChain100Setup)
806795{
807796 gArgs .ForceSetArg (" -unsafesqlitesync" , " 1" );
808- auto chain = interfaces::MakeChain (m_node);
809797 auto wallet = TestLoadWallet (m_node.chain .get (), m_node.coinjoin_loader .get ());
810798 CKey key;
811799 key.MakeNewKey (true );
0 commit comments