prysm-pulse/beacon-chain/sync/subscriber_sync_contribution_proof.go
Raul Jordan 233171d17c
[Service Config Revamp] - Sync Service With Functional Options (#9859)
* sync config refactor

* rem

* rem

* testing

* gaz

* next

* fuzz

* build

* fuzz

* rev

* log

* cfg
2021-11-05 19:08:58 +00:00

27 lines
781 B
Go

package sync
import (
"context"
"errors"
"fmt"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"google.golang.org/protobuf/proto"
)
// syncContributionAndProofSubscriber forwards the incoming validated sync contributions and proof to the
// contribution pool for processing.
// skipcq: SCC-U1000
func (s *Service) syncContributionAndProofSubscriber(_ context.Context, msg proto.Message) error {
sContr, ok := msg.(*ethpb.SignedContributionAndProof)
if !ok {
return fmt.Errorf("message was not type *eth.SignedAggregateAttestationAndProof, type=%T", msg)
}
if sContr.Message == nil || sContr.Message.Contribution == nil {
return errors.New("nil contribution")
}
return s.cfg.syncCommsPool.SaveSyncCommitteeContribution(sContr.Message.Contribution)
}