Merge pull request #3145 from federicobond/avoid-pubkey-serialization

discovery,fundingmanager: avoid serialization in NotifyWhenOnline
This commit is contained in:
Johan T. Halseth authored and GitHub committed 2019-06-12 10:50:35 +02:00
commit 00a86696a8
7 files changed
+64 -47

No files matched your search

+3 -4
View File
@@ -2125,21 +2125,20 @@ func (s *server) BroadcastMessage(skips map[route.Vertex]struct{},
// particular peer comes online. The peer itself is sent across the peerChan.
//
// NOTE: This function is safe for concurrent access.
func (s *server) NotifyWhenOnline(peerKey *btcec.PublicKey,
func (s *server) NotifyWhenOnline(peerKey [33]byte,
peerChan chan<- lnpeer.Peer) {
s.mu.Lock()
defer s.mu.Unlock()
// Compute the target peer's identifier.
pubStr := string(peerKey.SerializeCompressed())
pubStr := string(peerKey[:])
// Check if peer is connected.
peer, ok := s.peersByPub[pubStr]
if ok {
// Connected, can return early.
srvrLog.Debugf("Notifying that peer %x is online",
peerKey.SerializeCompressed())
srvrLog.Debugf("Notifying that peer %x is online", peerKey)
select {
case peerChan <- peer: