diff --git a/server.go b/server.go index 692e59b3..1239a4b9 100644 --- a/server.go +++ b/server.go @@ -845,7 +845,7 @@ func (s *server) establishPersistentConnections() error { // messages to all peers other than the one specified by the `skip` parameter. // // NOTE: This function is safe for concurrent access. -func (s *server) BroadcastMessage(skip *btcec.PublicKey, +func (s *server) BroadcastMessage(skip map[routing.Vertex]struct{}, msgs ...lnwire.Message) error { s.mu.Lock() @@ -859,7 +859,7 @@ func (s *server) BroadcastMessage(skip *btcec.PublicKey, // // NOTE: This method MUST be called while the server's mutex is locked. func (s *server) broadcastMessages( - skip *btcec.PublicKey, + skips map[routing.Vertex]struct{}, msgs []lnwire.Message) error { srvrLog.Debugf("Broadcasting %v messages", len(msgs)) @@ -869,10 +869,13 @@ func (s *server) broadcastMessages( // throughout this process to ensure we deliver messages to exact set // of peers present at the time of invocation. var wg sync.WaitGroup - for pubStr, sPeer := range s.peersByPub { - if skip != nil && sPeer.addr.IdentityKey.IsEqual(skip) { - srvrLog.Debugf("Skipping %v in broadcast", pubStr) - continue + for _, sPeer := range s.peersByPub { + if skips != nil { + if _, ok := skips[sPeer.pubKeyBytes]; ok { + srvrLog.Tracef("Skipping %x in broadcast", + sPeer.pubKeyBytes[:]) + continue + } } // Dispatch a go routine to enqueue all messages to this peer.