add service to regular shard

Signed-off-by: Leo Chen <leo@harmony.one>
pull/465/head
Leo Chen 6 years ago
parent 844bb37577
commit 81877a149a
  1. 28
      node/node.go

@ -704,6 +704,20 @@ func decodeFuncSign(data []byte) string {
} }
func (node *Node) setupForShardLeader() { func (node *Node) setupForShardLeader() {
chanPeer := make(chan p2p.Peer)
var err error
node.groupReceiver, err = node.host.GroupReceiver(p2p.GroupIDBeacon)
if err != nil {
utils.GetLogInstance().Error("create group receiver error", "msg", err)
return
}
// Register peer discovery service. "0" is the beacon shard ID. No need to do staking for beacon chain node.
node.serviceManager.RegisterService(service_manager.PeerDiscovery, discovery.New(node.host, "0", chanPeer, nil))
// Register networkinfo service. "0" is the beacon shard ID
node.serviceManager.RegisterService(service_manager.NetworkInfo, networkinfo.New(node.host, "0", chanPeer))
// Register explorer service. // Register explorer service.
node.serviceManager.RegisterService(service_manager.SupportExplorer, explorer.New(&node.SelfPeer)) node.serviceManager.RegisterService(service_manager.SupportExplorer, explorer.New(&node.SelfPeer))
// Register consensus service. // Register consensus service.
@ -717,6 +731,20 @@ func (node *Node) setupForShardLeader() {
} }
func (node *Node) setupForShardValidator() { func (node *Node) setupForShardValidator() {
chanPeer := make(chan p2p.Peer)
var err error
node.groupReceiver, err = node.host.GroupReceiver(p2p.GroupIDBeacon)
if err != nil {
utils.GetLogInstance().Error("create group receiver error", "msg", err)
return
}
// Register peer discovery service. "0" is the beacon shard ID. No need to do staking for beacon chain node.
node.serviceManager.RegisterService(service_manager.PeerDiscovery, discovery.New(node.host, "0", chanPeer, nil))
// Register networkinfo service. "0" is the beacon shard ID
node.serviceManager.RegisterService(service_manager.NetworkInfo, networkinfo.New(node.host, "0", chanPeer))
} }
func (node *Node) setupForBeaconLeader() { func (node *Node) setupForBeaconLeader() {

Loading…
Cancel
Save