From d89c1d476cc3686f5f7c9adafcf28cc283da1f79 Mon Sep 17 00:00:00 2001 From: Gabriel Mermelstein Date: Tue, 19 Sep 2023 11:31:14 +0300 Subject: [PATCH] Only set default port if there's an extIp or a dns4 domain --- tests/testlib/wakunode.nim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/testlib/wakunode.nim b/tests/testlib/wakunode.nim index 4b61572756..3fb9bf9cb2 100644 --- a/tests/testlib/wakunode.nim +++ b/tests/testlib/wakunode.nim @@ -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, @@ -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