File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -3550,6 +3550,12 @@ impl<Signer: Sign> Channel<Signer> {
35503550 return ;
35513551 }
35523552
3553+ if self . channel_state & ( ChannelState :: PeerDisconnected as u32 ) == ( ChannelState :: PeerDisconnected as u32 ) {
3554+ // While the below code should be idempotent, it's simpler to just return early, as
3555+ // redundant disconnect events can fire, though they should be rare.
3556+ return ;
3557+ }
3558+
35533559 if self . announcement_sigs_state == AnnouncementSigsState :: MessageSent || self . announcement_sigs_state == AnnouncementSigsState :: Committed {
35543560 self . announcement_sigs_state = AnnouncementSigsState :: NotSent ;
35553561 }
Original file line number Diff line number Diff line change @@ -883,6 +883,9 @@ pub trait ChannelMessageHandler : MessageSendEventsProvider {
883883 /// is believed to be possible in the future (eg they're sending us messages we don't
884884 /// understand or indicate they require unknown feature bits), no_connection_possible is set
885885 /// and any outstanding channels should be failed.
886+ ///
887+ /// Note that in some rare cases this may be called without a corresponding
888+ /// [`Self::peer_connected`].
886889 fn peer_disconnected ( & self , their_node_id : & PublicKey , no_connection_possible : bool ) ;
887890
888891 /// Handle a peer reconnecting, possibly generating channel_reestablish message(s).
@@ -979,6 +982,9 @@ pub trait OnionMessageHandler : OnionMessageProvider {
979982 fn peer_connected ( & self , their_node_id : & PublicKey , init : & Init ) ;
980983 /// Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to
981984 /// drop and refuse to forward onion messages to this peer.
985+ ///
986+ /// Note that in some rare cases this may be called without a corresponding
987+ /// [`Self::peer_connected`].
982988 fn peer_disconnected ( & self , their_node_id : & PublicKey , no_connection_possible : bool ) ;
983989
984990 // Handler information:
You can’t perform that action at this time.
0 commit comments