aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2017-01-24 09:22:56 +0100
committerJonas Schnelli <dev@jonasschnelli.ch>2017-01-24 09:24:41 +0100
commit50864529b6e7295bac0bb8af094c903c567f20bb (patch)
tree3474518cd37ad133a7a1f9c989ba79608d72405e
parent71148b8947fe8b4d756822420a7f31c380159425 (diff)
parentfa4d47814f298523aeb9a6658cc74fc46d316e33 (diff)
Merge #9588: qt: Use nPowTargetSpacing constant
fa4d478 qt: Use nPowTargetSpacing constant (MarcoFalke)
-rw-r--r--src/qt/bitcoingui.cpp5
-rw-r--r--src/qt/modaloverlay.cpp6
-rw-r--r--src/qt/modaloverlay.h2
-rw-r--r--src/qt/sendcoinsdialog.cpp3
4 files changed, 10 insertions, 6 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index b86437cede..f86b09644b 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -31,6 +31,7 @@
#include "macdockiconhandler.h"
#endif
+#include "chainparams.h"
#include "init.h"
#include "ui_interface.h"
#include "util.h"
@@ -752,8 +753,8 @@ void BitcoinGUI::updateHeadersSyncProgressLabel()
{
int64_t headersTipTime = clientModel->getHeaderTipTime();
int headersTipHeight = clientModel->getHeaderTipHeight();
- int estHeadersLeft = (GetTime() - headersTipTime)/600;
- if (estHeadersLeft > REQ_HEADER_HEIGHT_DELTA_SYNC)
+ int estHeadersLeft = (GetTime() - headersTipTime) / Params().GetConsensus().nPowTargetSpacing;
+ if (estHeadersLeft > HEADER_HEIGHT_DELTA_SYNC)
progressBarLabel->setText(tr("Syncing Headers (%1%)...").arg(QString::number(100.0 / (headersTipHeight+estHeadersLeft)*headersTipHeight, 'f', 1)));
}
diff --git a/src/qt/modaloverlay.cpp b/src/qt/modaloverlay.cpp
index 89fb159956..4779ffa43f 100644
--- a/src/qt/modaloverlay.cpp
+++ b/src/qt/modaloverlay.cpp
@@ -7,6 +7,8 @@
#include "guiutil.h"
+#include "chainparams.h"
+
#include <QResizeEvent>
#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
// 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;
// show remaining number of blocks
- if (estimateNumHeadersLeft < 24 && hasBestHeader) {
+ if (estimateNumHeadersLeft < HEADER_HEIGHT_DELTA_SYNC && hasBestHeader) {
ui->numberOfBlocksLeft->setText(QString::number(bestHeaderHeight - count));
} else {
ui->numberOfBlocksLeft->setText(tr("Unknown. Syncing Headers (%1)...").arg(bestHeaderHeight));
diff --git a/src/qt/modaloverlay.h b/src/qt/modaloverlay.h
index 6d1f12164e..21ccdbd839 100644
--- a/src/qt/modaloverlay.h
+++ b/src/qt/modaloverlay.h
@@ -9,7 +9,7 @@
#include <QWidget>
//! 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 {
class ModalOverlay;
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp
index 5aeda7a30d..1e2842df73 100644
--- a/src/qt/sendcoinsdialog.cpp
+++ b/src/qt/sendcoinsdialog.cpp
@@ -16,6 +16,7 @@
#include "walletmodel.h"
#include "base58.h"
+#include "chainparams.h"
#include "wallet/coincontrol.h"
#include "validation.h" // mempool and minRelayTxFee
#include "ui_interface.h"
@@ -608,7 +609,7 @@ void SendCoinsDialog::updateGlobalFeeVariables()
CoinControlDialog::coinControl->nMinimumTotalFee = 0;
// 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
{