getProtoTopology has been replaced by PeersToProto

This helps us remove redundant code across node and handler
This commit is contained in:
Milos Gajdos
2019-09-11 23:56:57 +01:00
parent fa4ff8921e
commit 77c6c9781b
4 changed files with 65 additions and 96 deletions

View File

@@ -276,7 +276,7 @@ func (n *network) processNetChan(client transport.Client, listener tunnel.Listen
}
n.Unlock()
// get all the node peers down to MaxDepth encoded in protobuf
msg := n.node.getProtoTopology(MaxDepth)
msg := PeersToProto(n.node, n.Peers(), MaxDepth)
// advertise yourself to the network
if err := n.sendMsg("peer", msg, NetworkChannel); err != nil {
log.Debugf("Network failed to advertise peers: %v", err)
@@ -393,7 +393,7 @@ func (n *network) announce(client transport.Client) {
case <-n.closed:
return
case <-announce.C:
msg := n.node.getProtoTopology(MaxDepth)
msg := PeersToProto(n.node, n.Peers(), MaxDepth)
// advertise yourself to the network
if err := n.sendMsg("peer", msg, NetworkChannel); err != nil {
log.Debugf("Network failed to advertise peers: %v", err)