From 0acfbf640d684d31f4b6197f860d9aff0bdf0c99 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 7 Jan 2019 12:58:09 +0300 Subject: [PATCH] Gracefully shutdown on evodb inconsistency instead of crashing (#2611) --- src/validation.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/validation.cpp b/src/validation.cpp index f553d6a2e..d78ed1a0e 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1616,9 +1616,9 @@ static DisconnectResult DisconnectBlock(const CBlock& block, CValidationState& s bool fDIP0003Active = VersionBitsState(pindex->pprev, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0003, versionbitscache) == THRESHOLD_ACTIVE; bool fHasBestBlock = evoDb->VerifyBestBlock(pindex->GetBlockHash()); - if (fDIP0003Active) { + if (fDIP0003Active && !fHasBestBlock) { // Nodes that upgraded after DIP3 activation will have to reindex to ensure evodb consistency - assert(fHasBestBlock); + AbortNode("Found EvoDB inconsistency, you must reindex to continue"); } bool fClean = true; @@ -1904,9 +1904,9 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd bool fDIP0003Active = VersionBitsState(pindex->pprev, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0003, versionbitscache) == THRESHOLD_ACTIVE; bool fHasBestBlock = evoDb->VerifyBestBlock(pindex->pprev->GetBlockHash()); - if (fDIP0003Active) { + if (fDIP0003Active && !fHasBestBlock) { // Nodes that upgraded after DIP3 activation will have to reindex to ensure evodb consistency - assert(fHasBestBlock); + AbortNode("Found EvoDB inconsistency, you must reindex to continue"); } }