From ed3b473ec65183e023c94badcccdd25a5e9f03a5 Mon Sep 17 00:00:00 2001 From: Solar Designer Date: Tue, 2 Apr 2019 16:13:57 +0200 Subject: [PATCH 1/2] Fix typos in ProcessMessage() "headers" --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f97755e58..d11ca5bae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6073,7 +6073,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, LOCK(cs_main); if (nCount == 0) { - // Nothing interesting. Stop asking this peers for more headers. + // Nothing interesting. Stop asking this peer for more headers. return true; } @@ -6101,7 +6101,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, // Headers message had its maximum size; the peer may have more headers. // TODO: optimize: if pindexLast is an ancestor of chainActive.Tip or pindexBestHeader, continue // from there instead. - LogPrint("net", "more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->id, pfrom->nStartingHeight); + LogPrint("net", "more getheaders (%d) to send to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->id, pfrom->nStartingHeight); pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexLast), uint256()); } From fad004114a999370c9c73c8cfd4c7a7fe91da5d9 Mon Sep 17 00:00:00 2001 From: Solar Designer Date: Tue, 2 Apr 2019 16:13:39 +0200 Subject: [PATCH 2/2] During initial blocks download, also report the number of headers --- src/metrics.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/metrics.cpp b/src/metrics.cpp index cddf36fcc..df4a127b0 100644 --- a/src/metrics.cpp +++ b/src/metrics.cpp @@ -291,10 +291,17 @@ int printStats(bool mining) int downloadPercent = nSizeReindexed * 100 / nFullSizeToReindex; std::cout << " " << _("Reindexing blocks") << " | " << DisplaySize(nSizeReindexed) << " / " << DisplaySize(nFullSizeToReindex) << " (" << downloadPercent << "%, " << height << " " << _("blocks") << ")" << std::endl; } else { + int nHeaders = currentHeadersHeight; + if (nHeaders < 0) + nHeaders = 0; int netheight = currentHeadersHeight == -1 || currentHeadersTime == 0 ? 0 : EstimateNetHeight(params, currentHeadersHeight, currentHeadersTime); + if (netheight < nHeaders) + netheight = nHeaders; + if (netheight <= 0) + netheight = 1; int downloadPercent = height * 100 / netheight; - std::cout << " " << _("Downloading blocks") << " | " << height << " / ~" << netheight << " (" << downloadPercent << "%)" << std::endl; + std::cout << " " << _("Downloading blocks") << " | " << height << " (" << nHeaders << " " << _("headers") << ") / ~" << netheight << " (" << downloadPercent << "%)" << std::endl; } } else { std::cout << " " << _("Block height") << " | " << height << std::endl;