From 0346c26fcacca8abcf67f7320fd441e564aa97d1 Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Wed, 23 Mar 2022 13:50:39 +1000 Subject: [PATCH] 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. --- src/init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init.cpp b/src/init.cpp index de78fdb7b4..f934fd751d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1541,7 +1541,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) // ********************************************************* Step 8: start indexers if (args.GetBoolArg("-txindex", DEFAULT_TXINDEX)) { - if (const auto error{CheckLegacyTxindex(*Assert(chainman.m_blockman.m_block_tree_db))}) { + if (const auto error{WITH_LOCK(cs_main, return CheckLegacyTxindex(*Assert(chainman.m_blockman.m_block_tree_db)))}) { return InitError(*error); }