discovery: properly set the isRemote field for validated networkMsg
This wasn't set properly, leading to some test failures after the prior change.
This commit is contained in:
2 files changed
+18
-12
No files matched your search
+16
-12
@@ -1182,7 +1182,7 @@ func (d *AuthenticatedGossiper) sendBatch(annBatch []msgWithSenders,
|
|||||||
isLocal bool) {
|
isLocal bool) {
|
||||||
|
|
||||||
// If this is a batch of announcements created locally, then we can
|
// If this is a batch of announcements created locally, then we can
|
||||||
// skip the filter and deup logic below, and just send the
|
// skip the filter and dedup logic below, and just send the
|
||||||
// announcements out to all our coonnected peers.
|
// announcements out to all our coonnected peers.
|
||||||
if isLocal {
|
if isLocal {
|
||||||
msgsToSend := fn.Map(
|
msgsToSend := fn.Map(
|
||||||
@@ -1695,8 +1695,9 @@ func (d *AuthenticatedGossiper) processChanPolicyUpdate(
|
|||||||
// We set ourselves as the source of this message to indicate
|
// We set ourselves as the source of this message to indicate
|
||||||
// that we shouldn't skip any peers when sending this message.
|
// that we shouldn't skip any peers when sending this message.
|
||||||
chanUpdates = append(chanUpdates, networkMsg{
|
chanUpdates = append(chanUpdates, networkMsg{
|
||||||
source: d.selfKey,
|
source: d.selfKey,
|
||||||
msg: chanUpdate,
|
isRemote: false,
|
||||||
|
msg: chanUpdate,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2266,9 +2267,10 @@ func (d *AuthenticatedGossiper) handleNodeAnnouncement(nMsg *networkMsg,
|
|||||||
// be broadcast to the rest of our peers.
|
// be broadcast to the rest of our peers.
|
||||||
if isPublic {
|
if isPublic {
|
||||||
announcements = append(announcements, networkMsg{
|
announcements = append(announcements, networkMsg{
|
||||||
peer: nMsg.peer,
|
peer: nMsg.peer,
|
||||||
source: nMsg.source,
|
isRemote: nMsg.isRemote,
|
||||||
msg: nodeAnn,
|
source: nMsg.source,
|
||||||
|
msg: nodeAnn,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
log.Tracef("Skipping broadcasting node announcement for %x "+
|
log.Tracef("Skipping broadcasting node announcement for %x "+
|
||||||
@@ -2544,9 +2546,10 @@ func (d *AuthenticatedGossiper) handleChanAnnouncement(nMsg *networkMsg,
|
|||||||
|
|
||||||
if proof != nil {
|
if proof != nil {
|
||||||
announcements = append(announcements, networkMsg{
|
announcements = append(announcements, networkMsg{
|
||||||
peer: nMsg.peer,
|
peer: nMsg.peer,
|
||||||
source: nMsg.source,
|
isRemote: nMsg.isRemote,
|
||||||
msg: ann,
|
source: nMsg.source,
|
||||||
|
msg: ann,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2932,9 +2935,10 @@ func (d *AuthenticatedGossiper) handleChanUpdate(nMsg *networkMsg,
|
|||||||
var announcements []networkMsg
|
var announcements []networkMsg
|
||||||
if chanInfo.AuthProof != nil && !d.cfg.IsAlias(upd.ShortChannelID) {
|
if chanInfo.AuthProof != nil && !d.cfg.IsAlias(upd.ShortChannelID) {
|
||||||
announcements = append(announcements, networkMsg{
|
announcements = append(announcements, networkMsg{
|
||||||
peer: nMsg.peer,
|
peer: nMsg.peer,
|
||||||
source: nMsg.source,
|
source: nMsg.source,
|
||||||
msg: upd,
|
isRemote: nMsg.isRemote,
|
||||||
|
msg: upd,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -824,6 +824,8 @@ func TestProcessAnnouncement(t *testing.T) {
|
|||||||
require.NoError(t, err, "can't create context")
|
require.NoError(t, err, "can't create context")
|
||||||
|
|
||||||
assertSenderExistence := func(sender *btcec.PublicKey, msg msgWithSenders) {
|
assertSenderExistence := func(sender *btcec.PublicKey, msg msgWithSenders) {
|
||||||
|
t.Helper()
|
||||||
|
|
||||||
if _, ok := msg.senders[route.NewVertex(sender)]; !ok {
|
if _, ok := msg.senders[route.NewVertex(sender)]; !ok {
|
||||||
t.Fatalf("sender=%x not present in %v",
|
t.Fatalf("sender=%x not present in %v",
|
||||||
sender.SerializeCompressed(), spew.Sdump(msg))
|
sender.SerializeCompressed(), spew.Sdump(msg))
|
||||||
|
|||||||
Reference in new issue
Block a user