mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-09 22:28:51 +02:00
validation: remove redundant marking in FindMostWorkChain
since ed764ea, all descendants in m_block_index are required to be
marked BLOCK_FAILED_VALID when an invalid block is encountered,
as enforced by a CheckBlockIndex assert.
remove the now-redundant marking in FindMostWorkChain's inner loop,
so it is only responsible for cleaning up setBlockIndexCandidates,
not for modifying block validity state
This commit is contained in:
@@ -3142,13 +3142,10 @@ CBlockIndex* Chainstate::FindMostWorkChain()
|
||||
CBlockIndex *pindexFailed = pindexNew;
|
||||
// Remove the entire chain from the set.
|
||||
while (pindexTest != pindexFailed) {
|
||||
if (fFailedChain) {
|
||||
pindexFailed->nStatus |= BLOCK_FAILED_VALID;
|
||||
m_blockman.m_dirty_blockindex.insert(pindexFailed);
|
||||
} else if (fMissingData) {
|
||||
// If we're missing data, then add back to m_blocks_unlinked,
|
||||
// so that if the block arrives in the future we can try adding
|
||||
// to setBlockIndexCandidates again.
|
||||
if (fMissingData && !fFailedChain) {
|
||||
// If we're missing data and not a descendant of an invalid block,
|
||||
// then add back to m_blocks_unlinked, so that if the block arrives in the future
|
||||
// we can try adding to setBlockIndexCandidates again.
|
||||
m_blockman.m_blocks_unlinked.insert(
|
||||
std::make_pair(pindexFailed->pprev, pindexFailed));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user