Skip to content

Commit ca47b00

Browse files
vasildjonatack
authored andcommitted
Require CBlockIndex::IsValid() to hold cs_main
1 parent e9f3aa5 commit ca47b00

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/chain.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,9 @@ class CBlockIndex
311311

312312
//! Check whether this block index entry is valid up to the passed validity level.
313313
bool IsValid(enum BlockStatus nUpTo = BLOCK_VALID_TRANSACTIONS) const
314+
EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
314315
{
316+
AssertLockHeld(::cs_main);
315317
assert(!(nUpTo & ~BLOCK_VALID_MASK)); // Only validity flags allowed.
316318
if (nStatus & BLOCK_FAILED_MASK)
317319
return false;

0 commit comments

Comments
 (0)