From f143029380ca42407c5b1e8c78143929424c294e Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Tue, 5 Dec 2023 10:20:53 +1000 Subject: [PATCH] feat: Check for finality every 3m --- pkg/beacon/default.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/beacon/default.go b/pkg/beacon/default.go index 52ca291..e8dceb6 100644 --- a/pkg/beacon/default.go +++ b/pkg/beacon/default.go @@ -126,6 +126,16 @@ func (d *Default) startCrons(ctx context.Context) error { return err } + if _, err := s.Every("3m").Do(func() { + for _, node := range d.nodes.Healthy(ctx) { + if _, err := node.Beacon.FetchFinality(ctx, "head"); err != nil { + d.log.WithError(err).Error("Failed to fetch finality when polling") + } + } + }); err != nil { + return err + } + go func() { if err := d.startGenesisLoop(ctx); err != nil { d.log.WithError(err).Fatal("Failed to start genesis loop")