diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2016-05-25 16:28:12 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2016-05-25 16:28:22 +0200 |
commit | d72098038f3b55a714ed8adb34fab547b15eb0d5 (patch) | |
tree | 1cc4af14da0e218a8a57ef0def9f8ccade55a1d1 | |
parent | c49c825bd9f4764536b45df5a684d97173673fc7 (diff) | |
parent | bd477f4e8ba9e632f42649f2fca10d698c6b7181 (diff) |
Merge #8076: VerifyDB: don't check blocks that have been pruned
bd477f4 VerifyDB: don't check blocks that have been pruned (Suhas Daftuar)
-rw-r--r-- | src/init.cpp | 4 | ||||
-rw-r--r-- | src/main.cpp | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp index f95027410d..a6d14996bd 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1269,8 +1269,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) uiInterface.InitMessage(_("Verifying blocks...")); if (fHavePruned && GetArg("-checkblocks", DEFAULT_CHECKBLOCKS) > MIN_BLOCKS_TO_KEEP) { - LogPrintf("Prune: pruned datadir may not have more than %d blocks; -checkblocks=%d may fail\n", - MIN_BLOCKS_TO_KEEP, GetArg("-checkblocks", DEFAULT_CHECKBLOCKS)); + LogPrintf("Prune: pruned datadir may not have more than %d blocks; only checking available blocks", + MIN_BLOCKS_TO_KEEP); } { diff --git a/src/main.cpp b/src/main.cpp index 9ba90b4ead..33abf39578 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3871,6 +3871,11 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview, uiInterface.ShowProgress(_("Verifying blocks..."), std::max(1, std::min(99, (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100))))); if (pindex->nHeight < chainActive.Height()-nCheckDepth) break; + if (fPruneMode && !(pindex->nStatus & BLOCK_HAVE_DATA)) { + // If pruning, only go back as far as we have data. + LogPrintf("VerifyDB(): block verification stopping at height %d (pruning, no data)\n", pindex->nHeight); + break; + } CBlock block; // check level 0: read from disk if (!ReadBlockFromDisk(block, pindex, chainparams.GetConsensus())) |