Skip to content

Commit fac22fd

Browse files
author
MarcoFalke
committed
log: Remove GetAdjustedTime from IBD header progress estimation
1 parent c561f2f commit fac22fd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/validation.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3528,7 +3528,10 @@ bool ChainstateManager::ProcessNewBlockHeaders(const std::vector<CBlockHeader>&
35283528
}
35293529
if (NotifyHeaderTip(ActiveChainstate())) {
35303530
if (ActiveChainstate().IsInitialBlockDownload() && ppindex && *ppindex) {
3531-
LogPrintf("Synchronizing blockheaders, height: %d (~%.2f%%)\n", (*ppindex)->nHeight, 100.0/((*ppindex)->nHeight+(GetAdjustedTime() - (*ppindex)->GetBlockTime()) / Params().GetConsensus().nPowTargetSpacing) * (*ppindex)->nHeight);
3531+
const CBlockIndex& last_accepted{**ppindex};
3532+
const int64_t blocks_left{(GetTime() - last_accepted.GetBlockTime()) / chainparams.GetConsensus().nPowTargetSpacing};
3533+
const double progress{100.0 * last_accepted.nHeight / (last_accepted.nHeight + blocks_left)};
3534+
LogPrintf("Synchronizing blockheaders, height: %d (~%.2f%%)\n", last_accepted.nHeight, progress);
35323535
}
35333536
}
35343537
return true;

0 commit comments

Comments
 (0)