Skip to content

Commit

Permalink
Merge pull request #201 from attestantio/zero-blob-sidecars-ssz
Browse files Browse the repository at this point in the history
Return empty array of blob sidecards on valid but empty SSZ response.
  • Loading branch information
mcdee authored Feb 12, 2025
2 parents 161becd + e1610c0 commit c8d0b08
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions http/blobsidecars.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ func (s *Service) BlobSidecars(ctx context.Context,
func (*Service) blobSidecarsFromSSZ(res *httpResponse) (*api.Response[[]*deneb.BlobSidecar], error) {
response := &api.Response[[]*deneb.BlobSidecar]{}

if len(res.body) == 0 {
// This is a valid response when there are no blobs for the request.
response.Data = make([]*deneb.BlobSidecar, 0)
response.Metadata = make(map[string]any)

return response, nil
}

data := &api.BlobSidecars{}
if err := data.UnmarshalSSZ(res.body); err != nil {
return nil, errors.Join(errors.New("failed to decode blob sidecars"), err)
Expand Down

0 comments on commit c8d0b08

Please sign in to comment.