discovery/gossiper: ignore remote ChannelAnnouncement for own channel

To avoid learning about our own channel we have already closed and
removed from our graph, we ignore all ChannelAnns for channels we are
involved in.
This commit is contained in:
Johan T. Halseth
2021-01-06 10:49:56 +01:00
parent e8f7a11470
commit 926005aefa
2 changed files with 180 additions and 0 deletions

View File

@@ -542,6 +542,22 @@ func (d *AuthenticatedGossiper) ProcessRemoteAnnouncement(msg lnwire.Message,
errChan <- nil
return errChan
// To avoid inserting edges in the graph for our own channels that we
// have already closed, we ignore such channel announcements coming
// from the remote.
case *lnwire.ChannelAnnouncement:
ownKey := d.selfKey.SerializeCompressed()
ownErr := fmt.Errorf("ignoring remote ChannelAnnouncement " +
"for own channel")
if bytes.Equal(m.NodeID1[:], ownKey) ||
bytes.Equal(m.NodeID2[:], ownKey) {
log.Warn(ownErr)
errChan <- ownErr
return errChan
}
}
nMsg := &networkMsg{