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 2022-12-08 17:47:33 -08:00
parent 52451b37af
commit f94a67a26d
No known key found for this signature in database
GPG key ID: 3BBD59E99B280306
2 changed files with 18 additions and 12 deletions

View file

@ -1182,7 +1182,7 @@ func (d *AuthenticatedGossiper) sendBatch(annBatch []msgWithSenders,
isLocal bool) {
// 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.
if isLocal {
msgsToSend := fn.Map(
@ -1696,6 +1696,7 @@ func (d *AuthenticatedGossiper) processChanPolicyUpdate(
// that we shouldn't skip any peers when sending this message.
chanUpdates = append(chanUpdates, networkMsg{
source: d.selfKey,
isRemote: false,
msg: chanUpdate,
})
}
@ -2267,6 +2268,7 @@ func (d *AuthenticatedGossiper) handleNodeAnnouncement(nMsg *networkMsg,
if isPublic {
announcements = append(announcements, networkMsg{
peer: nMsg.peer,
isRemote: nMsg.isRemote,
source: nMsg.source,
msg: nodeAnn,
})
@ -2545,6 +2547,7 @@ func (d *AuthenticatedGossiper) handleChanAnnouncement(nMsg *networkMsg,
if proof != nil {
announcements = append(announcements, networkMsg{
peer: nMsg.peer,
isRemote: nMsg.isRemote,
source: nMsg.source,
msg: ann,
})
@ -2934,6 +2937,7 @@ func (d *AuthenticatedGossiper) handleChanUpdate(nMsg *networkMsg,
announcements = append(announcements, networkMsg{
peer: nMsg.peer,
source: nMsg.source,
isRemote: nMsg.isRemote,
msg: upd,
})
}

View file

@ -824,6 +824,8 @@ func TestProcessAnnouncement(t *testing.T) {
require.NoError(t, err, "can't create context")
assertSenderExistence := func(sender *btcec.PublicKey, msg msgWithSenders) {
t.Helper()
if _, ok := msg.senders[route.NewVertex(sender)]; !ok {
t.Fatalf("sender=%x not present in %v",
sender.SerializeCompressed(), spew.Sdump(msg))