package sync import ( "context" "errors" "fmt" "github.com/gogo/protobuf/proto" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" ) // beaconAggregateProofSubscriber forwards the incoming validated aggregated attestation and proof to the // attestation pool for processing. func (r *Service) beaconAggregateProofSubscriber(ctx context.Context, msg proto.Message) error { a, ok := msg.(*ethpb.SignedAggregateAttestationAndProof) if !ok { return fmt.Errorf("message was not type *eth.SignedAggregateAttestationAndProof, type=%T", msg) } if a.Message.Aggregate == nil || a.Message.Aggregate.Data == nil { return errors.New("nil aggregate") } r.setAggregatorIndexSlotSeen(a.Message.Aggregate.Data.Slot, a.Message.AggregatorIndex) return r.attPool.SaveAggregatedAttestation(a.Message.Aggregate) }