From 44678e5442c8f1fdb9734875df81ae7a936cb313 Mon Sep 17 00:00:00 2001 From: chromatic Date: Mon, 10 May 2021 18:00:54 -0700 Subject: [PATCH 1/2] Disallow negative progress increase per hour % See GH#1902. --- src/qt/modaloverlay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/modaloverlay.cpp b/src/qt/modaloverlay.cpp index bf632d28c..7254a615e 100644 --- a/src/qt/modaloverlay.cpp +++ b/src/qt/modaloverlay.cpp @@ -104,7 +104,7 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri } } // show progress increase per hour - ui->progressIncreasePerH->setText(QString::number(progressPerHour*100, 'f', 2)+"%"); + ui->progressIncreasePerH->setText(QString::number(progressPerHour > 0 ? progressPerHour*100 : 0, 'f', 2)+"%"); // show expected remaining time ui->expectedTimeLeft->setText(GUIUtil::formatNiceTimeOffset(remainingMSecs/1000.0)); From 5040cd0d03bdf53862560b916dcfd9d81daef7b2 Mon Sep 17 00:00:00 2001 From: chromatic Date: Mon, 10 May 2021 18:21:34 -0700 Subject: [PATCH 2/2] Skip expected remaining sync time without estimate See GH#1902. --- src/qt/modaloverlay.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/qt/modaloverlay.cpp b/src/qt/modaloverlay.cpp index 7254a615e..f3a28fc55 100644 --- a/src/qt/modaloverlay.cpp +++ b/src/qt/modaloverlay.cpp @@ -106,8 +106,9 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri // show progress increase per hour ui->progressIncreasePerH->setText(QString::number(progressPerHour > 0 ? progressPerHour*100 : 0, 'f', 2)+"%"); - // show expected remaining time - ui->expectedTimeLeft->setText(GUIUtil::formatNiceTimeOffset(remainingMSecs/1000.0)); + // show expected remaining time, if we have a sample + if (remainingMSecs > 0) + ui->expectedTimeLeft->setText(GUIUtil::formatNiceTimeOffset(remainingMSecs/1000.0)); static const int MAX_SAMPLES = 5000; if (blockProcessTime.count() > MAX_SAMPLES) @@ -126,7 +127,7 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri return; // 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 best header (happens rarely) int estimateNumHeadersLeft = bestHeaderDate.secsTo(currentDate) / Params().GetConsensus(bestHeaderHeight).nPowTargetSpacing; bool hasBestHeader = bestHeaderHeight >= count;