-
Notifications
You must be signed in to change notification settings - Fork 1.7k
chore: add safety guard for negative cycle index #6527
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
Changes from 5 commits
b733257
c9e2299
3e334c7
dad308a
5b426c6
8077531
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -213,7 +213,12 @@ private long computeReward(long beginCycle, long endCycle, AccountCapsule accoun | |
| beginCycle = oldEndCycle; | ||
| } | ||
| if (beginCycle < endCycle) { | ||
| for (Pair<byte[], Long> vote : srAddresses) { | ||
| if (beginCycle <= 0) { | ||
| return 0L; | ||
| } | ||
|
|
||
| for (Pair<byte[], Long> vote : srAddresses) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The PR title mentions adding a "safety guard for negative cycle index", but the diff only shows formatting changes. Could you double-check if the intended logic changes are missing from this PR?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for pointing this out. I'll double-check the intended logic change and update the PR if something is missing. |
||
|
|
||
| byte[] srAddress = vote.getKey(); | ||
| BigInteger beginVi = delegationStore.getWitnessVi(beginCycle - 1, srAddress); | ||
| BigInteger endVi = delegationStore.getWitnessVi(endCycle - 1, srAddress); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.