diff options
| author | Jonas Schnelli <[email protected]> | 2016-09-13 16:36:24 +0200 |
|---|---|---|
| committer | Jonas Schnelli <[email protected]> | 2016-09-13 17:57:25 +0200 |
| commit | d8b062ef5eea3addff00a09bad1dab162452b4b5 (patch) | |
| tree | bc4a075d2557f3ea653ffc6b07540fc7653cce97 /src/qt/modaloverlay.cpp | |
| parent | [Qt] add out-of-sync modal info layer (diff) | |
| download | discoin-d8b062ef5eea3addff00a09bad1dab162452b4b5.tar.xz discoin-d8b062ef5eea3addff00a09bad1dab162452b4b5.zip | |
[Qt] only update "amount of blocks left" when the header chain is in-sync
Diffstat (limited to 'src/qt/modaloverlay.cpp')
| -rw-r--r-- | src/qt/modaloverlay.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/qt/modaloverlay.cpp b/src/qt/modaloverlay.cpp index 1cd5b1996..c54889039 100644 --- a/src/qt/modaloverlay.cpp +++ b/src/qt/modaloverlay.cpp @@ -63,10 +63,17 @@ bool ModalOverlay::event(QEvent* ev) { return QWidget::event(ev); } -void ModalOverlay::setKnownBestHeight(int count) +void ModalOverlay::setKnownBestHeight(int count, const QDateTime& blockDate) { - if (count > bestBlockHeight) - bestBlockHeight = count; + + /* only update the blockheight if the headerschain-tip is not older then 30 days */ + int64_t now = QDateTime::currentDateTime().toTime_t(); + int64_t btime = blockDate.toTime_t(); + if (btime+3600*24*30 > now) + { + if (count > bestBlockHeight) + bestBlockHeight = count; + } } void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVerificationProgress) @@ -122,6 +129,8 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri // show remaining amount of blocks if (bestBlockHeight > 0) ui->amountOfBlocksLeft->setText(QString::number(bestBlockHeight-count)); + else + ui->expectedTimeLeft->setText(tr("Unknown. Syncing Headers...")); } void ModalOverlay::showHide(bool hide, bool userRequested) |