Skip to content

Commit

Permalink
Merge pull request #3219 from wpaulino/node-ann-broadcast
Browse files Browse the repository at this point in the history
discovery: set source of node announcement broadcast to belonging node
  • Loading branch information
Roasbeef committed Jun 21, 2019
2 parents 82c776a + 67132d4 commit 3cf7c3a
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions discovery/gossiper.go
Original file line number Diff line number Diff line change
Expand Up @@ -2382,28 +2382,38 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(
}

// We'll also send along the node announcements for each channel
// participant if we know of them.
// participant if we know of them. To ensure our node
// announcement propagates to our channel counterparty, we'll
// set the source for each announcement to the node it belongs
// to, otherwise we won't send it since the source gets skipped.
// This isn't necessary for channel updates and announcement
// signatures since we send those directly to our channel
// counterparty through the gossiper's reliable sender.
node1Ann, err := d.fetchNodeAnn(chanInfo.NodeKey1Bytes)
if err != nil {
log.Debugf("Unable to fetch node announcement for "+
"%x: %v", chanInfo.NodeKey1Bytes, err)
} else {
announcements = append(announcements, networkMsg{
peer: nMsg.peer,
source: nMsg.source,
msg: node1Ann,
})
if nodeKey1, err := chanInfo.NodeKey1(); err == nil {
announcements = append(announcements, networkMsg{
peer: nMsg.peer,
source: nodeKey1,
msg: node1Ann,
})
}
}
node2Ann, err := d.fetchNodeAnn(chanInfo.NodeKey2Bytes)
if err != nil {
log.Debugf("Unable to fetch node announcement for "+
"%x: %v", chanInfo.NodeKey2Bytes, err)
} else {
announcements = append(announcements, networkMsg{
peer: nMsg.peer,
source: nMsg.source,
msg: node2Ann,
})
if nodeKey2, err := chanInfo.NodeKey2(); err == nil {
announcements = append(announcements, networkMsg{
peer: nMsg.peer,
source: nodeKey2,
msg: node2Ann,
})
}
}

nMsg.err <- nil
Expand Down

0 comments on commit 3cf7c3a

Please sign in to comment.