Skip to content
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

Merged
merged 3 commits into from
Feb 19, 2022

Conversation

someone235
Copy link
Collaborator

No description provided.

@codecov
Copy link

codecov bot commented Feb 18, 2022

Codecov Report

❗ No coverage uploaded for pull request base (dev@ce4f5fc). Click here to learn what that means.
The diff coverage is 50.00%.

Impacted file tree graph

@@          Coverage Diff           @@
##             dev    #1949   +/-   ##
======================================
  Coverage       ?   61.08%           
======================================
  Files          ?      640           
  Lines          ?    30025           
  Branches       ?        0           
======================================
  Hits           ?    18342           
  Misses         ?     9085           
  Partials       ?     2598           
Impacted Files Coverage Δ
app/protocol/flows/v4/blockrelay/ibd.go 50.41% <50.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce4f5fc...a109b60. Read the comment docs.

@@ -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 {
Copy link
Collaborator

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

Copy link
Collaborator Author

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%%",
Copy link
Collaborator

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

@someone235 someone235 merged commit 3f7e482 into kaspanet:dev Feb 19, 2022
@someone235 someone235 deleted the virtual-progress branch February 19, 2022 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants