Skip to content

Commit

Permalink
Handle situaiton where relay has no suitable bid.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Nov 8, 2024
1 parent e54c7ff commit aa61564
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions http/builderbid.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"errors"
"fmt"
"net/http"

client "github.com/attestantio/go-builder-client"
"github.com/attestantio/go-builder-client/api"
Expand Down Expand Up @@ -71,7 +72,16 @@ func (s *Service) BuilderBid(ctx context.Context,
return nil, errors.Join(errors.New("failed to request execution payload header"), err)
}

if httpResponse.statusCode == http.StatusNoContent {
// This is a valid response when the relay has no suitable bid.
return &api.Response[*spec.VersionedSignedBuilderBid]{
Data: nil,
Metadata: metadataFromHeaders(httpResponse.headers),
}, nil
}

var response *api.Response[*spec.VersionedSignedBuilderBid]

switch httpResponse.contentType {
case ContentTypeSSZ:
response, err = s.signedBuilderBidFromSSZ(ctx, httpResponse)
Expand Down

0 comments on commit aa61564

Please sign in to comment.