mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-13 11:35:20 +01:00
Merge 4a76a8300f
into a50af6e4c4
This commit is contained in:
commit
00fca29181
1 changed files with 2 additions and 12 deletions
|
@ -3837,9 +3837,9 @@ void Chainstate::ResetBlockFailureFlags(CBlockIndex *pindex) {
|
|||
|
||||
int nHeight = pindex->nHeight;
|
||||
|
||||
// Remove the invalidity flag from this block and all its descendants.
|
||||
// Remove the invalidity flag from this block and all its descendants and ancestors.
|
||||
for (auto& [_, block_index] : m_blockman.m_block_index) {
|
||||
if (!block_index.IsValid() && block_index.GetAncestor(nHeight) == pindex) {
|
||||
if (!block_index.IsValid() && (block_index.GetAncestor(nHeight) == pindex || pindex->GetAncestor(block_index.nHeight) == &block_index)) {
|
||||
block_index.nStatus &= ~BLOCK_FAILED_MASK;
|
||||
m_blockman.m_dirty_blockindex.insert(&block_index);
|
||||
if (block_index.IsValid(BLOCK_VALID_TRANSACTIONS) && block_index.HaveNumChainTxs() && setBlockIndexCandidates.value_comp()(m_chain.Tip(), &block_index)) {
|
||||
|
@ -3852,16 +3852,6 @@ void Chainstate::ResetBlockFailureFlags(CBlockIndex *pindex) {
|
|||
m_chainman.m_failed_blocks.erase(&block_index);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the invalidity flag from all ancestors too.
|
||||
while (pindex != nullptr) {
|
||||
if (pindex->nStatus & BLOCK_FAILED_MASK) {
|
||||
pindex->nStatus &= ~BLOCK_FAILED_MASK;
|
||||
m_blockman.m_dirty_blockindex.insert(pindex);
|
||||
m_chainman.m_failed_blocks.erase(pindex);
|
||||
}
|
||||
pindex = pindex->pprev;
|
||||
}
|
||||
}
|
||||
|
||||
void Chainstate::TryAddBlockIndexCandidate(CBlockIndex* pindex)
|
||||
|
|
Loading…
Add table
Reference in a new issue