Require CBlockIndex::RaiseValidity() to hold cs_main

This commit is contained in:
Vasil Dimov 2022-01-19 14:03:37 +01:00 committed by Jon Atack
parent 8ef457cb83
commit e9f3aa5f6a
No known key found for this signature in database
GPG Key ID: 796C4109063D4EAF
2 changed files with 3 additions and 2 deletions

View File

@ -328,8 +328,9 @@ public:
//! Raise the validity level of this block index entry.
//! Returns true if the validity was changed.
bool RaiseValidity(enum BlockStatus nUpTo)
bool RaiseValidity(enum BlockStatus nUpTo) EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
{
AssertLockHeld(::cs_main);
assert(!(nUpTo & ~BLOCK_VALID_MASK)); // Only validity flags allowed.
if (nStatus & BLOCK_FAILED_MASK) return false;

View File

@ -58,7 +58,7 @@ FUZZ_TARGET(chain)
if (block_status & ~BLOCK_VALID_MASK) {
continue;
}
(void)disk_block_index->RaiseValidity(block_status);
WITH_LOCK(::cs_main, (void)disk_block_index->RaiseValidity(block_status));
}
CBlockIndex block_index{block_header};