From d44b48097781ee134a00bcc55f05d65af0f37dde Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Fri, 4 Jul 2025 04:01:54 +0800 Subject: [PATCH] lnd: fix notifying peer online event too early We need to notify the peer is online only when it has been started successfully. --- server.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server.go b/server.go index 952877d6e..4da9cbcea 100644 --- a/server.go +++ b/server.go @@ -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,