Add compile time checking for cs_main locks which we assert at run time

This commit is contained in:
practicalswift 2018-10-10 11:28:43 +02:00
parent be992701b0
commit 0089905361
2 changed files with 3 additions and 3 deletions

View file

@ -65,7 +65,7 @@ bool BaseIndex::Init()
return true; 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); AssertLockHeld(cs_main);

View file

@ -257,7 +257,7 @@ bool LoadGenesisBlock(const CChainParams& chainparams);
* initializing state if we're running with -reindex. */ * initializing state if we're running with -reindex. */
bool LoadBlockIndex(const CChainParams& chainparams) EXCLUSIVE_LOCKS_REQUIRED(cs_main); bool LoadBlockIndex(const CChainParams& chainparams) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
/** Update the chain tip based on database information. */ /** 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 */ /** Unload database information */
void UnloadBlockIndex(); void UnloadBlockIndex();
/** Run an instance of the script checking thread */ /** 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. */ /** 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. /** Mark a block as precious and reorganize.
* *