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:
Olaoluwa Osuntokun committed 2022-12-15 11:56:44 -08:00
1 parent 52451b37af
commit f94a67a26d
2 files changed
+7 -1

No files matched your search

+5 -1
View File
@@ -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(
@@ -1696,6 +1696,7 @@ func (d *AuthenticatedGossiper) processChanPolicyUpdate(
// 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,
isRemote: false,
msg: chanUpdate, msg: chanUpdate,
}) })
} }
@@ -2267,6 +2268,7 @@ func (d *AuthenticatedGossiper) handleNodeAnnouncement(nMsg *networkMsg,
if isPublic { if isPublic {
announcements = append(announcements, networkMsg{ announcements = append(announcements, networkMsg{
peer: nMsg.peer, peer: nMsg.peer,
isRemote: nMsg.isRemote,
source: nMsg.source, source: nMsg.source,
msg: nodeAnn, msg: nodeAnn,
}) })
@@ -2545,6 +2547,7 @@ 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,
isRemote: nMsg.isRemote,
source: nMsg.source, source: nMsg.source,
msg: ann, msg: ann,
}) })
@@ -2934,6 +2937,7 @@ func (d *AuthenticatedGossiper) handleChanUpdate(nMsg *networkMsg,
announcements = append(announcements, networkMsg{ announcements = append(announcements, networkMsg{
peer: nMsg.peer, peer: nMsg.peer,
source: nMsg.source, source: nMsg.source,
isRemote: nMsg.isRemote,
msg: upd, msg: upd,
}) })
} }
+2
View File
@@ -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))