Skip to content

Commit

Permalink
Calculate epoch from unmodded slot
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Apr 9, 2024
1 parent 98ab107 commit 2b0025a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/beacon-node/src/api/impl/beacon/blocks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,10 @@ export function getBeaconBlockApi({

if (slot < head.slot && head.slot <= slot + SLOTS_PER_HISTORICAL_ROOT) {
const state = chain.getHeadState();
const rootSlot = slot % SLOTS_PER_HISTORICAL_ROOT;
return {
executionOptimistic: isOptimisticBlock(head),
finalized: computeEpochAtSlot(rootSlot) <= chain.forkChoice.getFinalizedCheckpoint().epoch,
data: {root: state.blockRoots.get(rootSlot)},
finalized: computeEpochAtSlot(slot) <= chain.forkChoice.getFinalizedCheckpoint().epoch,
data: {root: state.blockRoots.get(slot % SLOTS_PER_HISTORICAL_ROOT)},
};
}
} else if (blockId === "head") {
Expand Down

0 comments on commit 2b0025a

Please sign in to comment.