From 00899053612d389b34470be832bc0cb73d545a33 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 10 Oct 2018 11:28:43 +0200 Subject: [PATCH] Add compile time checking for cs_main locks which we assert at run time --- src/index/base.cpp | 2 +- src/validation.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index/base.cpp b/src/index/base.cpp index 788f7adcc..42c6b0373 100644 --- a/src/index/base.cpp +++ b/src/index/base.cpp @@ -65,7 +65,7 @@ bool BaseIndex::Init() return true; } -static const CBlockIndex* NextSyncBlock(const CBlockIndex* pindex_prev) +static const CBlockIndex* NextSyncBlock(const CBlockIndex* pindex_prev) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { AssertLockHeld(cs_main); diff --git a/src/validation.h b/src/validation.h index 1034ba466..dbd827633 100644 --- a/src/validation.h +++ b/src/validation.h @@ -257,7 +257,7 @@ bool LoadGenesisBlock(const CChainParams& chainparams); * initializing state if we're running with -reindex. */ bool LoadBlockIndex(const CChainParams& chainparams) EXCLUSIVE_LOCKS_REQUIRED(cs_main); /** Update the chain tip based on database information. */ -bool LoadChainTip(const CChainParams& chainparams); +bool LoadChainTip(const CChainParams& chainparams) EXCLUSIVE_LOCKS_REQUIRED(cs_main); /** Unload database information */ void UnloadBlockIndex(); /** Run an instance of the script checking thread */ @@ -436,7 +436,7 @@ inline CBlockIndex* LookupBlockIndex(const uint256& hash) } /** Find the last common block between the parameter chain and a locator. */ -CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator); +CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator) EXCLUSIVE_LOCKS_REQUIRED(cs_main); /** Mark a block as precious and reorganize. *