Skip to content

Commit dca9ab4

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#23661: cover DisconnectBlock with lock annotation
7da4a8f cover DisconnectBlock with lock annotation (James O'Beirne) Pull request description: While reviewing #23630, I noticed that `DisconnectBlock` is uncovered by lock annotations. CoinsTip() access requires cs_main and therefore so should this function. ACKs for top commit: jonatack: ACK 7da4a8f Tree-SHA512: 3e2b0247c138b31deeadcd48eb3f7bc8d32c0b6bb6d6e94ccf8ea0cbbc50b1b35d83f662eee432f2bd2d87a3fe9c94604da806ec711df93298bfb0ab34a5a05b
2 parents 8b2c0df + 7da4a8f commit dca9ab4

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)