Skip to content

Commit

Permalink
Add: log output during initial header sync (#174)
Browse files Browse the repository at this point in the history
* Add log output during initial header sync
* Avoid unnecessary "Synchronizing blockheaders" log messages
bitcoin/bitcoin#16774
* remove: "::ChainstateActive()"
* log message
Co-authored-by: Jonas Schnelli <dev@jonasschnelli.ch>
  • Loading branch information
decryp2kanon authored Sep 16, 2020
1 parent 0af4846 commit 6734681
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2610,7 +2610,7 @@ bool CChainState::ActivateBestChainStep(CValidationState& state, const CChainPar
return true;
}

static void NotifyHeaderTip() {
static bool NotifyHeaderTip() {
bool fNotify = false;
bool fInitialBlockDownload = false;
static CBlockIndex* pindexHeaderOld = nullptr;
Expand All @@ -2629,6 +2629,7 @@ static void NotifyHeaderTip() {
if (fNotify) {
uiInterface.NotifyHeaderTip(fInitialBlockDownload, pindexHeader);
}
return fNotify;
}

/**
Expand Down Expand Up @@ -3401,7 +3402,12 @@ bool ProcessNewBlockHeaders(const std::vector<CBlockHeader>& headers, CValidatio
}
}
}
NotifyHeaderTip();
if (NotifyHeaderTip()) {
LOCK(cs_main);
if (IsInitialBlockDownload() && ppindex && *ppindex) {
LogPrintf("sync headers, height: %d (~%.2f%%)\n", (*ppindex)->nHeight, 100.0/((*ppindex)->nHeight+(GetAdjustedTime() - (*ppindex)->GetBlockTime()) / Params().GetConsensus().nPowTargetSpacing) * (*ppindex)->nHeight);
}
}
return true;
}

Expand Down

0 comments on commit 6734681

Please sign in to comment.