mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-28 07:35:56 +00:00
deploy: 7ef51edfa244fdee641a5e5ee7cb59b498d28ea6
This commit is contained in:
parent
20efc42559
commit
bc7646864a
@ -1388,4 +1388,38 @@ asyncTest "Messages are relayed between nodes with multiple transports (websocke
|
||||
check:
|
||||
(await completionFut.withTimeout(5.seconds)) == true
|
||||
await node1.stop()
|
||||
await node2.stop()
|
||||
await node2.stop()
|
||||
|
||||
asyncTest "Peer info updates with correct announced addresses":
|
||||
let
|
||||
nodeKey = crypto.PrivateKey.random(Secp256k1, rng[])[]
|
||||
bindIp = ValidIpAddress.init("0.0.0.0")
|
||||
bindPort = Port(60000)
|
||||
extIp = some(ValidIpAddress.init("127.0.0.1"))
|
||||
extPort = some(Port(60002))
|
||||
node = WakuNode.new(
|
||||
nodeKey,
|
||||
bindIp, bindPort,
|
||||
extIp, extPort)
|
||||
|
||||
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
|
||||
node.switch.peerInfo.addrs.len == 1
|
||||
node.switch.peerInfo.addrs.contains(bindEndpoint)
|
||||
|
||||
node.announcedAddresses.len == 1
|
||||
node.announcedAddresses.contains(announcedEndpoint)
|
||||
|
||||
await node.start()
|
||||
|
||||
check:
|
||||
# Check that underlying peer info is updated with announced address
|
||||
node.started
|
||||
node.switch.peerInfo.addrs.len == 1
|
||||
node.switch.peerInfo.addrs.contains(announcedEndpoint)
|
||||
|
||||
await node.stop()
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# libtool - Provide generalized library-building support services.
|
||||
# Generated automatically by config.status (libbacktrace) version-unused
|
||||
# Libtool was configured on host fv-az190-693:
|
||||
# Libtool was configured on host fv-az173-167:
|
||||
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
|
||||
#
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
|
||||
|
BIN
vendor/nimbus-build-system/vendor/Nim/compiler/nim
vendored
BIN
vendor/nimbus-build-system/vendor/Nim/compiler/nim
vendored
Binary file not shown.
BIN
vendor/nimbus-build-system/vendor/Nim/compiler/nim1
vendored
BIN
vendor/nimbus-build-system/vendor/Nim/compiler/nim1
vendored
Binary file not shown.
BIN
vendor/nimbus-build-system/vendor/Nim/compiler/nim2
vendored
BIN
vendor/nimbus-build-system/vendor/Nim/compiler/nim2
vendored
Binary file not shown.
@ -125,6 +125,22 @@ proc removeContentFilters(filters: var Filters, contentFilters: seq[ContentFilte
|
||||
|
||||
debug "filters modified", filters=filters
|
||||
|
||||
proc updateSwitchPeerInfo(node: WakuNode) =
|
||||
## TODO: remove this when supported upstream
|
||||
##
|
||||
## nim-libp2p does not yet support announcing addrs
|
||||
## different from bound addrs.
|
||||
##
|
||||
## This is a temporary workaround to replace
|
||||
## peer info addrs in switch to announced
|
||||
## addresses.
|
||||
##
|
||||
## WARNING: this should only be called once the switch
|
||||
## has already been started.
|
||||
|
||||
if node.announcedAddresses.len > 0:
|
||||
node.switch.peerInfo.addrs = node.announcedAddresses
|
||||
|
||||
template tcpEndPoint(address, port): auto =
|
||||
MultiAddress.init(address, tcpProtocol, port)
|
||||
|
||||
@ -839,6 +855,9 @@ proc start*(node: WakuNode) {.async.} =
|
||||
info "Listening on", full = listenStr
|
||||
info "Discoverable ENR ", enr = node.enr.toURI()
|
||||
|
||||
## Update switch peer info with announced addrs
|
||||
node.updateSwitchPeerInfo()
|
||||
|
||||
if not node.wakuRelay.isNil:
|
||||
await node.startRelay()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user