mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 06:32:18 +02:00
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:
@@ -4614,8 +4614,6 @@ func (s *server) addPeer(p *peer.Brontide) {
|
||||
// to clients listening for peer events.
|
||||
var pubKey [33]byte
|
||||
copy(pubKey[:], pubBytes)
|
||||
|
||||
s.peerNotifier.NotifyPeerOnline(pubKey)
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
// 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,
|
||||
|
Reference in New Issue
Block a user