mirror of https://github.com/waku-org/nwaku.git
Maybe connect to multiple peers
Now connnectedpeers is (divide by two?): 0/8/7/6/5/4. Progress?
This commit is contained in:
parent
c5fa3543ff
commit
a8e791ab8c
|
@ -41,7 +41,7 @@ proc initNodeCmd(shift: int, staticNodes: seq[string] = @[], master = false, lab
|
|||
address = "/ip4/127.0.0.1/tcp/" & $port
|
||||
hostAddress = MultiAddress.init(address)
|
||||
|
||||
echo "ADDRESS", address
|
||||
info "Address", address
|
||||
# TODO: Need to port shift
|
||||
peerInfo.addrs.add(hostAddress)
|
||||
let id = peerInfo.id
|
||||
|
|
|
@ -51,19 +51,13 @@ proc dialPeer(p: WakuProto, address: string) {.async.} =
|
|||
# Isn't there just one p instance? Why connected here?
|
||||
p.connected = true
|
||||
|
||||
# TODO: Connect to multiple static nodes
|
||||
proc connectToNodes(p: WakuProto, nodes: openArray[string]) =
|
||||
let peerInfoStr = nodes[0]
|
||||
info "connectToNodes", node = peerInfoStr
|
||||
|
||||
# XXX: Why is ipfs being replaced by p2p here?
|
||||
# Whats difference here? We don't have Whisper enodes etc
|
||||
discard dialPeer(p, peerInfoStr)
|
||||
# for nodeId in nodes:
|
||||
# info "connectToNodes nodeid", nodeId
|
||||
# # TODO: something more user friendly than an assert
|
||||
for nodeId in nodes:
|
||||
info "connectToNodes", node = nodeId
|
||||
# XXX: This seems...brittle
|
||||
discard dialPeer(p, nodeId)
|
||||
# Waku 1
|
||||
# let whisperENode = ENode.fromString(nodeId).expect("correct node")
|
||||
#
|
||||
# traceAsyncErrors node.peerPool.connectToNode(newNode(whisperENode))
|
||||
|
||||
# NOTE: Looks almost identical to beacon_chain/eth2_network.nim
|
||||
|
|
Loading…
Reference in New Issue