qt: Use nPowTargetSpacing constant

This commit is contained in:
MarcoFalke 2017-01-19 20:51:59 +01:00
parent b25068697f
commit fa4d47814f
4 changed files with 10 additions and 6 deletions

View file

@ -31,6 +31,7 @@
#include "macdockiconhandler.h" #include "macdockiconhandler.h"
#endif #endif
#include "chainparams.h"
#include "init.h" #include "init.h"
#include "ui_interface.h" #include "ui_interface.h"
#include "util.h" #include "util.h"
@ -752,8 +753,8 @@ void BitcoinGUI::updateHeadersSyncProgressLabel()
{ {
int64_t headersTipTime = clientModel->getHeaderTipTime(); int64_t headersTipTime = clientModel->getHeaderTipTime();
int headersTipHeight = clientModel->getHeaderTipHeight(); int headersTipHeight = clientModel->getHeaderTipHeight();
int estHeadersLeft = (GetTime() - headersTipTime)/600; int estHeadersLeft = (GetTime() - headersTipTime) / Params().GetConsensus().nPowTargetSpacing;
if (estHeadersLeft > REQ_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))); progressBarLabel->setText(tr("Syncing Headers (%1%)...").arg(QString::number(100.0 / (headersTipHeight+estHeadersLeft)*headersTipHeight, 'f', 1)));
} }

View file

@ -7,6 +7,8 @@
#include "guiutil.h" #include "guiutil.h"
#include "chainparams.h"
#include <QResizeEvent> #include <QResizeEvent>
#include <QPropertyAnimation> #include <QPropertyAnimation>
@ -125,11 +127,11 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri
// estimate the number of headers left based on nPowTargetSpacing // estimate the number of headers left based on nPowTargetSpacing
// and check if the gui is not aware of the the best header (happens rarely) // and check if the gui is not aware of the the best header (happens rarely)
int estimateNumHeadersLeft = bestHeaderDate.secsTo(currentDate) / 600; int estimateNumHeadersLeft = bestHeaderDate.secsTo(currentDate) / Params().GetConsensus().nPowTargetSpacing;
bool hasBestHeader = bestHeaderHeight >= count; bool hasBestHeader = bestHeaderHeight >= count;
// show remaining number of blocks // show remaining number of blocks
if (estimateNumHeadersLeft < 24 && hasBestHeader) { if (estimateNumHeadersLeft < HEADER_HEIGHT_DELTA_SYNC && hasBestHeader) {
ui->numberOfBlocksLeft->setText(QString::number(bestHeaderHeight - count)); ui->numberOfBlocksLeft->setText(QString::number(bestHeaderHeight - count));
} else { } else {
ui->numberOfBlocksLeft->setText(tr("Unknown. Syncing Headers (%1)...").arg(bestHeaderHeight)); ui->numberOfBlocksLeft->setText(tr("Unknown. Syncing Headers (%1)...").arg(bestHeaderHeight));

View file

@ -9,7 +9,7 @@
#include <QWidget> #include <QWidget>
//! The required delta of headers to the estimated number of available headers until we show the IBD progress //! The required delta of headers to the estimated number of available headers until we show the IBD progress
static const int REQ_HEADER_HEIGHT_DELTA_SYNC = 24; static constexpr int HEADER_HEIGHT_DELTA_SYNC = 24;
namespace Ui { namespace Ui {
class ModalOverlay; class ModalOverlay;

View file

@ -16,6 +16,7 @@
#include "walletmodel.h" #include "walletmodel.h"
#include "base58.h" #include "base58.h"
#include "chainparams.h"
#include "wallet/coincontrol.h" #include "wallet/coincontrol.h"
#include "validation.h" // mempool and minRelayTxFee #include "validation.h" // mempool and minRelayTxFee
#include "ui_interface.h" #include "ui_interface.h"
@ -608,7 +609,7 @@ void SendCoinsDialog::updateGlobalFeeVariables()
CoinControlDialog::coinControl->nMinimumTotalFee = 0; CoinControlDialog::coinControl->nMinimumTotalFee = 0;
// show the estimated reuquired time for confirmation // show the estimated reuquired time for confirmation
ui->confirmationTargetLabel->setText(GUIUtil::formatDurationStr(nConfirmTarget*600)+" / "+tr("%n block(s)", "", nConfirmTarget)); ui->confirmationTargetLabel->setText(GUIUtil::formatDurationStr(nConfirmTarget * Params().GetConsensus().nPowTargetSpacing) + " / " + tr("%n block(s)", "", nConfirmTarget));
} }
else else
{ {