From 06af31a66adb49cd814874f9573108f8a6e3dae5 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Mon, 13 Mar 2023 04:08:15 +0000 Subject: [PATCH] Correct /lighthouse/nat implementation (#4069) ## Proposed Changes The current `/lighthouse/nat` implementation checks for _zero_ address updated messages, when it should check for a _non-zero_ number. This was spotted while debugging an issue on Discord where a user's ports weren't forwarded but `/lighthouse/nat` was still returning `true`. --- beacon_node/lighthouse_network/src/metrics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beacon_node/lighthouse_network/src/metrics.rs b/beacon_node/lighthouse_network/src/metrics.rs index 2ee224d5e..aed68e27f 100644 --- a/beacon_node/lighthouse_network/src/metrics.rs +++ b/beacon_node/lighthouse_network/src/metrics.rs @@ -159,7 +159,7 @@ pub fn check_nat() { if NAT_OPEN.as_ref().map(|v| v.get()).unwrap_or(0) != 0 { return; } - if ADDRESS_UPDATE_COUNT.as_ref().map(|v| v.get()).unwrap_or(0) == 0 + if ADDRESS_UPDATE_COUNT.as_ref().map(|v| v.get()).unwrap_or(0) != 0 || NETWORK_INBOUND_PEERS.as_ref().map(|v| v.get()).unwrap_or(0) != 0_i64 { inc_counter(&NAT_OPEN);