mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 13:28:01 -05:00
Validator Client Fix (#254)
This commit is contained in:
@@ -179,9 +179,15 @@ func (s *ShardEthereum) registerAttesterService() error {
|
||||
return err
|
||||
}
|
||||
|
||||
var rpcService *rpcclient.Service
|
||||
if err := s.services.FetchService(&rpcService); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
att := attester.NewAttester(context.TODO(), &attester.Config{
|
||||
Assigner: beaconService,
|
||||
AssignmentBuf: 100,
|
||||
Client: rpcService,
|
||||
})
|
||||
return s.services.RegisterService(att)
|
||||
}
|
||||
|
||||
@@ -91,3 +91,11 @@ func (s *Service) BeaconServiceClient() pb.BeaconServiceClient {
|
||||
func (s *Service) ProposerServiceClient() pb.ProposerServiceClient {
|
||||
return pb.NewProposerServiceClient(s.conn)
|
||||
}
|
||||
|
||||
// AttesterServiceClient initializes a new attester gRPC service using
|
||||
// an underlying connection object.
|
||||
// This wrapper is important because the underlying gRPC connection is
|
||||
// only defined after the service .Start() function is called.
|
||||
func (s *Service) AttesterServiceClient() pb.AttesterServiceClient {
|
||||
return pb.NewAttesterServiceClient(s.conn)
|
||||
}
|
||||
|
||||
@@ -52,3 +52,31 @@ func TestBeaconServiceClient(t *testing.T) {
|
||||
t.Error("Beacon service client function does not implement interface")
|
||||
}
|
||||
}
|
||||
|
||||
func TestProposerServiceClient(t *testing.T) {
|
||||
rpcClientService := NewRPCClient(
|
||||
context.Background(),
|
||||
&Config{
|
||||
Endpoint: "merkle tries",
|
||||
},
|
||||
)
|
||||
rpcClientService.conn = nil
|
||||
client := rpcClientService.ProposerServiceClient()
|
||||
if _, ok := client.(pb.ProposerServiceClient); !ok {
|
||||
t.Error("Beacon service client function does not implement interface")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAttesterServiceClient(t *testing.T) {
|
||||
rpcClientService := NewRPCClient(
|
||||
context.Background(),
|
||||
&Config{
|
||||
Endpoint: "merkle tries",
|
||||
},
|
||||
)
|
||||
rpcClientService.conn = nil
|
||||
client := rpcClientService.AttesterServiceClient()
|
||||
if _, ok := client.(pb.AttesterServiceClient); !ok {
|
||||
t.Error("Beacon service client function does not implement interface")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user