mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge 85c8a5ec48 into merged_master (Bitcoin PR bitcoin/bitcoin#29647)
This commit is contained in:
commit
6bc934c8a8
1 changed files with 6 additions and 4 deletions
|
|
@ -4848,9 +4848,10 @@ bool ChainstateManager::ProcessNewBlockHeaders(const std::vector<CBlockHeader>&
|
|||
if (NotifyHeaderTip(*this)) {
|
||||
if (IsInitialBlockDownload() && ppindex && *ppindex) {
|
||||
const CBlockIndex& last_accepted{**ppindex};
|
||||
const int64_t blocks_left{(GetTime() - last_accepted.GetBlockTime()) / GetConsensus().nPowTargetSpacing};
|
||||
int64_t blocks_left{(NodeClock::now() - last_accepted.Time()) / GetConsensus().PowTargetSpacing()};
|
||||
blocks_left = std::max<int64_t>(0, blocks_left);
|
||||
const double progress{100.0 * last_accepted.nHeight / (last_accepted.nHeight + blocks_left)};
|
||||
LogPrintf("Synchronizing blockheaders, height: %d (~%.2f%%)\n", last_accepted.nHeight, progress);
|
||||
LogInfo("Synchronizing blockheaders, height: %d (~%.2f%%)\n", last_accepted.nHeight, progress);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -4874,9 +4875,10 @@ void ChainstateManager::ReportHeadersPresync(const arith_uint256& work, int64_t
|
|||
bool initial_download = IsInitialBlockDownload();
|
||||
GetNotifications().headerTip(GetSynchronizationState(initial_download), height, timestamp, /*presync=*/true);
|
||||
if (initial_download) {
|
||||
const int64_t blocks_left{(GetTime() - timestamp) / GetConsensus().nPowTargetSpacing};
|
||||
int64_t blocks_left{(NodeClock::now() - NodeSeconds{std::chrono::seconds{timestamp}}) / GetConsensus().PowTargetSpacing()};
|
||||
blocks_left = std::max<int64_t>(0, blocks_left);
|
||||
const double progress{100.0 * height / (height + blocks_left)};
|
||||
LogPrintf("Pre-synchronizing blockheaders, height: %d (~%.2f%%)\n", height, progress);
|
||||
LogInfo("Pre-synchronizing blockheaders, height: %d (~%.2f%%)\n", height, progress);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue