Require IsBlockPruned() to hold mutex cs_main

Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
This commit is contained in:
Jon Atack 2022-01-18 12:51:03 +01:00
parent ca47b00577
commit eaeeb88768
No known key found for this signature in database
GPG key ID: 796C4109063D4EAF
3 changed files with 7 additions and 4 deletions

View file

@ -429,6 +429,7 @@ CBlockIndex* BlockManager::GetLastCheckpoint(const CCheckpointData& data)
bool IsBlockPruned(const CBlockIndex* pblockindex)
{
AssertLockHeld(::cs_main);
return (fHavePruned && !(pblockindex->nStatus & BLOCK_HAVE_DATA) && pblockindex->nTx > 0);
}