discovery: update usage of d.cfg.Broadcast to reflect recent API change
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.
This commit is contained in:
parent
702bf7be29
commit
68dabe3594
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user