-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add progress indication for virtual resolution #1949
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #1949 +/- ##
======================================
Coverage ? 61.08%
======================================
Files ? 640
Lines ? 30025
Branches ? 0
======================================
Hits ? 18342
Misses ? 9085
Partials ? 2598
Continue to review full report at Codecov.
|
@@ -590,6 +590,10 @@ func (flow *handleIBDFlow) resolveVirtual(estimatedVirtualDAAScoreTarget uint64) | |||
if err != nil { | |||
return err | |||
} | |||
percents := int(float64(virtualDAAScore-virtualDAAScoreStart) / float64(estimatedVirtualDAAScoreTarget-virtualDAAScoreStart) * 100) | |||
if percents < 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can this become negative? is it possible that virtualDAAScore < virtualDAAScoreStart
?
If it's possible that estimatedVirtualDAAScoreTarget <= virtualDAAScoreStart
then you might be dividing by zero
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because in some edge cases virtualDAAScoreStart
can be higher than estimatedVirtualDAAScoreTarget
percents := int(float64(virtualDAAScore-virtualDAAScoreStart) / float64(estimatedVirtualDAAScoreTarget-virtualDAAScoreStart) * 100) | ||
if percents < 0 { | ||
percents = 100 | ||
} | ||
log.Infof("Resolving virtual. Estimated progress: %d%%", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You were probably planning on using percents
here
No description provided.