From 8010d36a0cbf2d09ba1d0f09f51b32401e7d2580 Mon Sep 17 00:00:00 2001 From: Cayman Date: Tue, 25 Jul 2023 11:03:37 -0400 Subject: [PATCH] fix: prevent non-local IP enr warning --- packages/cli/src/cmds/beacon/initPeerIdAndEnr.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/cmds/beacon/initPeerIdAndEnr.ts b/packages/cli/src/cmds/beacon/initPeerIdAndEnr.ts index 3c7053190335..9313b1f47f88 100644 --- a/packages/cli/src/cmds/beacon/initPeerIdAndEnr.ts +++ b/packages/cli/src/cmds/beacon/initPeerIdAndEnr.ts @@ -54,13 +54,13 @@ export function isLocalMultiAddr(multiaddr: Multiaddr | undefined): boolean { } export function overwriteEnrWithCliArgs(enr: SignableENR, args: BeaconArgs, logger: Logger): void { - const {listenAddress, port, discoveryPort, listenAddress6, port6, discoveryPort6} = parseListenArgs(args); - enr.ip = args["enr.ip"] ?? listenAddress; - enr.tcp = args["enr.tcp"] ?? port; - enr.udp = args["enr.udp"] ?? discoveryPort; - enr.ip6 = args["enr.ip6"] ?? listenAddress6; - enr.tcp6 = args["enr.tcp6"] ?? port6; - enr.udp6 = args["enr.udp6"] ?? discoveryPort6; + const {port, discoveryPort, port6, discoveryPort6} = parseListenArgs(args); + enr.ip = args["enr.ip"] ?? enr.ip; + enr.tcp = args["enr.tcp"] ?? port ?? enr.tcp; + enr.udp = args["enr.udp"] ?? discoveryPort ?? enr.udp; + enr.ip6 = args["enr.ip6"] ?? enr.ip6; + enr.tcp6 = args["enr.tcp6"] ?? port6 ?? enr.tcp6; + enr.udp6 = args["enr.udp6"] ?? discoveryPort6 ?? enr.udp6; function testMultiaddrForLocal(mu: Multiaddr, ip4: boolean): void { const isLocal = isLocalMultiAddr(mu);