lnd: fix notifying peer online event too early
We need to notify the peer is online only when it has been started successfully.
This commit is contained in:
1 file changed
+4
-2
@@ -4614,8 +4614,6 @@ func (s *server) addPeer(p *peer.Brontide) {
|
|||||||
// to clients listening for peer events.
|
// to clients listening for peer events.
|
||||||
var pubKey [33]byte
|
var pubKey [33]byte
|
||||||
copy(pubKey[:], pubBytes)
|
copy(pubKey[:], pubBytes)
|
||||||
|
|
||||||
s.peerNotifier.NotifyPeerOnline(pubKey)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// peerInitializer asynchronously starts a newly connected peer after it has
|
// peerInitializer asynchronously starts a newly connected peer after it has
|
||||||
@@ -4683,6 +4681,10 @@ func (s *server) peerInitializer(p *peer.Brontide) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete(s.peerConnectedListeners, pubStr)
|
delete(s.peerConnectedListeners, pubStr)
|
||||||
|
|
||||||
|
// Since the peer has been fully initialized, now it's time to notify
|
||||||
|
// the RPC about the peer online event.
|
||||||
|
s.peerNotifier.NotifyPeerOnline([33]byte(pubBytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
// peerTerminationWatcher waits until a peer has been disconnected unexpectedly,
|
// peerTerminationWatcher waits until a peer has been disconnected unexpectedly,
|
||||||
|
|||||||
Reference in new issue
Block a user