fix: add missing lock annotation for ContextualCheckBlock and related TODO

This commit is contained in:
Konstantin Akimov 2024-10-07 01:09:14 +07:00
parent 846ebab6e0
commit 6d452845dc
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524

View File

@ -3644,9 +3644,10 @@ static bool ContextualCheckBlockHeader(const CBlockHeader& block, BlockValidatio
* in ConnectBlock(). * in ConnectBlock().
* Note that -reindex-chainstate skips the validation that happens here! * Note that -reindex-chainstate skips the validation that happens here!
*/ */
static bool ContextualCheckBlock(const CBlock& block, BlockValidationState& state, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev) static bool ContextualCheckBlock(const CBlock& block, BlockValidationState& state, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev) EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
{ {
AssertLockHeld(cs_main); // TODO: validate - why do we need this cs_main ?
AssertLockHeld(::cs_main);
const int nHeight = pindexPrev == nullptr ? 0 : pindexPrev->nHeight + 1; const int nHeight = pindexPrev == nullptr ? 0 : pindexPrev->nHeight + 1;
// Enforce BIP113 (Median Time Past). // Enforce BIP113 (Median Time Past).