Skip to content

Commit 5734d4d

Browse files
committed
Only remove actualy failed blocks from setBlockIndexValid
1 parent 52a7d52 commit 5734d4d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@ static CBlockIndex* FindMostWorkChain() {
20732073
CBlockIndex *pindexTest = pindexNew;
20742074
bool fInvalidAncestor = false;
20752075
while (pindexTest && !chainActive.Contains(pindexTest)) {
2076-
if (!pindexTest->IsValid(BLOCK_VALID_TRANSACTIONS) || !(pindexTest->nStatus & BLOCK_HAVE_DATA)) {
2076+
if (pindexTest->nStatus & BLOCK_FAILED_MASK) {
20772077
// Candidate has an invalid ancestor, remove entire chain from the set.
20782078
if (pindexBestInvalid == NULL || pindexNew->nChainWork > pindexBestInvalid->nChainWork)
20792079
pindexBestInvalid = pindexNew;
@@ -2083,6 +2083,7 @@ static CBlockIndex* FindMostWorkChain() {
20832083
setBlockIndexValid.erase(pindexFailed);
20842084
pindexFailed = pindexFailed->pprev;
20852085
}
2086+
setBlockIndexValid.erase(pindexTest);
20862087
fInvalidAncestor = true;
20872088
break;
20882089
}

0 commit comments

Comments
 (0)