aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2022-03-23 13:50:39 +1000
committerAnthony Towns <aj@erisian.com.au>2022-03-26 00:04:07 +1000
commit0346c26fcacca8abcf67f7320fd441e564aa97d1 (patch)
tree845a6e103cfd01638d442eaf7a90b80da9c726c2 /src/init.cpp
parent7c08d81e119570792648fe95bbacddbb1d5f9ae2 (diff)
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.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp2
1 files changed, 1 insertions, 1 deletions
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);
}