Prevent negative values of progressPerHour #508
pull HiLivin wants to merge 1 commits into bitcoin-core:master from HiLivin:master changing 1 files +1 −1-
HiLivin commented at 11:40 pm on December 13, 2021: contributorAdded a similar guard to progressPerHour as is placed at remainingMSecs. It prevents the display of negative values like “-0.00%” in some cases.
-
shaavan approved
-
shaavan commented at 9:25 am on December 14, 2021: contributor
ACK ef1754336dfd5340a41df5cc6a0abb2d3bc60fec
It makes logical sense that progress shall always be a non-negative number. Hence, I agree with the change.
-
hebasto renamed this:
qt: prevent negative values of progressPerHour
Prevent negative values of progressPerHour
on Dec 14, 2021 -
hebasto added the label UX on Dec 14, 2021
-
hebasto commented at 11:42 am on December 14, 2021: member
ACK ef1754336dfd5340a41df5cc6a0abb2d3bc60fec
Negative progress is meaningless. Tested with a custom patch.
Related to https://github.com/bitcoin/bitcoin/issues/11265.
-
in src/qt/modaloverlay.cpp:111 in ef1754336d outdated
107@@ -108,7 +108,7 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri 108 if (sample.first < (currentDate.toMSecsSinceEpoch() - 500 * 1000) || i == blockProcessTime.size() - 1) { 109 progressDelta = blockProcessTime[0].second - sample.second; 110 timeDelta = blockProcessTime[0].first - sample.first; 111- progressPerHour = progressDelta / (double) timeDelta * 1000 * 3600; 112+ progressPerHour = (progressDelta > 0) ? progressDelta / (double) timeDelta * 1000 * 3600 : 0;
hebasto commented at 11:44 am on December 14, 2021:nit:
clang-format-diff.py
insist on0 progressPerHour = (progressDelta > 0) ? progressDelta / (double)timeDelta * 1000 * 3600 : 0;
hebasto commented at 2:14 pm on December 14, 2021: memberThanks. To make this PR ready to get merged, please squash your two commits into one. See https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commits
HiLivin force-pushed on Dec 14, 2021hebasto commented at 6:03 pm on December 14, 2021: memberThank you! It looks pretty good now.
When you squashed you commits the previous second commit message goes into the current commit message. It will look irrelevant in the commit history after merging. So please leave only the original commit message.
And no need to tag me as a co-author :)
qt: prevent negative values of progressPerHour
Added a similar guard to progressPerHour as is placed at remainingMSecs. It prevents the display of negative values like "-0.00%" in some cases.
HiLivin force-pushed on Dec 14, 2021hebasto approvedhebasto commented at 7:17 pm on December 14, 2021: memberACK 71d33380ed6858b4a65b396332bfb22d984642a6jarolrod commented at 8:16 am on December 15, 2021: memberACK 71d3338shaavan approvedshaavan commented at 11:27 am on December 15, 2021: contributorreACK 71d33380ed6858b4a65b396332bfb22d984642a6
Changes since my last review:
- Formatting of the added patch has been fixed.
I have checked that the formatting of this PR is now correct.
p.s.: It looks this is your first PR. A warm welcome, @HiLivin!!
hebasto merged this on Dec 15, 2021hebasto closed this on Dec 15, 2021
sidhujag referenced this in commit 5ef7401554 on Dec 15, 2021bitcoin-core locked this on Dec 15, 2022
This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-21 12:20 UTC
More mirrored repositories can be found on mirror.b10c.me