diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-09-03 16:39:08 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-09-03 16:39:11 -0400 |
commit | 8e00a68552404160583f7fb340e53f7b8128a550 (patch) | |
tree | e1fbffcce91a725caee0c983ef6be9ab448ac24b | |
parent | 6e431296daceee604f48e9e3e87fa84cfd44bef2 (diff) | |
parent | dcc448e3d2b97f7e4e23f5ed174762cec3530306 (diff) |
Merge #16774: Avoid unnecessary "Synchronizing blockheaders" log messages
dcc448e3d2b97f7e4e23f5ed174762cec3530306 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 dcc448e3d2b97f7e4e23f5ed174762cec3530306 ; code review only, haven't compiled or tested.
promag:
ACK dcc448e3d2b97f7e4e23f5ed174762cec3530306.
TheBlueMatt:
utACK dcc448e3d2b97f7e4e23f5ed174762cec3530306. 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 dcc448e3d2b97f7e4e23f5ed174762cec3530306
Tree-SHA512: f8cac3b6eb9d4e8fab53a535b55f9ea9b058e3ab6ade64801ebc56439ede4f54b5fee36d5d2b316966ab987b65b13ab9dc18849f345d08b81ecdf2722a3f5f5a
-rw-r--r-- | src/validation.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index a8ebbc1b96..cbf8c90392 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2557,7 +2557,7 @@ bool CChainState::ActivateBestChainStep(CValidationState& state, const CChainPar return true; } -static void NotifyHeaderTip() LOCKS_EXCLUDED(cs_main) { +static bool NotifyHeaderTip() LOCKS_EXCLUDED(cs_main) { bool fNotify = false; bool fInitialBlockDownload = false; static CBlockIndex* pindexHeaderOld = nullptr; @@ -2576,6 +2576,7 @@ static void NotifyHeaderTip() LOCKS_EXCLUDED(cs_main) { if (fNotify) { uiInterface.NotifyHeaderTip(fInitialBlockDownload, pindexHeader); } + return fNotify; } static void LimitValidationInterfaceQueue() LOCKS_EXCLUDED(cs_main) { @@ -3396,8 +3397,7 @@ bool ProcessNewBlockHeaders(const std::vector<CBlockHeader>& headers, CValidatio } } } - NotifyHeaderTip(); - { + if (NotifyHeaderTip()) { LOCK(cs_main); if (::ChainstateActive().IsInitialBlockDownload() && ppindex && *ppindex) { LogPrintf("Synchronizing blockheaders, height: %d (~%.2f%%)\n", (*ppindex)->nHeight, 100.0/((*ppindex)->nHeight+(GetAdjustedTime() - (*ppindex)->GetBlockTime()) / Params().GetConsensus().nPowTargetSpacing) * (*ppindex)->nHeight); |