@@ -28,6 +28,8 @@ RPCHelpMan importmulti();
2828RPCHelpMan dumpwallet ();
2929RPCHelpMan importwallet ();
3030
31+ extern RecursiveMutex cs_wallets;
32+
3133// Ensure that fee levels defined in the wallet are at least as high
3234// as the default levels for node policy.
3335static_assert (DEFAULT_TRANSACTION_MINFEE >= DEFAULT_MIN_RELAY_TX_FEE, " wallet minimum fee is smaller than default relay fee" );
@@ -761,16 +763,18 @@ BOOST_FIXTURE_TEST_CASE(CreateWallet, TestChain100Setup)
761763 // deadlock during the sync and simulates a new block notification happening
762764 // as soon as possible.
763765 addtx_count = 0 ;
764- auto handler = HandleLoadWallet ([&](std::unique_ptr<interfaces::Wallet> wallet) EXCLUSIVE_LOCKS_REQUIRED (wallet->wallet ()->cs_wallet ) {
766+ auto handler = HandleLoadWallet ([&](std::unique_ptr<interfaces::Wallet> wallet) EXCLUSIVE_LOCKS_REQUIRED (wallet->wallet ()->cs_wallet , cs_wallets ) {
765767 BOOST_CHECK (rescan_completed);
766768 m_coinbase_txns.push_back (CreateAndProcessBlock ({}, GetScriptForRawPubKey (coinbaseKey.GetPubKey ())).vtx [0 ]);
767769 block_tx = TestSimpleSpend (*m_coinbase_txns[2 ], 0 , coinbaseKey, GetScriptForRawPubKey (key.GetPubKey ()));
768770 m_coinbase_txns.push_back (CreateAndProcessBlock ({block_tx}, GetScriptForRawPubKey (coinbaseKey.GetPubKey ())).vtx [0 ]);
769771 mempool_tx = TestSimpleSpend (*m_coinbase_txns[3 ], 0 , coinbaseKey, GetScriptForRawPubKey (key.GetPubKey ()));
770772 BOOST_CHECK (m_node.chain ->broadcastTransaction (MakeTransactionRef (mempool_tx), DEFAULT_TRANSACTION_MAXFEE, false , error));
773+ LEAVE_CRITICAL_SECTION (cs_wallets);
771774 LEAVE_CRITICAL_SECTION (wallet->wallet ()->cs_wallet );
772775 SyncWithValidationInterfaceQueue ();
773776 ENTER_CRITICAL_SECTION (wallet->wallet ()->cs_wallet );
777+ ENTER_CRITICAL_SECTION (cs_wallets);
774778 });
775779 wallet = TestLoadWallet (*m_node.chain );
776780 BOOST_CHECK_EQUAL (addtx_count, 4 );
0 commit comments