2020-09-03 23:25:56 +00:00
|
|
|
package rpc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
ptypes "github.com/gogo/protobuf/types"
|
|
|
|
pb "github.com/prysmaticlabs/prysm/proto/validator/accounts/v2"
|
|
|
|
)
|
|
|
|
|
2020-09-08 20:02:12 +00:00
|
|
|
// GetBeaconNodeConnection retrieves the current beacon node connection
|
|
|
|
// information, as well as its sync status.
|
2020-09-03 23:25:56 +00:00
|
|
|
func (s *Server) GetBeaconNodeConnection(ctx context.Context, _ *ptypes.Empty) (*pb.NodeConnectionResponse, error) {
|
|
|
|
syncStatus, err := s.syncChecker.Syncing(ctx)
|
2020-09-08 20:02:12 +00:00
|
|
|
if err != nil || s.validatorService.Status() != nil {
|
|
|
|
return &pb.NodeConnectionResponse{
|
|
|
|
BeaconNodeEndpoint: s.nodeGatewayEndpoint,
|
|
|
|
Connected: false,
|
|
|
|
Syncing: false,
|
|
|
|
}, nil
|
2020-09-03 23:25:56 +00:00
|
|
|
}
|
|
|
|
return &pb.NodeConnectionResponse{
|
2020-09-04 19:03:18 +00:00
|
|
|
BeaconNodeEndpoint: s.nodeGatewayEndpoint,
|
2020-09-08 20:02:12 +00:00
|
|
|
Connected: true,
|
2020-09-03 23:25:56 +00:00
|
|
|
Syncing: syncStatus,
|
|
|
|
}, nil
|
|
|
|
}
|