Skip to content

Commit 7da4a8f

Browse files
committed
cover DisconnectBlock with lock annotation
CoinsTip() access requires cs_main and therefore so should this function.
1 parent 57982f4 commit 7da4a8f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/validation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,6 +1485,7 @@ int ApplyTxInUndo(Coin&& undo, CCoinsViewCache& view, const COutPoint& out)
14851485
* When FAILED is returned, view is left in an indeterminate state. */
14861486
DisconnectResult CChainState::DisconnectBlock(const CBlock& block, const CBlockIndex* pindex, CCoinsViewCache& view)
14871487
{
1488+
AssertLockHeld(::cs_main);
14881489
bool fClean = true;
14891490

14901491
CBlockUndo blockUndo;

src/validation.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,8 @@ class CChainState
718718
bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, BlockValidationState& state, CBlockIndex** ppindex, bool fRequested, const FlatFilePos* dbp, bool* fNewBlock) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
719719

720720
// Block (dis)connection on a given view:
721-
DisconnectResult DisconnectBlock(const CBlock& block, const CBlockIndex* pindex, CCoinsViewCache& view);
721+
DisconnectResult DisconnectBlock(const CBlock& block, const CBlockIndex* pindex, CCoinsViewCache& view)
722+
EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
722723
bool ConnectBlock(const CBlock& block, BlockValidationState& state, CBlockIndex* pindex,
723724
CCoinsViewCache& view, bool fJustCheck = false) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
724725

0 commit comments

Comments
 (0)