Skip to content

Commit fe683f3

Browse files
committed
log: Log VerifyDB Progress over multiple lines
This allows to log a timestamp for each entry, and avoids potential interference with other threads that could log concurrently.
1 parent 61431e3 commit fe683f3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/validation.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4082,15 +4082,15 @@ bool CVerifyDB::VerifyDB(
40824082
BlockValidationState state;
40834083
int reportDone = 0;
40844084
bool skipped_l3_checks{false};
4085-
LogPrintf("[0%%]..."); /* Continued */
4085+
LogPrintf("Verification progress: 0%%\n");
40864086

40874087
const bool is_snapshot_cs{!chainstate.m_from_snapshot_blockhash};
40884088

40894089
for (pindex = chainstate.m_chain.Tip(); pindex && pindex->pprev; pindex = pindex->pprev) {
40904090
const int percentageDone = std::max(1, std::min(99, (int)(((double)(chainstate.m_chain.Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100))));
40914091
if (reportDone < percentageDone / 10) {
40924092
// report every 10% step
4093-
LogPrintf("[%d%%]...", percentageDone); /* Continued */
4093+
LogPrintf("Verification progress: %d%%\n", percentageDone);
40944094
reportDone = percentageDone / 10;
40954095
}
40964096
uiInterface.ShowProgress(_("Verifying blocks…").translated, percentageDone, false);
@@ -4159,7 +4159,7 @@ bool CVerifyDB::VerifyDB(
41594159
const int percentageDone = std::max(1, std::min(99, 100 - (int)(((double)(chainstate.m_chain.Height() - pindex->nHeight)) / (double)nCheckDepth * 50)));
41604160
if (reportDone < percentageDone / 10) {
41614161
// report every 10% step
4162-
LogPrintf("[%d%%]...", percentageDone); /* Continued */
4162+
LogPrintf("Verification progress: %d%%\n", percentageDone);
41634163
reportDone = percentageDone / 10;
41644164
}
41654165
uiInterface.ShowProgress(_("Verifying blocks…").translated, percentageDone, false);
@@ -4174,8 +4174,7 @@ bool CVerifyDB::VerifyDB(
41744174
}
41754175
}
41764176

4177-
LogPrintf("[DONE].\n");
4178-
LogPrintf("No coin database inconsistencies in last %i blocks (%i transactions)\n", block_count, nGoodTransactions);
4177+
LogPrintf("Verification: No coin database inconsistencies in last %i blocks (%i transactions)\n", block_count, nGoodTransactions);
41794178

41804179
return true;
41814180
}

0 commit comments

Comments
 (0)