Skip to content

Commit

Permalink
Add compile time checking for cs_main locks which we assert at run time
Browse files Browse the repository at this point in the history
  • Loading branch information
practicalswift committed Oct 10, 2018
1 parent be99270 commit 0089905
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit 0089905

Please sign in to comment.