[pingpong] skip addPeer for ping message handler

Validator will receive peer info from pong message
sent by the leader, no need for validator to handle ping message to add
peer's pubkeys

Signed-off-by: Leo Chen <leo@harmony.one>
pull/593/head
Leo Chen 6 years ago
parent a9ebca5d53
commit e53d4780e9
  1. 7
      node/node_handler.go

@ -388,9 +388,10 @@ func (node *Node) pingMessageHandler(msgPayload []byte, sender string) int {
return 0
}
// Add to Node's peer list anyway
utils.GetLogInstance().Info("Add Peer to Node", "Node", node.Consensus.GetNodeID(), "Pear", peer)
node.AddPeers([]*p2p.Peer{peer})
if node.NodeConfig.IsLeader() {
utils.GetLogInstance().Info("Add Peer to Node", "Node", node.Consensus.GetNodeID(), "Pear", peer)
node.AddPeers([]*p2p.Peer{peer})
}
return 1
}

Loading…
Cancel
Save