Skip to content

Commit

Permalink
Add static locking analysis keywords
Browse files Browse the repository at this point in the history
to CheckBlock and WriteBlockToDisk.
  • Loading branch information
jamescowens committed Sep 17, 2023
1 parent 15df6c9 commit 9c10ede
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/node/blockstorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@

bool WriteBlockToDisk(const CBlock& block, unsigned int& nFileRet, unsigned int& nBlockPosRet,
const CMessageHeader::MessageStartChars& messageStart)
EXCLUSIVE_LOCKS_REQUIRED(cs_main)
{
AssertLockHeld(cs_main);

// Open history file to append
CAutoFile fileout(AppendBlockFile(nFileRet), SER_DISK, CLIENT_VERSION);
if (fileout.IsNull())
Expand Down
3 changes: 3 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,10 @@ bool AddToBlockIndex(CBlock& block, unsigned int nFile, unsigned int nBlockPos,
}

bool CheckBlock(const CBlock& block, int height1, bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig, bool fLoadingIndex)
EXCLUSIVE_LOCKS_REQUIRED(cs_main)
{
AssertLockHeld(cs_main);

// Allow the genesis block to pass.
if(block.hashPrevBlock.IsNull() &&
block.GetHash(true) == (fTestNet ? hashGenesisBlockTestNet : hashGenesisBlock))
Expand Down

0 comments on commit 9c10ede

Please sign in to comment.