-
Notifications
You must be signed in to change notification settings - Fork 291
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
Change consolidated balance calculation + small refactor #8908
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -322,12 +322,18 @@ public void processPendingConsolidations(final MutableBeaconState state) { | |
break; | ||
} | ||
|
||
final UInt64 activeBalance = | ||
stateAccessorsElectra.getActiveBalance(state, pendingConsolidation.getSourceIndex()); | ||
// Calculate the consolidated balance | ||
final UInt64 sourceEffectiveBalance = | ||
state | ||
.getBalances() | ||
.get(pendingConsolidation.getSourceIndex()) | ||
.get() | ||
.min(sourceValidator.getEffectiveBalance()); | ||
// Move active balance to target. Excess balance is withdrawable. | ||
beaconStateMutators.decreaseBalance( | ||
state, pendingConsolidation.getSourceIndex(), activeBalance); | ||
state, pendingConsolidation.getSourceIndex(), sourceEffectiveBalance); | ||
beaconStateMutators.increaseBalance( | ||
state, pendingConsolidation.getTargetIndex(), activeBalance); | ||
state, pendingConsolidation.getTargetIndex(), sourceEffectiveBalance); | ||
Comment on lines
-325
to
+336
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. 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. yep next time i think this can be a PR and refactor can be separate for sanity. 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. Yes, noted for next time. |
||
|
||
nextPendingBalanceConsolidation++; | ||
} | ||
|
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.
moving all of these fns does make it a lot harder to determine if there were changes in githubs ui...