mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
d169b490fa
* update rpc/beacon * more fixes to beacon-chain/rpc * update beacon-chain/sync * Merge refs/heads/master into fix-ineffectual-assignments * updates beacon-chain/p2p * Merge branch 'fix-ineffectual-assignments' of github.com:prysmaticlabs/prysm into fix-ineffectual-assignments * update beacon-chain/* * fix imports * update beacon-chain/blockchain * more updates * Merge refs/heads/master into fix-ineffectual-assignments * Merge branch 'master' into fix-ineffectual-assignments * Merge refs/heads/master into fix-ineffectual-assignments * next round of updated * Merge branch 'fix-ineffectual-assignments' of github.com:prysmaticlabs/prysm into fix-ineffectual-assignments * wrap up remaining items
35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
package rpc
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
ptypes "github.com/gogo/protobuf/types"
|
|
pb "github.com/prysmaticlabs/prysm/proto/validator/accounts/v2"
|
|
)
|
|
|
|
// GetBeaconNodeConnection retrieves the current beacon node connection
|
|
// information, as well as its sync status.
|
|
func (s *Server) GetBeaconNodeConnection(ctx context.Context, _ *ptypes.Empty) (*pb.NodeConnectionResponse, error) {
|
|
syncStatus, err := s.syncChecker.Syncing(ctx)
|
|
if err != nil || s.validatorService.Status() != nil {
|
|
return &pb.NodeConnectionResponse{
|
|
GenesisTime: 0,
|
|
BeaconNodeEndpoint: s.nodeGatewayEndpoint,
|
|
Connected: false,
|
|
Syncing: false,
|
|
}, nil
|
|
}
|
|
genesis, err := s.genesisFetcher.GenesisInfo(ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &pb.NodeConnectionResponse{
|
|
GenesisTime: uint64(time.Unix(genesis.GenesisTime.Seconds, 0).Unix()),
|
|
DepositContractAddress: genesis.DepositContractAddress,
|
|
BeaconNodeEndpoint: s.nodeGatewayEndpoint,
|
|
Connected: true,
|
|
Syncing: syncStatus,
|
|
}, nil
|
|
}
|