From b18b12dd303d02b0cbba26782b77d3018c02c44e Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 6 Dec 2024 12:10:18 +1000 Subject: [PATCH] refactor: Update variable name for clarity --- .../iterator/backfilling_checkpoint_iterator.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkg/cannon/iterator/backfilling_checkpoint_iterator.go b/pkg/cannon/iterator/backfilling_checkpoint_iterator.go index 5bc1f278..c2144679 100644 --- a/pkg/cannon/iterator/backfilling_checkpoint_iterator.go +++ b/pkg/cannon/iterator/backfilling_checkpoint_iterator.go @@ -215,12 +215,18 @@ func (c *BackfillingCheckpoint) Next(ctx context.Context) (rsp *BackFillingCheck } } - forkEpoch, errr := c.beaconNode.Metadata().Spec.ForkEpochs.GetByName(c.activationFork.String()) - if errr != nil { - return nil, errors.Wrap(errr, fmt.Sprintf("failed to get epoch for fork: %s", c.activationFork)) + targetEpoch := phase0.Epoch(0) + + if c.activationFork != spec.DataVersionPhase0 { + forkEpoch, errr := c.beaconNode.Metadata().Spec.ForkEpochs.GetByName(c.activationFork.String()) + if errr != nil { + return nil, errors.Wrap(errr, fmt.Sprintf("failed to get epoch for fork: %s", c.activationFork)) + } + + targetEpoch = forkEpoch.Epoch } - if checkpoint.Epoch < forkEpoch.Epoch { + if checkpoint.Epoch < targetEpoch { // The current finalized checkpoint is before the activation of this cannon, so we should sleep until the next epoch. epoch := c.wallclock.Epochs().Current()