Skip to content

Commit

Permalink
IBD: Print blockheader count on debug.log (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
decryp2kanon committed May 12, 2020
1 parent 7c45e62 commit cef03ef
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include <ui_interface.h>
#include <util.h>

#include <validation.h> // FIXME.SUGAR // IBD: for IsInitialBlockDownload()

#include <iostream>

#include <QAction>
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cef03ef

Please sign in to comment.