From 8858257e3a17ae291671bea4e9b2e27fe377ed3d Mon Sep 17 00:00:00 2001 From: Dragan Milic Date: Fri, 29 Sep 2023 15:02:05 +0200 Subject: [PATCH] enable parsing of payload_attributes events --- http/events.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/http/events.go b/http/events.go index d72da7ff..9de7534f 100644 --- a/http/events.go +++ b/http/events.go @@ -26,6 +26,7 @@ import ( client "github.com/attestantio/go-eth2-client" api "github.com/attestantio/go-eth2-client/api/v1" + v1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec/altair" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" @@ -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