Skip to content

Commit 7eb0d75

Browse files
sdaftuarsipa
authored andcommitted
VerifyDB: don't check blocks that have been pruned
1 parent 036fa47 commit 7eb0d75

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,8 +1292,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
12921292

12931293
uiInterface.InitMessage(_("Verifying blocks..."));
12941294
if (fHavePruned && GetArg("-checkblocks", DEFAULT_CHECKBLOCKS) > MIN_BLOCKS_TO_KEEP) {
1295-
LogPrintf("Prune: pruned datadir may not have more than %d blocks; -checkblocks=%d may fail\n",
1296-
MIN_BLOCKS_TO_KEEP, GetArg("-checkblocks", DEFAULT_CHECKBLOCKS));
1295+
LogPrintf("Prune: pruned datadir may not have more than %d blocks; only checking available blocks",
1296+
MIN_BLOCKS_TO_KEEP);
12971297
}
12981298

12991299
{

src/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4008,6 +4008,11 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview,
40084008
uiInterface.ShowProgress(_("Verifying blocks..."), std::max(1, std::min(99, (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100)))));
40094009
if (pindex->nHeight < chainActive.Height()-nCheckDepth)
40104010
break;
4011+
if (fPruneMode && !(pindex->nStatus & BLOCK_HAVE_DATA)) {
4012+
// If pruning, only go back as far as we have data.
4013+
LogPrintf("VerifyDB(): block verification stopping at height %d (pruning, no data)\n", pindex->nHeight);
4014+
break;
4015+
}
40114016
CBlock block;
40124017
// check level 0: read from disk
40134018
if (!ReadBlockFromDisk(block, pindex, chainparams.GetConsensus()))

0 commit comments

Comments
 (0)