@@ -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);
@@ -3810,7 +3809,6 @@ bool Chainstate::InvalidateBlock(BlockValidationState& state, CBlockIndex* pinde
3810
3809
pindex->nStatus |= BLOCK_FAILED_VALID;
3811
3810
m_blockman.m_dirty_blockindex .insert (pindex);
3812
3811
setBlockIndexCandidates.erase (pindex);
3813
- m_chainman.m_failed_blocks .insert (pindex);
3814
3812
}
3815
3813
3816
3814
// If any new blocks somehow arrived while we were disconnecting
@@ -3878,7 +3876,6 @@ void Chainstate::ResetBlockFailureFlags(CBlockIndex *pindex) {
3878
3876
// Reset invalid block marker if it was pointing to one of those.
3879
3877
m_chainman.m_best_invalid = nullptr ;
3880
3878
}
3881
- m_chainman.m_failed_blocks .erase (&block_index);
3882
3879
}
3883
3880
}
3884
3881
@@ -3887,7 +3884,6 @@ void Chainstate::ResetBlockFailureFlags(CBlockIndex *pindex) {
3887
3884
if (pindex->nStatus & BLOCK_FAILED_MASK) {
3888
3885
pindex->nStatus &= ~BLOCK_FAILED_MASK;
3889
3886
m_blockman.m_dirty_blockindex .insert (pindex);
3890
- m_chainman.m_failed_blocks .erase (pindex);
3891
3887
}
3892
3888
pindex = pindex->pprev ;
3893
3889
}
@@ -4383,45 +4379,6 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida
4383
4379
LogDebug (BCLog::VALIDATION, " %s: Consensus::ContextualCheckBlockHeader: %s, %s\n " , __func__, hash.ToString (), state.ToString ());
4384
4380
return false ;
4385
4381
}
4386
-
4387
- /* Determine if this block descends from any block which has been found
4388
- * invalid (m_failed_blocks), then mark pindexPrev and any blocks between
4389
- * them as failed. For example:
4390
- *
4391
- * D3
4392
- * /
4393
- * B2 - C2
4394
- * / \
4395
- * A D2 - E2 - F2
4396
- * \
4397
- * B1 - C1 - D1 - E1
4398
- *
4399
- * In the case that we attempted to reorg from E1 to F2, only to find
4400
- * C2 to be invalid, we would mark D2, E2, and F2 as BLOCK_FAILED_CHILD
4401
- * but NOT D3 (it was not in any of our candidate sets at the time).
4402
- *
4403
- * In any case D3 will also be marked as BLOCK_FAILED_CHILD at restart
4404
- * in LoadBlockIndex.
4405
- */
4406
- if (!pindexPrev->IsValid (BLOCK_VALID_SCRIPTS)) {
4407
- // The above does not mean "invalid": it checks if the previous block
4408
- // hasn't been validated up to BLOCK_VALID_SCRIPTS. This is a performance
4409
- // optimization, in the common case of adding a new block to the tip,
4410
- // we don't need to iterate over the failed blocks list.
4411
- for (const CBlockIndex* failedit : m_failed_blocks) {
4412
- if (pindexPrev->GetAncestor (failedit->nHeight ) == failedit) {
4413
- assert (failedit->nStatus & BLOCK_FAILED_VALID);
4414
- CBlockIndex* invalid_walk = pindexPrev;
4415
- while (invalid_walk != failedit) {
4416
- invalid_walk->nStatus |= BLOCK_FAILED_CHILD;
4417
- m_blockman.m_dirty_blockindex .insert (invalid_walk);
4418
- invalid_walk = invalid_walk->pprev ;
4419
- }
4420
- LogDebug (BCLog::VALIDATION, " header %s has prev block invalid: %s\n " , hash.ToString (), block.hashPrevBlock .ToString ());
4421
- return state.Invalid (BlockValidationResult::BLOCK_INVALID_PREV, " bad-prevblk" );
4422
- }
4423
- }
4424
- }
4425
4382
}
4426
4383
if (!min_pow_checked) {
4427
4384
LogDebug (BCLog::VALIDATION, " %s: not adding new block header %s, missing anti-dos proof-of-work validation\n " , __func__, hash.ToString ());
0 commit comments