Skip to content

Commit

Permalink
Use chain.clock where possible (#3968)
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths authored May 4, 2022
1 parent 2d3571f commit 4295abb
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/lodestar/src/chain/blocks/verifyBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
computeStartSlotAtEpoch,
allForks,
bellatrix,
getCurrentSlot,
} from "@chainsafe/lodestar-beacon-state-transition";
import {toHexString} from "@chainsafe/ssz";
import {IForkChoice, IProtoBlock, ExecutionStatus} from "@chainsafe/lodestar-fork-choice";
Expand Down Expand Up @@ -227,14 +226,13 @@ export async function verifyBlockStateTransition(
const parentRoot = toHexString(block.message.parentRoot);
const parentBlock = chain.forkChoice.getBlockHex(parentRoot);
const justifiedBlock = chain.forkChoice.getJustifiedBlock();
const clockSlot = getCurrentSlot(chain.config, postState.genesisTime);

if (
!parentBlock ||
// Following condition is the !(Not) of the safe import condition
(parentBlock.executionStatus === ExecutionStatus.PreMerge &&
justifiedBlock.executionStatus === ExecutionStatus.PreMerge &&
block.message.slot + opts.safeSlotsToImportOptimistically > clockSlot)
block.message.slot + opts.safeSlotsToImportOptimistically > chain.clock.currentSlot)
) {
throw new BlockError(block, {
code: BlockErrorCode.EXECUTION_ENGINE_ERROR,
Expand Down

0 comments on commit 4295abb

Please sign in to comment.