discovery: set source of node announcement broadcast to belonging node
We do this to ensure the node announcement propagates to our channel counterparty. At times, the node announcement does not propagate to them when opening our first channel due to a race condition between IsPublicNode and processing announcement signatures. This isn't necessary for channel updates and announcement signatures as we send those to our channel counterparty directly through the reliable sender.
This commit is contained in:
parent
d6d87e12fe
commit
67132d4ee3
@ -2382,28 +2382,38 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We'll also send along the node announcements for each channel
|
// 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)
|
node1Ann, err := d.fetchNodeAnn(chanInfo.NodeKey1Bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debugf("Unable to fetch node announcement for "+
|
log.Debugf("Unable to fetch node announcement for "+
|
||||||
"%x: %v", chanInfo.NodeKey1Bytes, err)
|
"%x: %v", chanInfo.NodeKey1Bytes, err)
|
||||||
} else {
|
} else {
|
||||||
announcements = append(announcements, networkMsg{
|
if nodeKey1, err := chanInfo.NodeKey1(); err == nil {
|
||||||
peer: nMsg.peer,
|
announcements = append(announcements, networkMsg{
|
||||||
source: nMsg.source,
|
peer: nMsg.peer,
|
||||||
msg: node1Ann,
|
source: nodeKey1,
|
||||||
})
|
msg: node1Ann,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
node2Ann, err := d.fetchNodeAnn(chanInfo.NodeKey2Bytes)
|
node2Ann, err := d.fetchNodeAnn(chanInfo.NodeKey2Bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debugf("Unable to fetch node announcement for "+
|
log.Debugf("Unable to fetch node announcement for "+
|
||||||
"%x: %v", chanInfo.NodeKey2Bytes, err)
|
"%x: %v", chanInfo.NodeKey2Bytes, err)
|
||||||
} else {
|
} else {
|
||||||
announcements = append(announcements, networkMsg{
|
if nodeKey2, err := chanInfo.NodeKey2(); err == nil {
|
||||||
peer: nMsg.peer,
|
announcements = append(announcements, networkMsg{
|
||||||
source: nMsg.source,
|
peer: nMsg.peer,
|
||||||
msg: node2Ann,
|
source: nodeKey2,
|
||||||
})
|
msg: node2Ann,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nMsg.err <- nil
|
nMsg.err <- nil
|
||||||
|
Loading…
Reference in New Issue
Block a user