2022-11-26 19:07:05 +00:00
|
|
|
package sync
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/pkg/errors"
|
2023-03-17 18:52:56 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed"
|
|
|
|
opfeed "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed/operation"
|
|
|
|
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
2022-11-26 19:07:05 +00:00
|
|
|
"google.golang.org/protobuf/proto"
|
|
|
|
)
|
|
|
|
|
2023-01-17 09:45:20 +00:00
|
|
|
func (s *Service) blsToExecutionChangeSubscriber(_ context.Context, msg proto.Message) error {
|
2022-11-26 19:07:05 +00:00
|
|
|
blsMsg, ok := msg.(*ethpb.SignedBLSToExecutionChange)
|
|
|
|
if !ok {
|
|
|
|
return errors.Errorf("incorrect type of message received, wanted %T but got %T", ðpb.SignedBLSToExecutionChange{}, msg)
|
|
|
|
}
|
2023-01-17 09:45:20 +00:00
|
|
|
s.cfg.operationNotifier.OperationFeed().Send(&feed.Event{
|
|
|
|
Type: opfeed.BLSToExecutionChangeReceived,
|
|
|
|
Data: &opfeed.BLSToExecutionChangeReceivedData{
|
|
|
|
Change: blsMsg,
|
|
|
|
},
|
|
|
|
})
|
2022-11-26 19:07:05 +00:00
|
|
|
s.cfg.blsToExecPool.InsertBLSToExecChange(blsMsg)
|
|
|
|
return nil
|
|
|
|
}
|