From 68dabe359486878c8ef1f5b77b096557ae418786 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 26 Dec 2017 16:26:28 +0100 Subject: [PATCH] discovery: update usage of d.cfg.Broadcast to reflect recent API change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When broadcasting a set of messages, we must now call broadcast for each (msg, …senders) tuple, rather than just calling it once for the entire batch. --- discovery/gossiper.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/discovery/gossiper.go b/discovery/gossiper.go index 93ddc64d..a4147057 100644 --- a/discovery/gossiper.go +++ b/discovery/gossiper.go @@ -83,7 +83,8 @@ type Config struct { // that the daemon is connected to. If supplied, the exclude parameter // indicates that the target peer should be excluded from the // broadcast. - Broadcast func(exclude *btcec.PublicKey, msg ...lnwire.Message) error + Broadcast func(skips map[routing.Vertex]struct{}, + msg ...lnwire.Message) error // SendToPeer is a function which allows the service to send a set of // messages to a particular peer identified by the target public key. @@ -912,11 +913,15 @@ func (d *AuthenticatedGossiper) networkHandler() { // If we have new things to announce then broadcast // them to all our immediately connected peers. - err := d.cfg.Broadcast(nil, announcementBatch...) - if err != nil { - log.Errorf("unable to send batch "+ - "announcements: %v", err) - continue + for _, msgChunk := range announcementBatch { + err := d.cfg.Broadcast( + msgChunk.senders, msgChunk.msg, + ) + if err != nil { + log.Errorf("unable to send batch "+ + "announcements: %v", err) + continue + } } // If we're able to broadcast the current batch