Throw a bit more descriptive error message on UpgradeDB failure on pruned nodes (#2962)

This commit is contained in:
UdjinM6 2019-06-08 14:16:41 +03:00 committed by GitHub
parent 2c5e2bc6c8
commit 85c9ea400b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -271,6 +271,10 @@ void CQuorumBlockProcessor::UpgradeDB()
if (chainActive.Height() >= Params().GetConsensus().DIP0003EnforcementHeight) {
auto pindex = chainActive[Params().GetConsensus().DIP0003EnforcementHeight];
while (pindex) {
if (fPruneMode && !(pindex->nStatus & BLOCK_HAVE_DATA)) {
// Too late, we already pruned blocks we needed to reprocess commitments
throw std::runtime_error(std::string(__func__) + ": Quorum Commitments DB upgrade failed, you need to re-download the blockchain");
}
CBlock block;
bool r = ReadBlockFromDisk(block, pindex, Params().GetConsensus());
assert(r);