aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-07-09 17:42:50 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2014-07-09 18:30:44 +0200
commit5734d4d1e6ee89361fc2484f5d33315397796c0d (patch)
tree1bfa75c6ade88ffff3568123501997ae15249910
parent52a7d52ffb84fb1c7bcdffd8c82e546832498a3b (diff)
Only remove actualy failed blocks from setBlockIndexValid
-rw-r--r--src/main.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index a9c080ffae..913a1702eb 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2073,7 +2073,7 @@ static CBlockIndex* FindMostWorkChain() {
CBlockIndex *pindexTest = pindexNew;
bool fInvalidAncestor = false;
while (pindexTest && !chainActive.Contains(pindexTest)) {
- if (!pindexTest->IsValid(BLOCK_VALID_TRANSACTIONS) || !(pindexTest->nStatus & BLOCK_HAVE_DATA)) {
+ if (pindexTest->nStatus & BLOCK_FAILED_MASK) {
// Candidate has an invalid ancestor, remove entire chain from the set.
if (pindexBestInvalid == NULL || pindexNew->nChainWork > pindexBestInvalid->nChainWork)
pindexBestInvalid = pindexNew;
@@ -2083,6 +2083,7 @@ static CBlockIndex* FindMostWorkChain() {
setBlockIndexValid.erase(pindexFailed);
pindexFailed = pindexFailed->pprev;
}
+ setBlockIndexValid.erase(pindexTest);
fInvalidAncestor = true;
break;
}