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
+17
No files matched your search
@@ -28,6 +28,10 @@
|
|||||||
to_local/to_remote output](https://github.com/lightningnetwork/lnd/pull/10387)
|
to_local/to_remote output](https://github.com/lightningnetwork/lnd/pull/10387)
|
||||||
might take too long.
|
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
|
# New Features
|
||||||
|
|
||||||
## Functional Enhancements
|
## Functional Enhancements
|
||||||
@@ -62,4 +66,5 @@
|
|||||||
|
|
||||||
# Contributors (Alphabetical Order)
|
# Contributors (Alphabetical Order)
|
||||||
|
|
||||||
|
* bitromortac
|
||||||
* Ziggie
|
* Ziggie
|
||||||
@@ -3399,6 +3399,18 @@ func (s *server) genNodeAnnouncement(features *lnwire.RawFeatureVector,
|
|||||||
modifier(&newNodeAnn)
|
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.
|
// Sign a new update after applying all of the passed modifiers.
|
||||||
err := netann.SignNodeAnnouncement(
|
err := netann.SignNodeAnnouncement(
|
||||||
s.nodeSigner, s.identityKeyLoc, &newNodeAnn,
|
s.nodeSigner, s.identityKeyLoc, &newNodeAnn,
|
||||||
|
|||||||
Reference in new issue
Block a user