aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2022-01-17 08:46:40 +0100
committerMarcoFalke <falke.marco@gmail.com>2022-01-17 08:46:47 +0100
commitdfe1341c57d82d176a2f650274b551c0e652988d (patch)
tree63627ef877934b75d39a2e02648afd4c0a460060 /src/validation.cpp
parent7de2cf9b258590ffefd724abe0d4458f282b95c3 (diff)
parentfac22fd36b2d9f55dada31cc0da55520431b972a (diff)
downloadbitcoin-dfe1341c57d82d176a2f650274b551c0e652988d.tar.xz
Merge bitcoin/bitcoin#24033: log: Remove GetAdjustedTime from IBD header progress estimation
fac22fd36b2d9f55dada31cc0da55520431b972a log: Remove GetAdjustedTime from IBD header progress estimation (MarcoFalke) Pull request description: This is a "refactor" that shouldn't change behaviour, because the two times are most likely equal. A minimum of 5 outbound peers are needed to adjust the time. And if the time is adjusted, it will be by at most 70 minutes (`DEFAULT_MAX_TIME_ADJUSTMENT`). Thus, the progress estimate should differ by at most 7 blocks. ACKs for top commit: laanwj: Code review ACK fac22fd36b2d9f55dada31cc0da55520431b972a vincenzopalazzo: ACK https://github.com/bitcoin/bitcoin/pull/24033/commits/fac22fd36b2d9f55dada31cc0da55520431b972a Tree-SHA512: bf9f5eef66db0110dd268cf6dbfab64b9c11ba776924f5b386ceae3f2d005272cceb87ebcc96e0c8b854c051514854a2a5af39ae43bad008fac685b5aafaabd0
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 5deb44699a..d34ba1d635 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -3528,7 +3528,10 @@ bool ChainstateManager::ProcessNewBlockHeaders(const std::vector<CBlockHeader>&
}
if (NotifyHeaderTip(ActiveChainstate())) {
if (ActiveChainstate().IsInitialBlockDownload() && ppindex && *ppindex) {
- LogPrintf("Synchronizing blockheaders, height: %d (~%.2f%%)\n", (*ppindex)->nHeight, 100.0/((*ppindex)->nHeight+(GetAdjustedTime() - (*ppindex)->GetBlockTime()) / Params().GetConsensus().nPowTargetSpacing) * (*ppindex)->nHeight);
+ const CBlockIndex& last_accepted{**ppindex};
+ const int64_t blocks_left{(GetTime() - last_accepted.GetBlockTime()) / chainparams.GetConsensus().nPowTargetSpacing};
+ const double progress{100.0 * last_accepted.nHeight / (last_accepted.nHeight + blocks_left)};
+ LogPrintf("Synchronizing blockheaders, height: %d (~%.2f%%)\n", last_accepted.nHeight, progress);
}
}
return true;