Skip to content

Commit

Permalink
enable parsing of payload_attributes events
Browse files Browse the repository at this point in the history
  • Loading branch information
draganm committed Sep 29, 2023
1 parent 813e947 commit 8858257
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions http/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

client "github.com/attestantio/go-eth2-client"
api "github.com/attestantio/go-eth2-client/api/v1"

Check failure on line 28 in http/events.go

View workflow job for this annotation

GitHub Actions / lint

ST1019: package "github.com/attestantio/go-eth2-client/api/v1" is being imported more than once (stylecheck)
v1 "github.com/attestantio/go-eth2-client/api/v1"

Check failure on line 29 in http/events.go

View workflow job for this annotation

GitHub Actions / lint

ST1019(related information): other import of "github.com/attestantio/go-eth2-client/api/v1" (stylecheck)
"github.com/attestantio/go-eth2-client/spec/altair"
"github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/pkg/errors"
Expand Down Expand Up @@ -159,6 +160,14 @@ func (s *Service) handleEvent(ctx context.Context, msg *sse.Event, handler clien
return
}
event.Data = contributionAndProofEvent
case "payload_attributes":
payloadAttributesEvent := &v1.PayloadAttributesEvent{}
err := json.Unmarshal(msg.Data, payloadAttributesEvent)
if err != nil {
log.Error().Err(err).RawJSON("data", msg.Data).Msg("Failed to parse payload attributes event")
return
}
event.Data = payloadAttributesEvent
case "":
// Used as keepalive. Ignore.
return
Expand Down

0 comments on commit 8858257

Please sign in to comment.