2023-05-18 16:13:18 +00:00
|
|
|
package sync
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
|
2023-09-22 21:54:10 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed"
|
|
|
|
opfeed "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed/operation"
|
2023-05-18 16:13:18 +00:00
|
|
|
eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
|
|
|
"google.golang.org/protobuf/proto"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (s *Service) blobSubscriber(ctx context.Context, msg proto.Message) error {
|
|
|
|
b, ok := msg.(*eth.SignedBlobSidecar)
|
|
|
|
if !ok {
|
|
|
|
return fmt.Errorf("message was not type *eth.SignedBlobSidecar, type=%T", msg)
|
|
|
|
}
|
|
|
|
|
|
|
|
s.setSeenBlobIndex(b.Message.Blob, b.Message.Index)
|
|
|
|
|
2023-09-28 21:05:23 +00:00
|
|
|
if err := s.cfg.chain.ReceiveBlob(ctx, b.Message); err != nil {
|
2023-08-14 19:18:29 +00:00
|
|
|
return err
|
|
|
|
}
|
2023-05-18 16:13:18 +00:00
|
|
|
|
2023-09-22 21:54:10 +00:00
|
|
|
s.cfg.operationNotifier.OperationFeed().Send(&feed.Event{
|
|
|
|
Type: opfeed.BlobSidecarReceived,
|
|
|
|
Data: &opfeed.BlobSidecarReceivedData{
|
|
|
|
Blob: b,
|
|
|
|
},
|
|
|
|
})
|
2023-05-18 16:13:18 +00:00
|
|
|
return nil
|
|
|
|
}
|