Skip to content

Commit

Permalink
Only set default port if there's an extIp or a dns4 domain
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmer committed Sep 19, 2023
1 parent b9116dd commit d89c1d4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/testlib/wakunode.nim
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ proc newTestWakuNode*(nodeKey: crypto.PrivateKey,
bindIp: ValidIpAddress,
bindPort: Port,
extIp = none(ValidIpAddress),
extPort = some(Port(60000)),
extPort = none(Port),
extMultiAddrs = newSeq[MultiAddress](),
peerStorage: PeerStorage = nil,
maxConnections = builders.MaxConnections,
Expand All @@ -43,6 +43,13 @@ proc newTestWakuNode*(nodeKey: crypto.PrivateKey,

var resolvedExtIp = extIp

# Update extPort to default value if it's missing and there's an extIp or a DNS domain
let extPort = if (extIp.isSome() or dns4DomainName.isSome()) and
extPort.isNone():
some(Port(60000))
else:
extPort

if dns4DomainName.isSome() and extIp.isNone():
let conf = defaultTestWakuNodeConf()
# If there's an error resolving the IP, an exception is thrown and test fails
Expand Down

0 comments on commit d89c1d4

Please sign in to comment.