mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 11:57:18 +00:00
96401e734e
* Implement `bls_to_execution_change` API event (cherry picked from commit 1c8a2c580b3664e1238380138dc65c30e238cb11) (cherry picked from commit aabcaac6191cb25048be301ab62e8b391f561d6f) * missing event code (cherry picked from commit daa4fd2b72aeaff16196faa46dca6efd289d9934) * Update beacon-chain/core/feed/operation/events.go Co-authored-by: Nishant Das <nishdas93@gmail.com>
27 lines
835 B
Go
27 lines
835 B
Go
package sync
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/pkg/errors"
|
|
"github.com/prysmaticlabs/prysm/v3/beacon-chain/core/feed"
|
|
opfeed "github.com/prysmaticlabs/prysm/v3/beacon-chain/core/feed/operation"
|
|
ethpb "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1"
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
func (s *Service) blsToExecutionChangeSubscriber(_ context.Context, msg proto.Message) error {
|
|
blsMsg, ok := msg.(*ethpb.SignedBLSToExecutionChange)
|
|
if !ok {
|
|
return errors.Errorf("incorrect type of message received, wanted %T but got %T", ðpb.SignedBLSToExecutionChange{}, msg)
|
|
}
|
|
s.cfg.operationNotifier.OperationFeed().Send(&feed.Event{
|
|
Type: opfeed.BLSToExecutionChangeReceived,
|
|
Data: &opfeed.BLSToExecutionChangeReceivedData{
|
|
Change: blsMsg,
|
|
},
|
|
})
|
|
s.cfg.blsToExecPool.InsertBLSToExecChange(blsMsg)
|
|
return nil
|
|
}
|