fix issue with extMultiAddrsOnly flag

This commit is contained in:
Prem Chaitanya Prathi 2026-01-13 17:55:00 +05:30
parent dc0ebc7142
commit 74ea46e392
No known key found for this signature in database
2 changed files with 10 additions and 1 deletions

View File

@ -13,7 +13,7 @@ import
libp2p/services/autorelayservice,
libp2p/services/hpservice,
libp2p/peerid,
libp2p/discovery/rendezvousinterface,
libp2p/protocols/rendezvous,
eth/keys,
eth/p2p/discoveryv5/enr,
presto,
@ -187,6 +187,9 @@ proc new*(
error "Failed setting up node", error = $error
return err("Failed setting up node: " & $error)
# Set the extMultiAddrsOnly flag so the node knows not to replace explicit addresses
node.extMultiAddrsOnly = wakuConf.endpointConf.extMultiAddrsOnly
healthMonitor.setNodeToHealthMonitor(node)
healthMonitor.onlineMonitor.setPeerStoreToOnlineMonitor(node.switch.peerStore)
healthMonitor.onlineMonitor.addOnlineStateObserver(

View File

@ -126,6 +126,7 @@ type
wakuRendezvous*: WakuRendezVous
wakuRendezvousClient*: rendezvous_client.WakuRendezVousClient
announcedAddresses*: seq[MultiAddress]
extMultiAddrsOnly*: bool # When true, skip automatic IP address replacement
started*: bool # Indicates that node has started listening
topicSubscriptionQueue*: AsyncEventQueue[SubscriptionEvent]
rateLimitSettings*: ProtocolRateLimitSettings
@ -403,6 +404,11 @@ proc isBindIpWithZeroPort(inputMultiAdd: MultiAddress): bool =
return false
proc updateAnnouncedAddrWithPrimaryIpAddr*(node: WakuNode): Result[void, string] =
# Skip automatic IP replacement if extMultiAddrsOnly is set
# This respects the user's explicitly configured announced addresses
if node.extMultiAddrsOnly:
return ok()
let peerInfo = node.switch.peerInfo
var announcedStr = ""
var listenStr = ""