|
|
|
@ -22,7 +22,7 @@ func (node *Node) setupForValidator() { |
|
|
|
|
// Register peer discovery service. No need to do staking for beacon chain node.
|
|
|
|
|
node.serviceManager.RegisterService(service.PeerDiscovery, discovery.New(node.host, nodeConfig, chanPeer, node.AddBeaconPeer)) |
|
|
|
|
// Register networkinfo service. "0" is the beacon shard ID
|
|
|
|
|
node.serviceManager.RegisterService(service.NetworkInfo, networkinfo.New(node.host, node.NodeConfig.GetShardGroupID(), chanPeer, nil)) |
|
|
|
|
node.serviceManager.RegisterService(service.NetworkInfo, networkinfo.MustNew(node.host, node.NodeConfig.GetShardGroupID(), chanPeer, nil)) |
|
|
|
|
// Register consensus service.
|
|
|
|
|
node.serviceManager.RegisterService(service.Consensus, consensus.New(node.BlockChannel, node.Consensus, node.startConsensus)) |
|
|
|
|
// Register new block service.
|
|
|
|
@ -51,7 +51,7 @@ func (node *Node) setupForNewNode() { |
|
|
|
|
// Register peer discovery service. "0" is the beacon shard ID
|
|
|
|
|
node.serviceManager.RegisterService(service.PeerDiscovery, discovery.New(node.host, nodeConfig, chanPeer, node.AddBeaconPeer)) |
|
|
|
|
// Register networkinfo service. "0" is the beacon shard ID
|
|
|
|
|
node.serviceManager.RegisterService(service.NetworkInfo, networkinfo.New(node.host, node.NodeConfig.GetBeaconGroupID(), chanPeer, nil)) |
|
|
|
|
node.serviceManager.RegisterService(service.NetworkInfo, networkinfo.MustNew(node.host, node.NodeConfig.GetBeaconGroupID(), chanPeer, nil)) |
|
|
|
|
// Register new metrics service
|
|
|
|
|
if node.NodeConfig.GetMetricsFlag() { |
|
|
|
|
node.serviceManager.RegisterService(service.Metrics, metrics.New(&node.SelfPeer, node.NodeConfig.ConsensusPubKey.SerializeToHexStr(), node.NodeConfig.GetPushgatewayIP(), node.NodeConfig.GetPushgatewayPort())) |
|
|
|
@ -60,7 +60,7 @@ func (node *Node) setupForNewNode() { |
|
|
|
|
|
|
|
|
|
func (node *Node) setupForClientNode() { |
|
|
|
|
// Register networkinfo service. "0" is the beacon shard ID
|
|
|
|
|
node.serviceManager.RegisterService(service.NetworkInfo, networkinfo.New(node.host, p2p.GroupIDBeacon, nil, nil)) |
|
|
|
|
node.serviceManager.RegisterService(service.NetworkInfo, networkinfo.MustNew(node.host, p2p.GroupIDBeacon, nil, nil)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (node *Node) setupForExplorerNode() { |
|
|
|
@ -69,7 +69,7 @@ func (node *Node) setupForExplorerNode() { |
|
|
|
|
// Register peer discovery service.
|
|
|
|
|
node.serviceManager.RegisterService(service.PeerDiscovery, discovery.New(node.host, nodeConfig, chanPeer, nil)) |
|
|
|
|
// Register networkinfo service.
|
|
|
|
|
node.serviceManager.RegisterService(service.NetworkInfo, networkinfo.New(node.host, node.NodeConfig.GetShardGroupID(), chanPeer, nil)) |
|
|
|
|
node.serviceManager.RegisterService(service.NetworkInfo, networkinfo.MustNew(node.host, node.NodeConfig.GetShardGroupID(), chanPeer, nil)) |
|
|
|
|
// Register explorer service.
|
|
|
|
|
node.serviceManager.RegisterService(service.SupportExplorer, explorer.New(&node.SelfPeer, node.NodeConfig.GetShardID(), node.Consensus.GetNodeIDs, node.GetBalanceOfAddress)) |
|
|
|
|
// Register explorer service.
|
|
|
|
|