Skip to content

Commit 0346c26

Browse files
committed
init: add missing cs_main lock
BlockManager::m_block_tree_db is protected by cs_main, so take the cs_main lock while accessing it.
1 parent 7c08d81 commit 0346c26

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
15411541

15421542
// ********************************************************* Step 8: start indexers
15431543
if (args.GetBoolArg("-txindex", DEFAULT_TXINDEX)) {
1544-
if (const auto error{CheckLegacyTxindex(*Assert(chainman.m_blockman.m_block_tree_db))}) {
1544+
if (const auto error{WITH_LOCK(cs_main, return CheckLegacyTxindex(*Assert(chainman.m_blockman.m_block_tree_db)))}) {
15451545
return InitError(*error);
15461546
}
15471547

0 commit comments

Comments
 (0)