Skip to content

Commit 8e00a68

Browse files
author
MarcoFalke
committed
Merge #16774: Avoid unnecessary "Synchronizing blockheaders" log messages
dcc448e Avoid unnecessary "Synchronizing blockheaders" log messages (Jonas Schnelli) Pull request description: Fixes #16773 I'm not entirely sure why 16773 happend, but probably due to headers fallback in a compact block. However, this PR should fix it and should have been included in #15615. ACKs for top commit: ajtowns: ACK dcc448e ; code review only, haven't compiled or tested. promag: ACK dcc448e. TheBlueMatt: utACK dcc448e. Went and read how pindexBestHeader is handled and this code looks correct (worst case it breaks a LogPrint, so whatever). I also ran into this on #16762. fanquake: ACK dcc448e Tree-SHA512: f8cac3b6eb9d4e8fab53a535b55f9ea9b058e3ab6ade64801ebc56439ede4f54b5fee36d5d2b316966ab987b65b13ab9dc18849f345d08b81ecdf2722a3f5f5a
2 parents 6e43129 + dcc448e commit 8e00a68

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/validation.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,7 +2557,7 @@ bool CChainState::ActivateBestChainStep(CValidationState& state, const CChainPar
25572557
return true;
25582558
}
25592559

2560-
static void NotifyHeaderTip() LOCKS_EXCLUDED(cs_main) {
2560+
static bool NotifyHeaderTip() LOCKS_EXCLUDED(cs_main) {
25612561
bool fNotify = false;
25622562
bool fInitialBlockDownload = false;
25632563
static CBlockIndex* pindexHeaderOld = nullptr;
@@ -2576,6 +2576,7 @@ static void NotifyHeaderTip() LOCKS_EXCLUDED(cs_main) {
25762576
if (fNotify) {
25772577
uiInterface.NotifyHeaderTip(fInitialBlockDownload, pindexHeader);
25782578
}
2579+
return fNotify;
25792580
}
25802581

25812582
static void LimitValidationInterfaceQueue() LOCKS_EXCLUDED(cs_main) {
@@ -3396,8 +3397,7 @@ bool ProcessNewBlockHeaders(const std::vector<CBlockHeader>& headers, CValidatio
33963397
}
33973398
}
33983399
}
3399-
NotifyHeaderTip();
3400-
{
3400+
if (NotifyHeaderTip()) {
34013401
LOCK(cs_main);
34023402
if (::ChainstateActive().IsInitialBlockDownload() && ppindex && *ppindex) {
34033403
LogPrintf("Synchronizing blockheaders, height: %d (~%.2f%%)\n", (*ppindex)->nHeight, 100.0/((*ppindex)->nHeight+(GetAdjustedTime() - (*ppindex)->GetBlockTime()) / Params().GetConsensus().nPowTargetSpacing) * (*ppindex)->nHeight);

0 commit comments

Comments
 (0)