diff --git a/node/node.go b/node/node.go index d748c4646..6aa6cbcce 100644 --- a/node/node.go +++ b/node/node.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 diff --git a/node/node_handler.go b/node/node_handler.go index 330e8279b..b0ddcf1ce 100644 --- a/node/node_handler.go +++ b/node/node_handler.go @@ -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()). diff --git a/node/service_setup.go b/node/service_setup.go index 560e03f55..1a82cd959 100644 --- a/node/service_setup.go +++ b/node/service_setup.go @@ -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() {