From cef03ef38f0d21855155d0a1f51cd65876e83a25 Mon Sep 17 00:00:00 2001 From: kanon <60179867+decryp2kanon@users.noreply.github.com> Date: Tue, 12 May 2020 14:29:25 +0900 Subject: [PATCH] IBD: Print blockheader count on debug.log (#128) --- src/qt/bitcoingui.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 919c919ee..2629502c0 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -32,6 +32,8 @@ #include #include +#include // FIXME.SUGAR // IBD: for IsInitialBlockDownload() + #include #include @@ -758,8 +760,15 @@ void BitcoinGUI::updateHeadersSyncProgressLabel() int64_t headersTipTime = clientModel->getHeaderTipTime(); int headersTipHeight = clientModel->getHeaderTipHeight(); int estHeadersLeft = (GetTime() - headersTipTime) / Params().GetConsensus().nPowTargetSpacing; - if (estHeadersLeft > HEADER_HEIGHT_DELTA_SYNC) + if (estHeadersLeft > HEADER_HEIGHT_DELTA_SYNC) { progressBarLabel->setText(tr("Syncing Headers (%1%)...").arg(QString::number(100.0 / (headersTipHeight+estHeadersLeft)*headersTipHeight, 'f', 1))); + + // FIXME.SUGAR + // IBD: Print blockheader count on debug.log + // Start to print if the percentage is over 1.0% to make clean + if (IsInitialBlockDownload() && (100.0 / (headersTipHeight+estHeadersLeft)*headersTipHeight) >= 1.0) + LogPrintf("headers=%d(%.1f%%)\n", headersTipHeight, (100.0 / (headersTipHeight+estHeadersLeft)*headersTipHeight)); + } } void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool header)