aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-11-23 19:44:38 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-12-15 17:46:08 +0100
commitfacd2137eceacb95e1f71c87ddc704d752b37272 (patch)
tree9355a2be1f024fa316d654e452369acf29a15ae9 /src/validation.cpp
parentfa47b5c100f81c65c15b5a6afaf6c91bc0861264 (diff)
downloadbitcoin-facd2137eceacb95e1f71c87ddc704d752b37272.tar.xz
Move m_failed_blocks to ChainstateManager
The member is unrelated to block storage (BlockManager). It is related to validation. Fix the confusion by moving it. Can be reviewed with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 60c01ad7b6..ba6b9e853a 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -1291,7 +1291,7 @@ void CChainState::InvalidBlockFound(CBlockIndex* pindex, const BlockValidationSt
{
if (state.GetResult() != BlockValidationResult::BLOCK_MUTATED) {
pindex->nStatus |= BLOCK_FAILED_VALID;
- m_blockman.m_failed_blocks.insert(pindex);
+ m_chainman.m_failed_blocks.insert(pindex);
setDirtyBlockIndex.insert(pindex);
setBlockIndexCandidates.erase(pindex);
InvalidChainFound(pindex);
@@ -2844,7 +2844,7 @@ bool CChainState::InvalidateBlock(BlockValidationState& state, CBlockIndex* pind
to_mark_failed->nStatus |= BLOCK_FAILED_VALID;
setDirtyBlockIndex.insert(to_mark_failed);
setBlockIndexCandidates.erase(to_mark_failed);
- m_blockman.m_failed_blocks.insert(to_mark_failed);
+ m_chainman.m_failed_blocks.insert(to_mark_failed);
// If any new blocks somehow arrived while we were disconnecting
// (above), then the pre-calculation of what should go into
@@ -2889,7 +2889,7 @@ void CChainState::ResetBlockFailureFlags(CBlockIndex *pindex) {
// Reset invalid block marker if it was pointing to one of those.
pindexBestInvalid = nullptr;
}
- m_blockman.m_failed_blocks.erase(it->second);
+ m_chainman.m_failed_blocks.erase(it->second);
}
it++;
}
@@ -2899,7 +2899,7 @@ void CChainState::ResetBlockFailureFlags(CBlockIndex *pindex) {
if (pindex->nStatus & BLOCK_FAILED_MASK) {
pindex->nStatus &= ~BLOCK_FAILED_MASK;
setDirtyBlockIndex.insert(pindex);
- m_blockman.m_failed_blocks.erase(pindex);
+ m_chainman.m_failed_blocks.erase(pindex);
}
pindex = pindex->pprev;
}
@@ -3325,7 +3325,7 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida
// hasn't been validated up to BLOCK_VALID_SCRIPTS. This is a performance
// optimization, in the common case of adding a new block to the tip,
// we don't need to iterate over the failed blocks list.
- for (const CBlockIndex* failedit : m_blockman.m_failed_blocks) {
+ for (const CBlockIndex* failedit : m_failed_blocks) {
if (pindexPrev->GetAncestor(failedit->nHeight) == failedit) {
assert(failedit->nStatus & BLOCK_FAILED_VALID);
CBlockIndex* invalid_walk = pindexPrev;
@@ -3804,7 +3804,6 @@ bool BlockManager::LoadBlockIndex(
}
void BlockManager::Unload() {
- m_failed_blocks.clear();
m_blocks_unlinked.clear();
for (const BlockMap::value_type& entry : m_block_index) {
@@ -5119,6 +5118,7 @@ void ChainstateManager::Unload()
chainstate->UnloadBlockIndex();
}
+ m_failed_blocks.clear();
m_blockman.Unload();
}