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:
1 parent
f0a20c9d04
commit
70b5016bc8
2 files changed
+35
-6
No files matched your search
@@ -231,6 +231,13 @@ func (c *ChanSeries) UpdatesInHorizon(chain chainhash.Hash,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := netann.ValidateNodeAnnFields(nodeUpdate); err != nil {
|
||||
log.Debugf("Skipping forwarding invalid node "+
|
||||
"announcement %x: %v", nodeAnn.PubKeyBytes, err)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
updates = append(updates, nodeUpdate)
|
||||
}
|
||||
|
||||
@@ -282,6 +289,7 @@ func (c *ChanSeries) FilterChannelRange(_ chainhash.Hash, startHeight,
|
||||
// to reply to a QueryShortChanIDs message sent by a remote peer. The response
|
||||
// will contain a unique set of ChannelAnnouncements, the latest ChannelUpdate
|
||||
// for each of the announcements, and a unique set of NodeAnnouncements.
|
||||
// Invalid node announcements are skipped and logged for debugging purposes.
|
||||
//
|
||||
// NOTE: This is part of the ChannelGraphTimeSeries interface.
|
||||
func (c *ChanSeries) FetchChanAnns(chain chainhash.Hash,
|
||||
@@ -335,8 +343,15 @@ func (c *ChanSeries) FetchChanAnns(chain chainhash.Hash,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
chanAnns = append(chanAnns, nodeAnn)
|
||||
nodePubsSent[nodePub] = struct{}{}
|
||||
err = netann.ValidateNodeAnnFields(nodeAnn)
|
||||
if err != nil {
|
||||
log.Debugf("Skipping forwarding "+
|
||||
"invalid node announcement "+
|
||||
"%x: %v", nodeAnn.NodeID, err)
|
||||
} else {
|
||||
chanAnns = append(chanAnns, nodeAnn)
|
||||
nodePubsSent[nodePub] = struct{}{}
|
||||
}
|
||||
}
|
||||
}
|
||||
if edge2 != nil {
|
||||
@@ -354,8 +369,15 @@ func (c *ChanSeries) FetchChanAnns(chain chainhash.Hash,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
chanAnns = append(chanAnns, nodeAnn)
|
||||
nodePubsSent[nodePub] = struct{}{}
|
||||
err = netann.ValidateNodeAnnFields(nodeAnn)
|
||||
if err != nil {
|
||||
log.Debugf("Skipping forwarding "+
|
||||
"invalid node announcement "+
|
||||
"%x: %v", nodeAnn.NodeID, err)
|
||||
} else {
|
||||
chanAnns = append(chanAnns, nodeAnn)
|
||||
nodePubsSent[nodePub] = struct{}{}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user