Skip to content

Commit a9d28bc

Browse files
committed
validation: Use *this in CChainState::ActivateBestChainStep
1 parent 4744efc commit a9d28bc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/validation.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2725,6 +2725,7 @@ bool CChainState::ActivateBestChainStep(BlockValidationState& state, const CChai
27252725
{
27262726
AssertLockHeld(cs_main);
27272727
AssertLockHeld(m_mempool.cs);
2728+
assert(std::addressof(::ChainstateActive()) == std::addressof(*this));
27282729

27292730
const CBlockIndex* pindexOldTip = m_chain.Tip();
27302731
const CBlockIndex* pindexFork = m_chain.FindFork(pindexMostWork);
@@ -2736,7 +2737,7 @@ bool CChainState::ActivateBestChainStep(BlockValidationState& state, const CChai
27362737
if (!DisconnectTip(state, chainparams, &disconnectpool)) {
27372738
// This is likely a fatal error, but keep the mempool consistent,
27382739
// just in case. Only remove from the mempool in this case.
2739-
UpdateMempoolForReorg(::ChainstateActive(), m_mempool, disconnectpool, false);
2740+
UpdateMempoolForReorg(*this, m_mempool, disconnectpool, false);
27402741

27412742
// If we're unable to disconnect a block during normal operation,
27422743
// then that is a failure of our local system -- we should abort
@@ -2780,7 +2781,7 @@ bool CChainState::ActivateBestChainStep(BlockValidationState& state, const CChai
27802781
// A system error occurred (disk space, database error, ...).
27812782
// Make the mempool consistent with the current tip, just in case
27822783
// any observers try to use it before shutdown.
2783-
UpdateMempoolForReorg(::ChainstateActive(), m_mempool, disconnectpool, false);
2784+
UpdateMempoolForReorg(*this, m_mempool, disconnectpool, false);
27842785
return false;
27852786
}
27862787
} else {
@@ -2797,7 +2798,7 @@ bool CChainState::ActivateBestChainStep(BlockValidationState& state, const CChai
27972798
if (fBlocksDisconnected) {
27982799
// If any blocks were disconnected, disconnectpool may be non empty. Add
27992800
// any disconnected transactions back to the mempool.
2800-
UpdateMempoolForReorg(::ChainstateActive(), m_mempool, disconnectpool, true);
2801+
UpdateMempoolForReorg(*this, m_mempool, disconnectpool, true);
28012802
}
28022803
m_mempool.check(*this);
28032804

0 commit comments

Comments
 (0)