Merge pull request #1513 from LeoHChen/remove_client_peer

[client] remove client peer support
pull/1519/head
Leo Chen 5 years ago committed by GitHub
commit 01a8d562e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      node/node.go
  2. 7
      node/node_handler.go
  3. 10
      node/service_setup.go

@ -106,10 +106,9 @@ type Node struct {
// Shard databases
shardChains shardchain.Collection
ClientPeer *p2p.Peer // The peer for the harmony tx generator client, used for leaders to return proof-of-accept
Client *client.Client // The presence of a client object means this node will also act as a client
SelfPeer p2p.Peer // TODO(minhdoan): it could be duplicated with Self below whose is Alok work.
BCPeers []p2p.Peer // list of Beacon Chain Peers. This is needed by all nodes.
Client *client.Client // The presence of a client object means this node will also act as a client
SelfPeer p2p.Peer // TODO(minhdoan): it could be duplicated with Self below whose is Alok work.
BCPeers []p2p.Peer // list of Beacon Chain Peers. This is needed by all nodes.
// TODO: Neighbors should store only neighbor nodes in the same shard
Neighbors sync.Map // All the neighbor nodes, key is the sha256 of Peer IP/Port, value is the p2p.Peer

@ -761,12 +761,7 @@ func (node *Node) pingMessageHandler(msgPayload []byte, sender libp2p_peer.ID) i
//node.host.AddIncomingPeer(*peer)
node.host.ConnectHostPeer(*peer)
if ping.Node.Role == proto_node.ClientRole {
utils.Logger().Info().
Str("Client", peer.String()).
Msg("Add Client Peer to Node")
node.ClientPeer = peer
} else {
if ping.Node.Role != proto_node.ClientRole {
node.AddPeers([]*p2p.Peer{peer})
utils.Logger().Info().
Str("Peer", peer.String()).

@ -60,16 +60,8 @@ func (node *Node) setupForNewNode() {
}
func (node *Node) setupForClientNode() {
nodeConfig, chanPeer := node.initNodeConfiguration()
// Register peer discovery service.
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, p2p.GroupIDBeacon, 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()))
}
node.serviceManager.RegisterService(service.NetworkInfo, networkinfo.New(node.host, p2p.GroupIDBeacon, nil, nil))
}
func (node *Node) setupForExplorerNode() {

Loading…
Cancel
Save