Skip to content

Commit e58985c

Browse files
committed
Log progress while verifying blocks at level 4.
When verifying blocks at startup, the progress is printed in 10% increments to logs. When -checklevel=4, however, the second half of the verification (connecting the blocks again) does not log the progress anymore. (It is still computed and shown in the UI, but not printed to logs.) This change makes the behaviour consistent, by adding the missing progress logging also for level-4 checks.
1 parent 9d86aad commit e58985c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/validation.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3990,7 +3990,7 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview,
39903990
LogPrintf("[0%%]..."); /* Continued */
39913991
for (pindex = chainActive.Tip(); pindex && pindex->pprev; pindex = pindex->pprev) {
39923992
boost::this_thread::interruption_point();
3993-
int percentageDone = std::max(1, std::min(99, (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100))));
3993+
const int percentageDone = std::max(1, std::min(99, (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100))));
39943994
if (reportDone < percentageDone/10) {
39953995
// report every 10% step
39963996
LogPrintf("[%d%%]...", percentageDone); /* Continued */
@@ -4048,7 +4048,13 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview,
40484048
if (nCheckLevel >= 4) {
40494049
while (pindex != chainActive.Tip()) {
40504050
boost::this_thread::interruption_point();
4051-
uiInterface.ShowProgress(_("Verifying blocks..."), std::max(1, std::min(99, 100 - (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * 50))), false);
4051+
const int percentageDone = std::max(1, std::min(99, 100 - (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * 50)));
4052+
if (reportDone < percentageDone/10) {
4053+
// report every 10% step
4054+
LogPrintf("[%d%%]...", percentageDone); /* Continued */
4055+
reportDone = percentageDone/10;
4056+
}
4057+
uiInterface.ShowProgress(_("Verifying blocks..."), percentageDone, false);
40524058
pindex = chainActive.Next(pindex);
40534059
CBlock block;
40544060
if (!ReadBlockFromDisk(block, pindex, chainparams.GetConsensus()))

0 commit comments

Comments
 (0)