Skip to content

Commit 9c64278

Browse files
author
MarcoFalke
committed
Merge #13910: Log progress while verifying blocks at level 4
e58985c Log progress while verifying blocks at level 4. (Daniel Kraft) Pull request description: 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. Tree-SHA512: 6a4c5914726fc1a1337de0c5130b20d4edf4e2feeb0aa0449d2ce422b2d8c41e56ede94163a02044d9a28ac4dc6624b1ad611da93ce5792ff32ad9fb1f0ea1e0
2 parents fd83c57 + e58985c commit 9c64278

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
@@ -3998,7 +3998,7 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview,
39983998
LogPrintf("[0%%]..."); /* Continued */
39993999
for (pindex = chainActive.Tip(); pindex && pindex->pprev; pindex = pindex->pprev) {
40004000
boost::this_thread::interruption_point();
4001-
int percentageDone = std::max(1, std::min(99, (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100))));
4001+
const int percentageDone = std::max(1, std::min(99, (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100))));
40024002
if (reportDone < percentageDone/10) {
40034003
// report every 10% step
40044004
LogPrintf("[%d%%]...", percentageDone); /* Continued */
@@ -4056,7 +4056,13 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview,
40564056
if (nCheckLevel >= 4) {
40574057
while (pindex != chainActive.Tip()) {
40584058
boost::this_thread::interruption_point();
4059-
uiInterface.ShowProgress(_("Verifying blocks..."), std::max(1, std::min(99, 100 - (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * 50))), false);
4059+
const int percentageDone = std::max(1, std::min(99, 100 - (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * 50)));
4060+
if (reportDone < percentageDone/10) {
4061+
// report every 10% step
4062+
LogPrintf("[%d%%]...", percentageDone); /* Continued */
4063+
reportDone = percentageDone/10;
4064+
}
4065+
uiInterface.ShowProgress(_("Verifying blocks..."), percentageDone, false);
40604066
pindex = chainActive.Next(pindex);
40614067
CBlock block;
40624068
if (!ReadBlockFromDisk(block, pindex, chainparams.GetConsensus()))

0 commit comments

Comments
 (0)