2020-08-31 03:32:41 +00:00
|
|
|
|
{.used.}
|
|
|
|
|
|
|
|
|
|
import
|
2023-02-09 15:59:29 +00:00
|
|
|
|
std/sequtils,
|
2022-11-04 09:52:08 +00:00
|
|
|
|
stew/byteutils,
|
|
|
|
|
stew/shims/net as stewNet,
|
2021-03-26 09:52:04 +00:00
|
|
|
|
testutils/unittests,
|
2023-01-26 10:18:30 +00:00
|
|
|
|
chronicles,
|
|
|
|
|
chronos,
|
2020-08-31 03:32:41 +00:00
|
|
|
|
libp2p/crypto/crypto,
|
|
|
|
|
libp2p/crypto/secp,
|
2021-01-25 11:03:52 +00:00
|
|
|
|
libp2p/multiaddress,
|
2020-09-02 03:15:25 +00:00
|
|
|
|
libp2p/switch,
|
2021-03-11 23:42:26 +00:00
|
|
|
|
libp2p/protocols/pubsub/rpc/messages,
|
|
|
|
|
libp2p/protocols/pubsub/pubsub,
|
2021-04-01 09:37:14 +00:00
|
|
|
|
libp2p/protocols/pubsub/gossipsub,
|
2023-02-09 15:59:29 +00:00
|
|
|
|
libp2p/nameresolving/mockresolver,
|
|
|
|
|
eth/p2p/discoveryv5/enr
|
2022-11-04 09:52:08 +00:00
|
|
|
|
import
|
2023-04-24 14:37:54 +00:00
|
|
|
|
../../waku/v2/waku_core,
|
2023-04-05 09:58:59 +00:00
|
|
|
|
../../waku/v2/waku_node,
|
2023-02-06 09:03:30 +00:00
|
|
|
|
../../waku/v2/node/peer_manager,
|
2023-04-18 13:22:10 +00:00
|
|
|
|
../../waku/v2/waku_relay,
|
|
|
|
|
../../waku/v2/waku_peer_exchange,
|
2023-04-05 14:01:51 +00:00
|
|
|
|
./testlib/wakucore,
|
|
|
|
|
./testlib/wakunode
|
2020-07-29 13:24:01 +00:00
|
|
|
|
|
2022-08-01 16:21:11 +00:00
|
|
|
|
|
2023-02-13 10:43:49 +00:00
|
|
|
|
suite "WakuNode":
|
2023-01-26 10:18:30 +00:00
|
|
|
|
|
2021-06-29 14:29:04 +00:00
|
|
|
|
asyncTest "Protocol matcher works as expected":
|
|
|
|
|
let
|
2023-02-13 10:43:49 +00:00
|
|
|
|
nodeKey1 = generateSecp256k1Key()
|
2023-04-05 14:01:51 +00:00
|
|
|
|
node1 = newTestWakuNode(nodeKey1, ValidIpAddress.init("0.0.0.0"), Port(61000))
|
2023-02-13 10:43:49 +00:00
|
|
|
|
nodeKey2 = generateSecp256k1Key()
|
2023-04-05 14:01:51 +00:00
|
|
|
|
node2 = newTestWakuNode(nodeKey2, ValidIpAddress.init("0.0.0.0"), Port(61002))
|
2021-06-29 14:29:04 +00:00
|
|
|
|
pubSubTopic = "/waku/2/default-waku/proto"
|
|
|
|
|
contentTopic = ContentTopic("/waku/2/default-content/proto")
|
|
|
|
|
payload = "hello world".toBytes()
|
|
|
|
|
message = WakuMessage(payload: payload, contentTopic: contentTopic)
|
|
|
|
|
|
|
|
|
|
# Setup node 1 with stable codec "/vac/waku/relay/2.0.0"
|
|
|
|
|
|
|
|
|
|
await node1.start()
|
2022-09-07 15:31:27 +00:00
|
|
|
|
await node1.mountRelay(@[pubSubTopic])
|
2021-06-29 14:29:04 +00:00
|
|
|
|
node1.wakuRelay.codec = "/vac/waku/relay/2.0.0"
|
|
|
|
|
|
|
|
|
|
# Setup node 2 with beta codec "/vac/waku/relay/2.0.0-beta2"
|
|
|
|
|
|
|
|
|
|
await node2.start()
|
2022-09-07 15:31:27 +00:00
|
|
|
|
await node2.mountRelay(@[pubSubTopic])
|
2021-06-29 14:29:04 +00:00
|
|
|
|
node2.wakuRelay.codec = "/vac/waku/relay/2.0.0-beta2"
|
|
|
|
|
|
|
|
|
|
check:
|
|
|
|
|
# Check that mounted codecs are actually different
|
|
|
|
|
node1.wakuRelay.codec == "/vac/waku/relay/2.0.0"
|
|
|
|
|
node2.wakuRelay.codec == "/vac/waku/relay/2.0.0-beta2"
|
|
|
|
|
|
|
|
|
|
# Now verify that protocol matcher returns `true` and relay works
|
2022-01-10 15:07:35 +00:00
|
|
|
|
await node1.connectToNodes(@[node2.switch.peerInfo.toRemotePeerInfo()])
|
2021-06-29 14:29:04 +00:00
|
|
|
|
|
|
|
|
|
var completionFut = newFuture[bool]()
|
|
|
|
|
proc relayHandler(topic: string, data: seq[byte]) {.async, gcsafe.} =
|
2022-11-07 15:24:16 +00:00
|
|
|
|
let msg = WakuMessage.decode(data)
|
2021-06-29 14:29:04 +00:00
|
|
|
|
if msg.isOk():
|
|
|
|
|
let val = msg.value()
|
|
|
|
|
check:
|
|
|
|
|
topic == pubSubTopic
|
|
|
|
|
val.contentTopic == contentTopic
|
|
|
|
|
val.payload == payload
|
|
|
|
|
completionFut.complete(true)
|
|
|
|
|
|
|
|
|
|
node2.subscribe(pubSubTopic, relayHandler)
|
|
|
|
|
await sleepAsync(2000.millis)
|
|
|
|
|
|
|
|
|
|
await node1.publish(pubSubTopic, message)
|
|
|
|
|
await sleepAsync(2000.millis)
|
|
|
|
|
|
|
|
|
|
check:
|
|
|
|
|
(await completionFut.withTimeout(5.seconds)) == true
|
2022-09-12 12:51:52 +00:00
|
|
|
|
|
|
|
|
|
await allFutures(node1.stop(), node2.stop())
|
2021-01-25 11:03:52 +00:00
|
|
|
|
|
2022-02-16 16:12:09 +00:00
|
|
|
|
asyncTest "resolve and connect to dns multiaddrs":
|
|
|
|
|
let resolver = MockResolver.new()
|
2022-05-16 10:51:10 +00:00
|
|
|
|
|
2022-02-16 16:12:09 +00:00
|
|
|
|
resolver.ipResponses[("localhost", false)] = @["127.0.0.1"]
|
|
|
|
|
|
|
|
|
|
let
|
2023-02-13 10:43:49 +00:00
|
|
|
|
nodeKey1 = generateSecp256k1Key()
|
2023-04-05 14:01:51 +00:00
|
|
|
|
node1 = newTestWakuNode(nodeKey1, ValidIpAddress.init("0.0.0.0"), Port(61020), nameResolver = resolver)
|
2023-02-13 10:43:49 +00:00
|
|
|
|
nodeKey2 = generateSecp256k1Key()
|
2023-04-05 14:01:51 +00:00
|
|
|
|
node2 = newTestWakuNode(nodeKey2, ValidIpAddress.init("0.0.0.0"), Port(61022))
|
2022-05-16 10:51:10 +00:00
|
|
|
|
|
2022-02-16 16:12:09 +00:00
|
|
|
|
# Construct DNS multiaddr for node2
|
|
|
|
|
let
|
|
|
|
|
node2PeerId = $(node2.switch.peerInfo.peerId)
|
2022-11-03 13:47:56 +00:00
|
|
|
|
node2Dns4Addr = "/dns4/localhost/tcp/61022/p2p/" & node2PeerId
|
2022-05-16 10:51:10 +00:00
|
|
|
|
|
2022-09-07 15:31:27 +00:00
|
|
|
|
await node1.mountRelay()
|
|
|
|
|
await node2.mountRelay()
|
2022-05-16 10:51:10 +00:00
|
|
|
|
|
2022-02-16 16:12:09 +00:00
|
|
|
|
await allFutures([node1.start(), node2.start()])
|
|
|
|
|
|
|
|
|
|
await node1.connectToNodes(@[node2Dns4Addr])
|
|
|
|
|
|
|
|
|
|
check:
|
|
|
|
|
node1.switch.connManager.connCount(node2.switch.peerInfo.peerId) == 1
|
|
|
|
|
|
|
|
|
|
await allFutures([node1.stop(), node2.stop()])
|
|
|
|
|
|
2021-10-12 12:48:48 +00:00
|
|
|
|
asyncTest "Maximum connections can be configured":
|
|
|
|
|
let
|
|
|
|
|
maxConnections = 2
|
2023-02-13 10:43:49 +00:00
|
|
|
|
nodeKey1 = generateSecp256k1Key()
|
2023-04-05 14:01:51 +00:00
|
|
|
|
node1 = newTestWakuNode(nodeKey1, ValidIpAddress.init("0.0.0.0"),
|
2021-10-12 12:48:48 +00:00
|
|
|
|
Port(60010), maxConnections = maxConnections)
|
2023-02-13 10:43:49 +00:00
|
|
|
|
nodeKey2 = generateSecp256k1Key()
|
2023-04-05 14:01:51 +00:00
|
|
|
|
node2 = newTestWakuNode(nodeKey2, ValidIpAddress.init("0.0.0.0"),
|
2021-10-12 12:48:48 +00:00
|
|
|
|
Port(60012))
|
2023-02-13 10:43:49 +00:00
|
|
|
|
nodeKey3 = generateSecp256k1Key()
|
2023-04-05 14:01:51 +00:00
|
|
|
|
node3 = newTestWakuNode(nodeKey3, ValidIpAddress.init("0.0.0.0"),
|
2021-10-12 12:48:48 +00:00
|
|
|
|
Port(60013))
|
2022-05-16 10:51:10 +00:00
|
|
|
|
|
2021-10-12 12:48:48 +00:00
|
|
|
|
check:
|
|
|
|
|
# Sanity check, to verify config was applied
|
|
|
|
|
node1.switch.connManager.inSema.size == maxConnections
|
|
|
|
|
|
|
|
|
|
# Node with connection limit set to 1
|
|
|
|
|
await node1.start()
|
2022-09-07 15:31:27 +00:00
|
|
|
|
await node1.mountRelay()
|
2021-10-12 12:48:48 +00:00
|
|
|
|
|
|
|
|
|
# Remote node 1
|
|
|
|
|
await node2.start()
|
2022-09-07 15:31:27 +00:00
|
|
|
|
await node2.mountRelay()
|
2021-10-12 12:48:48 +00:00
|
|
|
|
|
|
|
|
|
# Remote node 2
|
|
|
|
|
await node3.start()
|
2022-09-07 15:31:27 +00:00
|
|
|
|
await node3.mountRelay()
|
2021-10-12 12:48:48 +00:00
|
|
|
|
|
2023-03-28 11:29:48 +00:00
|
|
|
|
discard await node1.peerManager.connectRelay(node2.switch.peerInfo.toRemotePeerInfo())
|
2021-10-12 12:48:48 +00:00
|
|
|
|
await sleepAsync(3.seconds)
|
2023-03-28 11:29:48 +00:00
|
|
|
|
discard await node1.peerManager.connectRelay(node3.switch.peerInfo.toRemotePeerInfo())
|
2021-10-12 12:48:48 +00:00
|
|
|
|
|
|
|
|
|
check:
|
|
|
|
|
# Verify that only the first connection succeeded
|
2022-01-10 15:07:35 +00:00
|
|
|
|
node1.switch.isConnected(node2.switch.peerInfo.peerId)
|
|
|
|
|
node1.switch.isConnected(node3.switch.peerInfo.peerId) == false
|
2021-10-12 12:48:48 +00:00
|
|
|
|
|
|
|
|
|
await allFutures([node1.stop(), node2.stop(), node3.stop()])
|
2021-11-02 10:29:11 +00:00
|
|
|
|
|
2022-02-16 16:12:09 +00:00
|
|
|
|
asyncTest "Messages fails with wrong key path":
|
2023-04-05 14:01:51 +00:00
|
|
|
|
let nodeKey1 = generateSecp256k1Key()
|
2022-05-16 10:51:10 +00:00
|
|
|
|
|
2023-04-05 14:01:51 +00:00
|
|
|
|
expect ResultDefect:
|
2021-11-10 12:05:36 +00:00
|
|
|
|
# gibberish
|
2023-04-05 14:01:51 +00:00
|
|
|
|
discard newTestWakuNode(nodeKey1, ValidIpAddress.init("0.0.0.0"),
|
2023-01-26 10:18:30 +00:00
|
|
|
|
bindPort = Port(61004),
|
|
|
|
|
wsBindPort = Port(8000),
|
|
|
|
|
wssEnabled = true,
|
2022-11-03 13:47:56 +00:00
|
|
|
|
secureKey = "../../waku/v2/node/key_dummy.txt")
|
2021-11-10 12:05:36 +00:00
|
|
|
|
|
2022-02-16 16:12:09 +00:00
|
|
|
|
asyncTest "Peer info updates with correct announced addresses":
|
|
|
|
|
let
|
2023-02-13 10:43:49 +00:00
|
|
|
|
nodeKey = generateSecp256k1Key()
|
2022-02-16 16:12:09 +00:00
|
|
|
|
bindIp = ValidIpAddress.init("0.0.0.0")
|
2022-11-03 13:47:56 +00:00
|
|
|
|
bindPort = Port(61006)
|
2022-02-16 16:12:09 +00:00
|
|
|
|
extIp = some(ValidIpAddress.init("127.0.0.1"))
|
2022-11-03 13:47:56 +00:00
|
|
|
|
extPort = some(Port(61008))
|
2023-04-05 14:01:51 +00:00
|
|
|
|
node = newTestWakuNode(
|
2022-02-16 16:12:09 +00:00
|
|
|
|
nodeKey,
|
|
|
|
|
bindIp, bindPort,
|
|
|
|
|
extIp, extPort)
|
2022-05-16 10:51:10 +00:00
|
|
|
|
|
2022-02-16 16:12:09 +00:00
|
|
|
|
let
|
|
|
|
|
bindEndpoint = MultiAddress.init(bindIp, tcpProtocol, bindPort)
|
|
|
|
|
announcedEndpoint = MultiAddress.init(extIp.get(), tcpProtocol, extPort.get())
|
|
|
|
|
|
|
|
|
|
check:
|
|
|
|
|
# Check that underlying peer info contains only bindIp before starting
|
2022-10-28 09:51:46 +00:00
|
|
|
|
node.switch.peerInfo.listenAddrs.len == 1
|
|
|
|
|
node.switch.peerInfo.listenAddrs.contains(bindEndpoint)
|
|
|
|
|
# Underlying peer info has not updated addrs before starting
|
|
|
|
|
node.switch.peerInfo.addrs.len == 0
|
2022-05-16 10:51:10 +00:00
|
|
|
|
|
2022-02-16 16:12:09 +00:00
|
|
|
|
node.announcedAddresses.len == 1
|
|
|
|
|
node.announcedAddresses.contains(announcedEndpoint)
|
2022-05-16 10:51:10 +00:00
|
|
|
|
|
2022-02-16 16:12:09 +00:00
|
|
|
|
await node.start()
|
2021-11-30 09:12:09 +00:00
|
|
|
|
|
2022-02-16 16:12:09 +00:00
|
|
|
|
check:
|
|
|
|
|
node.started
|
2022-10-28 09:51:46 +00:00
|
|
|
|
# Underlying peer info listenAddrs has not changed
|
|
|
|
|
node.switch.peerInfo.listenAddrs.len == 1
|
|
|
|
|
node.switch.peerInfo.listenAddrs.contains(bindEndpoint)
|
|
|
|
|
# Check that underlying peer info is updated with announced address
|
2022-02-16 16:12:09 +00:00
|
|
|
|
node.switch.peerInfo.addrs.len == 1
|
|
|
|
|
node.switch.peerInfo.addrs.contains(announcedEndpoint)
|
2021-11-30 09:12:09 +00:00
|
|
|
|
|
2022-02-16 16:12:09 +00:00
|
|
|
|
await node.stop()
|
2022-02-18 11:10:38 +00:00
|
|
|
|
|
|
|
|
|
asyncTest "Node can use dns4 in announced addresses":
|
|
|
|
|
let
|
2023-02-13 10:43:49 +00:00
|
|
|
|
nodeKey = generateSecp256k1Key()
|
2022-02-18 11:10:38 +00:00
|
|
|
|
bindIp = ValidIpAddress.init("0.0.0.0")
|
2022-11-03 13:47:56 +00:00
|
|
|
|
bindPort = Port(61010)
|
2022-02-18 11:10:38 +00:00
|
|
|
|
extIp = some(ValidIpAddress.init("127.0.0.1"))
|
2022-11-03 13:47:56 +00:00
|
|
|
|
extPort = some(Port(61012))
|
2022-02-18 11:10:38 +00:00
|
|
|
|
domainName = "example.com"
|
|
|
|
|
expectedDns4Addr = MultiAddress.init("/dns4/" & domainName & "/tcp/" & $(extPort.get())).get()
|
2023-04-05 14:01:51 +00:00
|
|
|
|
node = newTestWakuNode(
|
2022-02-18 11:10:38 +00:00
|
|
|
|
nodeKey,
|
|
|
|
|
bindIp, bindPort,
|
|
|
|
|
extIp, extPort,
|
|
|
|
|
dns4DomainName = some(domainName))
|
2022-05-16 10:51:10 +00:00
|
|
|
|
|
2022-02-18 11:10:38 +00:00
|
|
|
|
check:
|
|
|
|
|
node.announcedAddresses.len == 1
|
|
|
|
|
node.announcedAddresses.contains(expectedDns4Addr)
|
2022-10-28 13:12:06 +00:00
|
|
|
|
|
2023-01-26 10:18:30 +00:00
|
|
|
|
|
2022-10-28 13:12:06 +00:00
|
|
|
|
asyncTest "Agent string is set and advertised correctly":
|
|
|
|
|
let
|
|
|
|
|
# custom agent string
|
|
|
|
|
expectedAgentString1 = "node1-agent-string"
|
|
|
|
|
|
|
|
|
|
# bump when updating nim-libp2p
|
|
|
|
|
expectedAgentString2 = "nim-libp2p/0.0.1"
|
|
|
|
|
let
|
|
|
|
|
# node with custom agent string
|
2023-02-13 10:43:49 +00:00
|
|
|
|
nodeKey1 = generateSecp256k1Key()
|
2023-04-05 14:01:51 +00:00
|
|
|
|
node1 = newTestWakuNode(nodeKey1, ValidIpAddress.init("0.0.0.0"), Port(61014),
|
2022-10-28 13:12:06 +00:00
|
|
|
|
agentString = some(expectedAgentString1))
|
|
|
|
|
|
|
|
|
|
# node with default agent string from libp2p
|
2023-02-13 10:43:49 +00:00
|
|
|
|
nodeKey2 = generateSecp256k1Key()
|
2023-04-05 14:01:51 +00:00
|
|
|
|
node2 = newTestWakuNode(nodeKey2, ValidIpAddress.init("0.0.0.0"), Port(61016))
|
2022-10-28 13:12:06 +00:00
|
|
|
|
|
|
|
|
|
await node1.start()
|
|
|
|
|
await node1.mountRelay()
|
|
|
|
|
|
|
|
|
|
await node2.start()
|
|
|
|
|
await node2.mountRelay()
|
|
|
|
|
|
|
|
|
|
await node1.connectToNodes(@[node2.switch.peerInfo.toRemotePeerInfo()])
|
|
|
|
|
await node2.connectToNodes(@[node1.switch.peerInfo.toRemotePeerInfo()])
|
|
|
|
|
|
|
|
|
|
let node1Agent = node2.switch.peerStore[AgentBook][node1.switch.peerInfo.toRemotePeerInfo().peerId]
|
|
|
|
|
let node2Agent = node1.switch.peerStore[AgentBook][node2.switch.peerInfo.toRemotePeerInfo().peerId]
|
|
|
|
|
|
|
|
|
|
check:
|
|
|
|
|
node1Agent == expectedAgentString1
|
|
|
|
|
node2Agent == expectedAgentString2
|
|
|
|
|
|
2023-01-26 10:18:30 +00:00
|
|
|
|
await allFutures(node1.stop(), node2.stop())
|
|
|
|
|
|
|
|
|
|
asyncTest "Custom multiaddresses are set and advertised correctly":
|
|
|
|
|
let
|
|
|
|
|
# custom multiaddress
|
|
|
|
|
expectedMultiaddress1 = MultiAddress.init("/ip4/200.200.200.200/tcp/1234").get()
|
|
|
|
|
|
|
|
|
|
# Note: this could have been done with a single node, but it is useful to
|
|
|
|
|
# have two nodes to check that the multiaddress is advertised correctly
|
|
|
|
|
let
|
|
|
|
|
# node with custom multiaddress
|
2023-02-13 10:43:49 +00:00
|
|
|
|
nodeKey1 = generateSecp256k1Key()
|
2023-04-05 14:01:51 +00:00
|
|
|
|
node1 = newTestWakuNode(nodeKey1, ValidIpAddress.init("0.0.0.0"), Port(61018),
|
2023-01-26 10:18:30 +00:00
|
|
|
|
extMultiAddrs = @[expectedMultiaddress1])
|
|
|
|
|
|
|
|
|
|
# node with default multiaddress
|
2023-02-13 10:43:49 +00:00
|
|
|
|
nodeKey2 = generateSecp256k1Key()
|
2023-04-05 14:01:51 +00:00
|
|
|
|
node2 = newTestWakuNode(nodeKey2, ValidIpAddress.init("0.0.0.0"), Port(61020))
|
2023-01-26 10:18:30 +00:00
|
|
|
|
|
|
|
|
|
await node1.start()
|
|
|
|
|
await node1.mountRelay()
|
|
|
|
|
|
|
|
|
|
await node2.start()
|
|
|
|
|
await node2.mountRelay()
|
|
|
|
|
|
|
|
|
|
await node1.connectToNodes(@[node2.switch.peerInfo.toRemotePeerInfo()])
|
|
|
|
|
await node2.connectToNodes(@[node1.switch.peerInfo.toRemotePeerInfo()])
|
|
|
|
|
|
|
|
|
|
let node1MultiAddrs = node2.switch.peerStore[AddressBook][node1.switch.peerInfo.toRemotePeerInfo().peerId]
|
|
|
|
|
|
|
|
|
|
check:
|
|
|
|
|
node1MultiAddrs.contains(expectedMultiaddress1)
|
|
|
|
|
|
|
|
|
|
await allFutures(node1.stop(), node2.stop())
|
2023-02-09 15:59:29 +00:00
|
|
|
|
|
|
|
|
|
asyncTest "Function fetchPeerExchangePeers succesfully exchanges px peers":
|
|
|
|
|
let
|
2023-04-05 14:01:51 +00:00
|
|
|
|
node1 = newTestWakuNode(generateSecp256k1Key(), ValidIpAddress.init("0.0.0.0"), Port(0))
|
|
|
|
|
node2 = newTestWakuNode(generateSecp256k1Key(), ValidIpAddress.init("0.0.0.0"), Port(0))
|
2023-02-09 15:59:29 +00:00
|
|
|
|
|
|
|
|
|
# Start and mount peer exchange
|
|
|
|
|
await allFutures([node1.start(), node2.start()])
|
|
|
|
|
await allFutures([node1.mountPeerExchange(), node2.mountPeerExchange()])
|
|
|
|
|
|
|
|
|
|
# Mock that we discovered a node (to avoid running discv5)
|
|
|
|
|
var enr = enr.Record()
|
|
|
|
|
require enr.fromUri("enr:-Iu4QGNuTvNRulF3A4Kb9YHiIXLr0z_CpvWkWjWKU-o95zUPR_In02AWek4nsSk7G_-YDcaT4bDRPzt5JIWvFqkXSNcBgmlkgnY0gmlwhE0WsGeJc2VjcDI1NmsxoQKp9VzU2FAh7fwOwSpg1M_Ekz4zzl0Fpbg6po2ZwgVwQYN0Y3CC6mCFd2FrdTIB")
|
|
|
|
|
node2.wakuPeerExchange.enrCache.add(enr)
|
|
|
|
|
|
|
|
|
|
# Set node2 as service peer (default one) for px protocol
|
|
|
|
|
node1.peerManager.addServicePeer(node2.peerInfo.toRemotePeerInfo(), WakuPeerExchangeCodec)
|
|
|
|
|
|
|
|
|
|
# Request 1 peer from peer exchange protocol
|
|
|
|
|
await node1.fetchPeerExchangePeers(1)
|
|
|
|
|
|
|
|
|
|
# Check that the peer ended up in the peerstore
|
|
|
|
|
let rpInfo = enr.toRemotePeerInfo.get()
|
|
|
|
|
check:
|
|
|
|
|
node1.peerManager.peerStore.peers.anyIt(it.peerId == rpInfo.peerId)
|
|
|
|
|
node1.peerManager.peerStore.peers.anyIt(it.addrs == rpInfo.addrs)
|