mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 07:17:40 +01:00
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.
This commit is contained in:
parent
fe0f845582
commit
e0255c0fff
1 changed files with 6 additions and 0 deletions
|
@ -7350,6 +7350,9 @@ where
|
||||||
self.issue_channel_close_events(&chan.context, ClosureReason::DisconnectedPeer);
|
self.issue_channel_close_events(&chan.context, ClosureReason::DisconnectedPeer);
|
||||||
false
|
false
|
||||||
});
|
});
|
||||||
|
// Note that we don't bother generating any events for pre-accept channels -
|
||||||
|
// they're not considered "channels" yet from the PoV of our events interface.
|
||||||
|
peer_state.inbound_channel_request_by_id.clear();
|
||||||
pending_msg_events.retain(|msg| {
|
pending_msg_events.retain(|msg| {
|
||||||
match msg {
|
match msg {
|
||||||
// V1 Channel Establishment
|
// V1 Channel Establishment
|
||||||
|
@ -7493,6 +7496,9 @@ where
|
||||||
if peer_state_mutex_opt.is_none() { return; }
|
if peer_state_mutex_opt.is_none() { return; }
|
||||||
let mut peer_state_lock = peer_state_mutex_opt.unwrap().lock().unwrap();
|
let mut peer_state_lock = peer_state_mutex_opt.unwrap().lock().unwrap();
|
||||||
let peer_state = &mut *peer_state_lock;
|
let peer_state = &mut *peer_state_lock;
|
||||||
|
// Note that we don't bother generating any events for pre-accept channels -
|
||||||
|
// they're not considered "channels" yet from the PoV of our events interface.
|
||||||
|
peer_state.inbound_channel_request_by_id.clear();
|
||||||
peer_state.channel_by_id.keys().cloned()
|
peer_state.channel_by_id.keys().cloned()
|
||||||
.chain(peer_state.outbound_v1_channel_by_id.keys().cloned())
|
.chain(peer_state.outbound_v1_channel_by_id.keys().cloned())
|
||||||
.chain(peer_state.inbound_v1_channel_by_id.keys().cloned()).collect()
|
.chain(peer_state.inbound_v1_channel_by_id.keys().cloned()).collect()
|
||||||
|
|
Loading…
Add table
Reference in a new issue