Skip to content

Commit

Permalink
Precalculate isNextEpochAltair before the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Jul 29, 2021
1 parent db7cd85 commit d34f6b5
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export function prepareEpochProcessState<T extends allForks.BeaconState>(state:
const currentEpoch = epochCtx.currentShuffling.epoch;
const prevEpoch = epochCtx.previousShuffling.epoch;
const nextEpoch = currentEpoch + 1;
const isNextEpochAltair = nextEpoch >= config.ALTAIR_FORK_EPOCH;
out.currentEpoch = currentEpoch;
out.prevEpoch = prevEpoch;

Expand Down Expand Up @@ -148,7 +149,7 @@ export function prepareEpochProcessState<T extends allForks.BeaconState>(state:

out.statuses.push(status);
out.indicesBounded.push([i, v.activationEpoch, v.exitEpoch]);
if (nextEpoch >= config.ALTAIR_FORK_EPOCH) {
if (isNextEpochAltair) {
if (isActiveValidator(v, nextEpoch)) {
out.nextEpochActiveValidatorIndices.push(i);
}
Expand Down

0 comments on commit d34f6b5

Please sign in to comment.