Skip to content

Commit fa58550

Browse files
author
MarcoFalke
committed
refactor: Modernize header sync logs
No change in behavior, only the modern aliases and types are used.
1 parent 264ca9d commit fa58550

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/validation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4188,9 +4188,9 @@ bool ChainstateManager::ProcessNewBlockHeaders(const std::vector<CBlockHeader>&
41884188
if (NotifyHeaderTip(*this)) {
41894189
if (IsInitialBlockDownload() && ppindex && *ppindex) {
41904190
const CBlockIndex& last_accepted{**ppindex};
4191-
const int64_t blocks_left{(GetTime() - last_accepted.GetBlockTime()) / GetConsensus().nPowTargetSpacing};
4191+
int64_t blocks_left{(NodeClock::now() - last_accepted.Time()) / GetConsensus().PowTargetSpacing()};
41924192
const double progress{100.0 * last_accepted.nHeight / (last_accepted.nHeight + blocks_left)};
4193-
LogPrintf("Synchronizing blockheaders, height: %d (~%.2f%%)\n", last_accepted.nHeight, progress);
4193+
LogInfo("Synchronizing blockheaders, height: %d (~%.2f%%)\n", last_accepted.nHeight, progress);
41944194
}
41954195
}
41964196
return true;
@@ -4214,9 +4214,9 @@ void ChainstateManager::ReportHeadersPresync(const arith_uint256& work, int64_t
42144214
bool initial_download = IsInitialBlockDownload();
42154215
GetNotifications().headerTip(GetSynchronizationState(initial_download), height, timestamp, /*presync=*/true);
42164216
if (initial_download) {
4217-
const int64_t blocks_left{(GetTime() - timestamp) / GetConsensus().nPowTargetSpacing};
4217+
int64_t blocks_left{(NodeClock::now() - NodeSeconds{std::chrono::seconds{timestamp}}) / GetConsensus().PowTargetSpacing()};
42184218
const double progress{100.0 * height / (height + blocks_left)};
4219-
LogPrintf("Pre-synchronizing blockheaders, height: %d (~%.2f%%)\n", height, progress);
4219+
LogInfo("Pre-synchronizing blockheaders, height: %d (~%.2f%%)\n", height, progress);
42204220
}
42214221
}
42224222

0 commit comments

Comments
 (0)