Skip to content

Commit 62d50ef

Browse files
Add LOCKS_EXCLUDED(cs_main) to LimitValidationInterfaceQueue(...) which does AssertLockNotHeld(cs_main)
Add LOCKS_EXCLUDED(cs_main) to functions calling LimitValidationInterfaceQueue(...) which does AssertLockNotHeld(cs_main) Add LOCKS_EXCLUDED(cs_main) to functions calling CChainState::InvalidateBlock(...) which calls LimitValidationInterfaceQueue(...) which in turn does AssertLockNotHeld(cs_main) Add LOCKS_EXCLUDED(cs_main) to functions calling CChainState::RewindBlockIndex(...) which calls LimitValidationInterfaceQueue(...) which in turn does AssertLockNotHeld(cs_main)
1 parent 3632143 commit 62d50ef

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/validation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class CChainState {
164164

165165
bool LoadBlockIndex(const Consensus::Params& consensus_params, CBlockTreeDB& blocktree) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
166166

167-
bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, std::shared_ptr<const CBlock> pblock);
167+
bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, std::shared_ptr<const CBlock> pblock) LOCKS_EXCLUDED(cs_main);
168168

169169
/**
170170
* If a block header hasn't already been seen, call CheckBlockHeader on it, ensure
@@ -183,11 +183,11 @@ class CChainState {
183183

184184
// Manual block validity manipulation:
185185
bool PreciousBlock(CValidationState& state, const CChainParams& params, CBlockIndex* pindex) LOCKS_EXCLUDED(cs_main);
186-
bool InvalidateBlock(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindex);
186+
bool InvalidateBlock(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindex) LOCKS_EXCLUDED(cs_main);
187187
void ResetBlockFailureFlags(CBlockIndex* pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
188188

189189
bool ReplayBlocks(const CChainParams& params, CCoinsView* view);
190-
bool RewindBlockIndex(const CChainParams& params);
190+
bool RewindBlockIndex(const CChainParams& params) LOCKS_EXCLUDED(cs_main);
191191
bool LoadGenesisBlock(const CChainParams& chainparams);
192192

193193
void PruneBlockIndexCandidates();
@@ -2648,7 +2648,7 @@ static void NotifyHeaderTip() LOCKS_EXCLUDED(cs_main) {
26482648
}
26492649
}
26502650

2651-
static void LimitValidationInterfaceQueue() {
2651+
static void LimitValidationInterfaceQueue() LOCKS_EXCLUDED(cs_main) {
26522652
AssertLockNotHeld(cs_main);
26532653

26542654
if (GetMainSignals().CallbacksPending() > 10) {

src/validation.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ bool IsWitnessEnabled(const CBlockIndex* pindexPrev, const Consensus::Params& pa
393393
bool IsNullDummyEnabled(const CBlockIndex* pindexPrev, const Consensus::Params& params);
394394

395395
/** When there are blocks in the active chain with missing data, rewind the chainstate and remove them from the block index */
396-
bool RewindBlockIndex(const CChainParams& params);
396+
bool RewindBlockIndex(const CChainParams& params) LOCKS_EXCLUDED(cs_main);
397397

398398
/** Update uncommitted block structures (currently: only the witness reserved value). This is safe for submitted blocks. */
399399
void UpdateUncommittedBlockStructures(CBlock& block, const CBlockIndex* pindexPrev, const Consensus::Params& consensusParams);
@@ -430,7 +430,7 @@ CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& loc
430430
bool PreciousBlock(CValidationState& state, const CChainParams& params, CBlockIndex *pindex) LOCKS_EXCLUDED(cs_main);
431431

432432
/** Mark a block as invalid. */
433-
bool InvalidateBlock(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindex);
433+
bool InvalidateBlock(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindex) LOCKS_EXCLUDED(cs_main);
434434

435435
/** Remove invalidity status from a block and its descendants. */
436436
void ResetBlockFailureFlags(CBlockIndex* pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main);

0 commit comments

Comments
 (0)