|
|
|
@ -704,6 +704,20 @@ func decodeFuncSign(data []byte) string { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
node.serviceManager.RegisterService(service_manager.SupportExplorer, explorer.New(&node.SelfPeer)) |
|
|
|
|
// Register consensus service.
|
|
|
|
@ -717,6 +731,20 @@ func (node *Node) setupForShardLeader() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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() { |
|
|
|
|