2021-09-09 03:25:02 +00:00
|
|
|
package sync
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
|
2023-03-17 18:52:56 +00:00
|
|
|
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
2021-09-09 03:25:02 +00:00
|
|
|
"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 {
|
2022-11-07 16:44:38 +00:00
|
|
|
return fmt.Errorf("message was not type *ethpb.SignedContributionAndProof, type=%T", msg)
|
2021-09-09 03:25:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if sContr.Message == nil || sContr.Message.Contribution == nil {
|
|
|
|
return errors.New("nil contribution")
|
|
|
|
}
|
|
|
|
|
2021-11-05 19:08:58 +00:00
|
|
|
return s.cfg.syncCommsPool.SaveSyncCommitteeContribution(sContr.Message.Contribution)
|
2021-09-09 03:25:02 +00:00
|
|
|
}
|