Skip to content

Commit

Permalink
Fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
alrevuelta committed Feb 2, 2024
1 parent 5a25a9b commit 2c858bc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions oracle/onchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,14 @@ func (o *Onchain) GetConsensusBlockAtSlot(slot uint64, opts ...retry.Option) (*s
signedBeaconBlock, err = o.ConsensusClient.SignedBeaconBlock(context.Background(), &api.SignedBeaconBlockOpts{
Block: slotStr, // TODO: Says block but its slot in reality
})
// Its not possible to detect if the block was missed or if the block doesn't exist in the chain
// GET failed with status 404: {"code":404,"message":"NOT_FOUND: beacon block at slot 7408169","stacktraces":[]}
// To keep compatibility after go-eth2-client changes, we consider that a missed block is nil
if strings.Contains(err.Error(), "404") {
return nil
}
if err != nil {
// Its not possible to detect if the block was missed or if the block doesn't exist in the chain
// GET failed with status 404: {"code":404,"message":"NOT_FOUND: beacon block at slot 7408169","stacktraces":[]}
// To keep compatibility after go-eth2-client changes, we consider that a missed block is nil
if strings.Contains(err.Error(), "404") {
log.Info("error contains;: ", err.Error())
return nil
}
log.Warn("Failed attempt to fetch block at slot ", slotStr, ": ", err.Error(), " Retrying...")
return errors.New("Error fetching block at slot " + slotStr + ": " + err.Error())
}
Expand Down

0 comments on commit 2c858bc

Please sign in to comment.