@@ -2091,7 +2091,6 @@ void Chainstate::InvalidBlockFound(CBlockIndex* pindex, const BlockValidationSta
2091
2091
AssertLockHeld (cs_main);
2092
2092
if (state.GetResult () != BlockValidationResult::BLOCK_MUTATED) {
2093
2093
pindex->nStatus |= BLOCK_FAILED_VALID;
2094
- m_chainman.m_failed_blocks .insert (pindex);
2095
2094
m_blockman.m_dirty_blockindex .insert (pindex);
2096
2095
setBlockIndexCandidates.erase (pindex);
2097
2096
InvalidChainFound (pindex);
@@ -3821,7 +3820,6 @@ bool Chainstate::InvalidateBlock(BlockValidationState& state, CBlockIndex* pinde
3821
3820
auto not_inserted_yet = m_blockman.m_dirty_blockindex .insert (to_mark_failed);
3822
3821
assert (!not_inserted_yet.second );
3823
3822
setBlockIndexCandidates.erase (to_mark_failed);
3824
- m_chainman.m_failed_blocks .insert (to_mark_failed);
3825
3823
3826
3824
// If any new blocks somehow arrived while we were disconnecting
3827
3825
// (above), then the pre-calculation of what should go into
@@ -3888,7 +3886,6 @@ void Chainstate::ResetBlockFailureFlags(CBlockIndex *pindex) {
3888
3886
// Reset invalid block marker if it was pointing to one of those.
3889
3887
m_chainman.m_best_invalid = nullptr ;
3890
3888
}
3891
- m_chainman.m_failed_blocks .erase (&block_index);
3892
3889
}
3893
3890
}
3894
3891
}
@@ -4391,45 +4388,6 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida
4391
4388
LogDebug (BCLog::VALIDATION, " %s: Consensus::ContextualCheckBlockHeader: %s, %s\n " , __func__, hash.ToString (), state.ToString ());
4392
4389
return false ;
4393
4390
}
4394
-
4395
- /* Determine if this block descends from any block which has been found
4396
- * invalid (m_failed_blocks), then mark pindexPrev and any blocks between
4397
- * them as failed. For example:
4398
- *
4399
- * D3
4400
- * /
4401
- * B2 - C2
4402
- * / \
4403
- * A D2 - E2 - F2
4404
- * \
4405
- * B1 - C1 - D1 - E1
4406
- *
4407
- * In the case that we attempted to reorg from E1 to F2, only to find
4408
- * C2 to be invalid, we would mark D2, E2, and F2 as BLOCK_FAILED_CHILD
4409
- * but NOT D3 (it was not in any of our candidate sets at the time).
4410
- *
4411
- * In any case D3 will also be marked as BLOCK_FAILED_CHILD at restart
4412
- * in LoadBlockIndex.
4413
- */
4414
- if (!pindexPrev->IsValid (BLOCK_VALID_SCRIPTS)) {
4415
- // The above does not mean "invalid": it checks if the previous block
4416
- // hasn't been validated up to BLOCK_VALID_SCRIPTS. This is a performance
4417
- // optimization, in the common case of adding a new block to the tip,
4418
- // we don't need to iterate over the failed blocks list.
4419
- for (const CBlockIndex* failedit : m_failed_blocks) {
4420
- if (pindexPrev->GetAncestor (failedit->nHeight ) == failedit) {
4421
- assert (failedit->nStatus & BLOCK_FAILED_VALID);
4422
- CBlockIndex* invalid_walk = pindexPrev;
4423
- while (invalid_walk != failedit) {
4424
- invalid_walk->nStatus |= BLOCK_FAILED_CHILD;
4425
- m_blockman.m_dirty_blockindex .insert (invalid_walk);
4426
- invalid_walk = invalid_walk->pprev ;
4427
- }
4428
- LogDebug (BCLog::VALIDATION, " header %s has prev block invalid: %s\n " , hash.ToString (), block.hashPrevBlock .ToString ());
4429
- return state.Invalid (BlockValidationResult::BLOCK_INVALID_PREV, " bad-prevblk" );
4430
- }
4431
- }
4432
- }
4433
4391
}
4434
4392
if (!min_pow_checked) {
4435
4393
LogDebug (BCLog::VALIDATION, " %s: not adding new block header %s, missing anti-dos proof-of-work validation\n " , __func__, hash.ToString ());
0 commit comments