diff options
author | Jon Atack <jon@atack.com> | 2021-10-21 16:56:34 +0200 |
---|---|---|
committer | Jon Atack <jon@atack.com> | 2022-01-25 20:43:19 +0100 |
commit | 2e557ced2830fc54476e598d52225f1679205e7d (patch) | |
tree | 04880e45f0d5fd0fc3d1c27a7758ed969749ac97 /src/node/blockstorage.cpp | |
parent | 6fd4341c10b319399c58d71c4ddeae4417e337d7 (diff) |
Require WriteUndoDataForBlock() to hold mutex cs_main
Mutex cs_main is already held by the caller of WriteUndoDataForBlock().
This change is needed to require CBlockIndex::GetUndoPos() to hold
cs_main and CBlockIndex::nStatus to be guarded by cs_main in the
following commits without adding 2 unnecessary cs_main locks to
WriteUndoDataForBlock().
Diffstat (limited to 'src/node/blockstorage.cpp')
-rw-r--r-- | src/node/blockstorage.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp index cbfdcb6f11..526100f1b2 100644 --- a/src/node/blockstorage.cpp +++ b/src/node/blockstorage.cpp @@ -712,6 +712,7 @@ static bool WriteBlockToDisk(const CBlock& block, FlatFilePos& pos, const CMessa bool BlockManager::WriteUndoDataForBlock(const CBlockUndo& blockundo, BlockValidationState& state, CBlockIndex* pindex, const CChainParams& chainparams) { + AssertLockHeld(::cs_main); // Write undo information to disk if (pindex->GetUndoPos().IsNull()) { FlatFilePos _pos; |