Gracefully shutdown on evodb inconsistency instead of crashing (#2611)

This commit is contained in:
UdjinM6 2019-01-07 12:58:09 +03:00 committed by GitHub
parent 07dcddb4ca
commit 0acfbf640d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 fDIP0003Active = VersionBitsState(pindex->pprev, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0003, versionbitscache) == THRESHOLD_ACTIVE;
bool fHasBestBlock = evoDb->VerifyBestBlock(pindex->GetBlockHash()); 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 // 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; 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 fDIP0003Active = VersionBitsState(pindex->pprev, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0003, versionbitscache) == THRESHOLD_ACTIVE;
bool fHasBestBlock = evoDb->VerifyBestBlock(pindex->pprev->GetBlockHash()); 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 // 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");
} }
} }