Skip to content

Commit dcc448e

Browse files
committed
Avoid unnecessary "Synchronizing blockheaders" log messages
1 parent 495db72 commit dcc448e

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
@@ -2561,7 +2561,7 @@ bool CChainState::ActivateBestChainStep(CValidationState& state, const CChainPar
25612561
return true;
25622562
}
25632563

2564-
static void NotifyHeaderTip() LOCKS_EXCLUDED(cs_main) {
2564+
static bool NotifyHeaderTip() LOCKS_EXCLUDED(cs_main) {
25652565
bool fNotify = false;
25662566
bool fInitialBlockDownload = false;
25672567
static CBlockIndex* pindexHeaderOld = nullptr;
@@ -2580,6 +2580,7 @@ static void NotifyHeaderTip() LOCKS_EXCLUDED(cs_main) {
25802580
if (fNotify) {
25812581
uiInterface.NotifyHeaderTip(fInitialBlockDownload, pindexHeader);
25822582
}
2583+
return fNotify;
25832584
}
25842585

25852586
static void LimitValidationInterfaceQueue() LOCKS_EXCLUDED(cs_main) {
@@ -3400,8 +3401,7 @@ bool ProcessNewBlockHeaders(const std::vector<CBlockHeader>& headers, CValidatio
34003401
}
34013402
}
34023403
}
3403-
NotifyHeaderTip();
3404-
{
3404+
if (NotifyHeaderTip()) {
34053405
LOCK(cs_main);
34063406
if (::ChainstateActive().IsInitialBlockDownload() && ppindex && *ppindex) {
34073407
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)