github.com/prysmaticlabs/prysm@v1.4.4/beacon-chain/sync/subscriber_beacon_aggregate_proof.go (about) 1 package sync 2 3 import ( 4 "context" 5 "errors" 6 "fmt" 7 8 "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" 9 ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1" 10 "google.golang.org/protobuf/proto" 11 ) 12 13 // beaconAggregateProofSubscriber forwards the incoming validated aggregated attestation and proof to the 14 // attestation pool for processing. 15 func (s *Service) beaconAggregateProofSubscriber(_ context.Context, msg proto.Message) error { 16 a, ok := msg.(*ethpb.SignedAggregateAttestationAndProof) 17 if !ok { 18 return fmt.Errorf("message was not type *eth.SignedAggregateAttestationAndProof, type=%T", msg) 19 } 20 21 if a.Message.Aggregate == nil || a.Message.Aggregate.Data == nil { 22 return errors.New("nil aggregate") 23 } 24 25 // An unaggregated attestation can make it here. It’s valid, the aggregator it just itself, although it means poor performance for the subnet. 26 if !helpers.IsAggregated(a.Message.Aggregate) { 27 return s.cfg.AttPool.SaveUnaggregatedAttestation(a.Message.Aggregate) 28 } 29 30 return s.cfg.AttPool.SaveAggregatedAttestation(a.Message.Aggregate) 31 }