Merge pull request #10341 from bitromortac/2511-fix-tor-healthcheck
server: prevent duplicate onion addresses in getinfo
This commit is contained in:
2 files changed
+18
-1
No files matched your search
@@ -27,7 +27,11 @@
|
||||
* [Fix a case where resolving the
|
||||
to_local/to_remote output](https://github.com/lightningnetwork/lnd/pull/10387)
|
||||
might take too long.
|
||||
|
||||
|
||||
* Fix a bug where [repeated network
|
||||
addresses](https://github.com/lightningnetwork/lnd/pull/10341) were added to
|
||||
the node announcement and `getinfo` output.
|
||||
|
||||
# New Features
|
||||
|
||||
## Functional Enhancements
|
||||
@@ -62,4 +66,5 @@
|
||||
|
||||
# Contributors (Alphabetical Order)
|
||||
|
||||
* bitromortac
|
||||
* Ziggie
|
||||
@@ -3399,6 +3399,18 @@ func (s *server) genNodeAnnouncement(features *lnwire.RawFeatureVector,
|
||||
modifier(&newNodeAnn)
|
||||
}
|
||||
|
||||
// The modifiers may have added duplicate addresses, so we need to
|
||||
// de-duplicate them here.
|
||||
uniqueAddrs := map[string]struct{}{}
|
||||
dedupedAddrs := make([]net.Addr, 0)
|
||||
for _, addr := range newNodeAnn.Addresses {
|
||||
if _, ok := uniqueAddrs[addr.String()]; !ok {
|
||||
uniqueAddrs[addr.String()] = struct{}{}
|
||||
dedupedAddrs = append(dedupedAddrs, addr)
|
||||
}
|
||||
}
|
||||
newNodeAnn.Addresses = dedupedAddrs
|
||||
|
||||
// Sign a new update after applying all of the passed modifiers.
|
||||
err := netann.SignNodeAnnouncement(
|
||||
s.nodeSigner, s.identityKeyLoc, &newNodeAnn,
|
||||
|
||||
Reference in new issue
Block a user