Skip to content

Commit

Permalink
feat: Subscribe to node events
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Feb 20, 2024
1 parent 5a181c6 commit 3f4b04d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/beacon/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (d *Default) Start(ctx context.Context) error {

node.Beacon.OnReady(ctx, func(ctx context.Context, _ *beacon.ReadyEvent) error {
node.Beacon.Wallclock().OnEpochChanged(func(epoch ethwallclock.Epoch) {
time.Sleep(time.Second * 15)
time.Sleep(time.Second * 5)

if _, err := node.Beacon.FetchFinality(ctx, "head"); err != nil {
logCtx.WithError(err).Error("Failed to fetch finality after epoch transition")
Expand All @@ -164,6 +164,10 @@ func (d *Default) Start(ctx context.Context) error {
if err := d.checkFinality(ctx); err != nil {
logCtx.WithError(err).Error("Failed to check finality")
}

if err := d.checkForNewServingCheckpoint(ctx); err != nil {
logCtx.WithError(err).Error("Failed to check for new serving checkpoint after epoch change")
}
})

return nil
Expand Down

0 comments on commit 3f4b04d

Please sign in to comment.