diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-12-15 15:03:33 +0200 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-12-15 15:10:20 +0200 |
commit | b8cc75435a0bcb6c62083ff134b1ba3d2ace50d1 (patch) | |
tree | dbb9e4768af25bdce2ad9ca383dd970c0ed51433 | |
parent | 60b5795133a2f6bed5d68340c5f5b6c225fa9cdb (diff) | |
parent | 71d33380ed6858b4a65b396332bfb22d984642a6 (diff) | |
download | bitcoin-b8cc75435a0bcb6c62083ff134b1ba3d2ace50d1.tar.xz |
Merge bitcoin-core/gui#508: Prevent negative values of progressPerHour
71d33380ed6858b4a65b396332bfb22d984642a6 qt: prevent negative values of progressPerHour (HiLivin)
Pull request description:
Added a similar guard to _progressPerHour_ as is placed at _remainingMSecs_.
It prevents the display of negative values like "-0.00%" in some cases.
ACKs for top commit:
hebasto:
ACK 71d33380ed6858b4a65b396332bfb22d984642a6
jarolrod:
ACK 71d3338
shaavan:
reACK 71d33380ed6858b4a65b396332bfb22d984642a6
Tree-SHA512: 5427cdf4441b542196008034355ea00a075adf8b9aeeb383bacdb4e5fbda23d665448a50035aac93cbf401d5d6211d39a2c7c294568d9f5548a5c7579e201c44
-rw-r--r-- | src/qt/modaloverlay.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qt/modaloverlay.cpp b/src/qt/modaloverlay.cpp index ae27cad477..cca77881e1 100644 --- a/src/qt/modaloverlay.cpp +++ b/src/qt/modaloverlay.cpp @@ -108,7 +108,7 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri if (sample.first < (currentDate.toMSecsSinceEpoch() - 500 * 1000) || i == blockProcessTime.size() - 1) { progressDelta = blockProcessTime[0].second - sample.second; timeDelta = blockProcessTime[0].first - sample.first; - progressPerHour = progressDelta / (double) timeDelta * 1000 * 3600; + progressPerHour = (progressDelta > 0) ? progressDelta / (double)timeDelta * 1000 * 3600 : 0; remainingMSecs = (progressDelta > 0) ? remainingProgress / progressDelta * timeDelta : -1; break; } |