mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-26 21:27:19 +00:00
7cc32c4dda
* remove unused code * remove defer use in loop * Remove unused methods and constants * gofmt and gaz * nilness check * remove unused args * Add TODO for refactoring subscribeWithBase to remove unused arg. It seems too involved to include in this sweeping PR. https://github.com/prysmaticlabs/prysm/issues/7437 * replace empty slice declaration * Remove unnecessary type conversions * remove redundant type declaration * rename receivers to be consistent * Remove bootnode query tool. It is now obsolete by discv5 * Remove relay node. It is no longer used or supported * Revert "Remove relay node. It is no longer used or supported" This reverts commit 4bd7717334dad85ef4766ed9bc4da711fb5fa810. * Delete unused test directory * Delete unsupported gcp startup script * Delete old k8s script * build fixes * fix build * go mod tidy * revert slasher/db/kv/block_header.go * fix build * remove redundant nil check * combine func args Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
43 lines
1.5 KiB
Go
43 lines
1.5 KiB
Go
package sync
|
||
|
||
import (
|
||
"context"
|
||
"errors"
|
||
"fmt"
|
||
|
||
"github.com/gogo/protobuf/proto"
|
||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||
"github.com/prysmaticlabs/prysm/beacon-chain/core/feed"
|
||
"github.com/prysmaticlabs/prysm/beacon-chain/core/feed/operation"
|
||
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||
)
|
||
|
||
// beaconAggregateProofSubscriber forwards the incoming validated aggregated attestation and proof to the
|
||
// attestation pool for processing.
|
||
func (s *Service) beaconAggregateProofSubscriber(_ 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")
|
||
}
|
||
|
||
// Broadcast the aggregated attestation on a feed to notify other services in the beacon node
|
||
// of a received aggregated attestation.
|
||
s.attestationNotifier.OperationFeed().Send(&feed.Event{
|
||
Type: operation.AggregatedAttReceived,
|
||
Data: &operation.AggregatedAttReceivedData{
|
||
Attestation: a.Message,
|
||
},
|
||
})
|
||
|
||
// An unaggregated attestation can make it here. It’s valid, the aggregator it just itself, although it means poor performance for the subnet.
|
||
if !helpers.IsAggregated(a.Message.Aggregate) {
|
||
return s.attPool.SaveUnaggregatedAttestation(a.Message.Aggregate)
|
||
}
|
||
|
||
return s.attPool.SaveAggregatedAttestation(a.Message.Aggregate)
|
||
}
|