Skip to content

Commit

Permalink
Merge pull request #18 from samcm/fix/bad-consensus-block
Browse files Browse the repository at this point in the history
fix(consensus): Fix a panic if a bad consensus block is fetched
  • Loading branch information
samcm committed May 19, 2022
2 parents 738afd9 + 125062d commit 0ce1c61
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/exporter/consensus/jobs/general.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,18 @@ func (g *General) GetBeaconSlot(ctx context.Context, identifier string) error {
return err
}

if block == nil {
return errors.New("block is nil")
}

if block.Header == nil {
return errors.New("block header is nil")
}

if block.Header.Message == nil {
return errors.New("block header message is nil")
}

g.ObserveSlot(identifier, uint64(block.Header.Message.Slot))

return nil
Expand Down

0 comments on commit 0ce1c61

Please sign in to comment.