Skip to content

Commit

Permalink
Swap Health check to use Syncing endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Sep 2, 2022
1 parent b6ce124 commit 7f50a3e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,12 @@ func (n *node) fetchNodeVersion(ctx context.Context) error {
}

func (n *node) fetchHealthy(ctx context.Context) error {
provider, isProvider := n.client.(eth2client.NodeVersionProvider)
provider, isProvider := n.client.(eth2client.NodeSyncingProvider)
if !isProvider {
return errors.New("client does not implement eth2client.NodeVersionProvider")
return errors.New("client does not implement eth2client.NodeSyncingProvider")
}

_, err := provider.NodeVersion(ctx)
_, err := provider.NodeSyncing(ctx)
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions status.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ package beacon
import v1 "github.com/attestantio/go-eth2-client/api/v1"

type Status struct {
healthy *Health
health *Health
networkID uint64
syncstate *v1.SyncState
}

func NewStatus(successThreshold, failThreshold int) *Status {
return &Status{
healthy: NewHealth(successThreshold, failThreshold),
health: NewHealth(successThreshold, failThreshold),
networkID: 0,
syncstate: nil,
}
}

func (s *Status) Healthy() bool {
return s.healthy.Healthy()
return s.health.Healthy()
}

func (s *Status) Health() *Health {
return s.healthy
return s.health
}

func (s *Status) NetworkID() uint64 {
Expand Down

0 comments on commit 7f50a3e

Please sign in to comment.