discovery+gossip: make sure we dont advertise node anns with bad DNS

We may have already persisted node announcements that have multiple DNS
addresses since we may have received them before updating our code to
check for this. So here we just make sure not to send these on to our
peers.
This commit is contained in:
Elle Mouton authored and Mohamed Awnallah committed 2025-09-03 01:11:35 +00:00
1 parent f0a20c9d04
commit 70b5016bc8
2 files changed
+35 -6

No files matched your search

+9 -2
View File
@@ -2229,7 +2229,9 @@ func (d *AuthenticatedGossiper) processZombieUpdate(_ context.Context,
}
// fetchNodeAnn fetches the latest signed node announcement from our point of
// view for the node with the given public key.
// view for the node with the given public key. It also validates the node
// announcement fields and returns an error if they are invalid to prevent
// forwarding invalid node announcements to our peers.
func (d *AuthenticatedGossiper) fetchNodeAnn(ctx context.Context,
pubKey [33]byte) (*lnwire.NodeAnnouncement, error) {
@@ -2238,7 +2240,12 @@ func (d *AuthenticatedGossiper) fetchNodeAnn(ctx context.Context,
return nil, err
}
return node.NodeAnnouncement(true)
nodeAnn, err := node.NodeAnnouncement(true)
if err != nil {
return nil, err
}
return nodeAnn, netann.ValidateNodeAnnFields(nodeAnn)
}
// isMsgStale determines whether a message retrieved from the backing