Skip to content

Commit 0089905

Browse files
Add compile time checking for cs_main locks which we assert at run time
1 parent be99270 commit 0089905

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/index/base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ bool BaseIndex::Init()
6565
return true;
6666
}
6767

68-
static const CBlockIndex* NextSyncBlock(const CBlockIndex* pindex_prev)
68+
static const CBlockIndex* NextSyncBlock(const CBlockIndex* pindex_prev) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
6969
{
7070
AssertLockHeld(cs_main);
7171

src/validation.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ bool LoadGenesisBlock(const CChainParams& chainparams);
257257
* initializing state if we're running with -reindex. */
258258
bool LoadBlockIndex(const CChainParams& chainparams) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
259259
/** Update the chain tip based on database information. */
260-
bool LoadChainTip(const CChainParams& chainparams);
260+
bool LoadChainTip(const CChainParams& chainparams) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
261261
/** Unload database information */
262262
void UnloadBlockIndex();
263263
/** Run an instance of the script checking thread */
@@ -436,7 +436,7 @@ inline CBlockIndex* LookupBlockIndex(const uint256& hash)
436436
}
437437

438438
/** Find the last common block between the parameter chain and a locator. */
439-
CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator);
439+
CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
440440

441441
/** Mark a block as precious and reorganize.
442442
*

0 commit comments

Comments
 (0)