Skip to content

Commit

Permalink
fix(sentry): capture finalized checkpoint events
Browse files Browse the repository at this point in the history
  • Loading branch information
Savid committed Aug 24, 2023
1 parent fb25eae commit 72c71f6
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions pkg/sentry/sentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,35 @@ func (s *Sentry) Start(ctx context.Context) error {
return s.handleNewDecoratedEvent(ctx, decoratedEvent)
})

s.beacon.Node().OnFinalizedCheckpoint(ctx, func(ctx context.Context, finalizedCheckpoint *eth2v1.FinalizedCheckpointEvent) error {
s.log.WithField("finalized_checkpoint", finalizedCheckpoint).Debug("Finalized checkpoint")

now := time.Now().Add(s.clockDrift)

meta, err := s.createNewClientMeta(ctx)
if err != nil {
return err
}

event := v1.NewEventsFinalizedCheckpoint(s.log, finalizedCheckpoint, now, s.beacon, s.duplicateCache.BeaconETHV1EventsFinalizedCheckpoint, meta)

ignore, err := event.ShouldIgnore(ctx)
if err != nil {
return err
}

if ignore {
return nil
}

decoratedEvent, err := event.Decorate(ctx)
if err != nil {
return err
}

return s.handleNewDecoratedEvent(ctx, decoratedEvent)
})

if err := s.startForkChoiceSchedule(ctx); err != nil {
return err
}
Expand Down

0 comments on commit 72c71f6

Please sign in to comment.