@@ -28,6 +28,8 @@ RPCHelpMan importmulti();
28
28
RPCHelpMan dumpwallet ();
29
29
RPCHelpMan importwallet ();
30
30
31
+ extern RecursiveMutex cs_wallets;
32
+
31
33
// Ensure that fee levels defined in the wallet are at least as high
32
34
// as the default levels for node policy.
33
35
static_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)
761
763
// deadlock during the sync and simulates a new block notification happening
762
764
// as soon as possible.
763
765
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 ) {
765
767
BOOST_CHECK (rescan_completed);
766
768
m_coinbase_txns.push_back (CreateAndProcessBlock ({}, GetScriptForRawPubKey (coinbaseKey.GetPubKey ())).vtx [0 ]);
767
769
block_tx = TestSimpleSpend (*m_coinbase_txns[2 ], 0 , coinbaseKey, GetScriptForRawPubKey (key.GetPubKey ()));
768
770
m_coinbase_txns.push_back (CreateAndProcessBlock ({block_tx}, GetScriptForRawPubKey (coinbaseKey.GetPubKey ())).vtx [0 ]);
769
771
mempool_tx = TestSimpleSpend (*m_coinbase_txns[3 ], 0 , coinbaseKey, GetScriptForRawPubKey (key.GetPubKey ()));
770
772
BOOST_CHECK (m_node.chain ->broadcastTransaction (MakeTransactionRef (mempool_tx), DEFAULT_TRANSACTION_MAXFEE, false , error));
773
+ LEAVE_CRITICAL_SECTION (cs_wallets);
771
774
LEAVE_CRITICAL_SECTION (wallet->wallet ()->cs_wallet );
772
775
SyncWithValidationInterfaceQueue ();
773
776
ENTER_CRITICAL_SECTION (wallet->wallet ()->cs_wallet );
777
+ ENTER_CRITICAL_SECTION (cs_wallets);
774
778
});
775
779
wallet = TestLoadWallet (*m_node.chain );
776
780
BOOST_CHECK_EQUAL (addtx_count, 4 );
0 commit comments