Skip to content

Commit 2f5a466

Browse files
committed
fix: resolve potential deadlock in coinjoin_tests
ScanForWalletTransactions should be called outside of cs_wallet lock scope
1 parent 843a00d commit 2f5a466

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/wallet/test/coinjoin_tests.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,13 @@ class CTransactionBuilderTestSetup : public TestChain100Setup
139139
LOCK2(wallet->cs_wallet, cs_main);
140140
wallet->GetLegacyScriptPubKeyMan()->AddKeyPubKey(coinbaseKey, coinbaseKey.GetPubKey());
141141
wallet->SetLastBlockProcessed(m_node.chainman->ActiveChain().Height(), m_node.chainman->ActiveChain().Tip()->GetBlockHash());
142-
WalletRescanReserver reserver(*wallet);
143-
reserver.reserve();
144-
CWallet::ScanResult result = wallet->ScanForWalletTransactions(m_node.chainman->ActiveChain().Genesis()->GetBlockHash(), 0 /* start_height */, {} /* max_height */, reserver, true /* fUpdate */);
145-
BOOST_CHECK_EQUAL(result.status, CWallet::ScanResult::SUCCESS);
146142
}
143+
WalletRescanReserver reserver(*wallet);
144+
reserver.reserve();
145+
CWallet::ScanResult result = wallet->ScanForWalletTransactions(/*start_block=*/wallet->chain().getBlockHash(0),
146+
/*start_height=*/0, /*max_height=*/{}, reserver,
147+
/*fUpdate=*/true);
148+
BOOST_CHECK_EQUAL(result.status, CWallet::ScanResult::SUCCESS);
147149
}
148150

149151
~CTransactionBuilderTestSetup()

0 commit comments

Comments
 (0)