Skip to content

Commit e0255c0

Browse files
committed
Ensure we wipe pending un-accepted channel requests on err/discon.
If we have a pending inbound un-accepted channel but receive an error message for it from our peer, or our peer disconnects, we should remove the pending entry, ensuring any attempts to accept it fail.
1 parent fe0f845 commit e0255c0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7350,6 +7350,9 @@ where
73507350
self.issue_channel_close_events(&chan.context, ClosureReason::DisconnectedPeer);
73517351
false
73527352
});
7353+
// Note that we don't bother generating any events for pre-accept channels -
7354+
// they're not considered "channels" yet from the PoV of our events interface.
7355+
peer_state.inbound_channel_request_by_id.clear();
73537356
pending_msg_events.retain(|msg| {
73547357
match msg {
73557358
// V1 Channel Establishment
@@ -7493,6 +7496,9 @@ where
74937496
if peer_state_mutex_opt.is_none() { return; }
74947497
let mut peer_state_lock = peer_state_mutex_opt.unwrap().lock().unwrap();
74957498
let peer_state = &mut *peer_state_lock;
7499+
// Note that we don't bother generating any events for pre-accept channels -
7500+
// they're not considered "channels" yet from the PoV of our events interface.
7501+
peer_state.inbound_channel_request_by_id.clear();
74967502
peer_state.channel_by_id.keys().cloned()
74977503
.chain(peer_state.outbound_v1_channel_by_id.keys().cloned())
74987504
.chain(peer_state.inbound_v1_channel_by_id.keys().cloned()).collect()

0 commit comments

Comments
 (0)