Merge pull request #4573 from humbleDasher/backport15615

Backport 15615, 16774, and 16793
This commit is contained in:
PastaPastaPasta 2021-11-13 15:02:28 -05:00 committed by GitHub
commit 085dbc2649
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3009,7 +3009,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;
@ -3029,6 +3029,7 @@ static void NotifyHeaderTip() LOCKS_EXCLUDED(cs_main) {
uiInterface.NotifyHeaderTip(fInitialBlockDownload, pindexHeader);
GetMainSignals().NotifyHeaderTip(pindexHeader, fInitialBlockDownload);
}
return fNotify;
}
static void LimitValidationInterfaceQueue() LOCKS_EXCLUDED(cs_main) {
@ -4017,7 +4018,11 @@ bool ProcessNewBlockHeaders(const std::vector<CBlockHeader>& headers, CValidatio
}
}
}
NotifyHeaderTip();
if (NotifyHeaderTip()) {
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);
}
}
return true;
}