chore(peerinfo): enable calling update multiple times (#1525)

This commit is contained in:
Gabriel Cruz
2025-07-11 14:28:34 -03:00
committed by GitHub
parent 13c613c26c
commit c1f6dec7d3

View File

@@ -53,11 +53,7 @@ chronicles.formatIt(PeerInfo):
shortLog(it)
proc update*(p: PeerInfo) {.async: (raises: [CancelledError]).} =
# p.addrs.len == 0 overrides addrs only if it is the first time update is being executed or if the field is empty.
# p.addressMappers.len == 0 is for when all addressMappers have been removed,
# and we wish to have addrs in its initial state, i.e., a copy of listenAddrs.
if p.addrs.len == 0 or p.addressMappers.len == 0:
p.addrs = p.listenAddrs
p.addrs = p.listenAddrs
for mapper in p.addressMappers:
p.addrs = await mapper(p.addrs)