Skip to content

Commit 96259f5

Browse files
committed
Fallback close_channel_internal to force close pending channels
1 parent 2755d0b commit 96259f5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2340,6 +2340,14 @@ where
23402340

23412341
let mut peer_state_lock = peer_state_mutex.lock().unwrap();
23422342
let peer_state = &mut *peer_state_lock;
2343+
2344+
if peer_state.has_pending_channel(&channel_id) {
2345+
// If the channel was still in a pending channel map, then we force-close the channel, ignoring
2346+
// any channel-not-found errors.
2347+
let _ = self.force_close_channel_with_peer(&channel_id, counterparty_node_id, None, false);
2348+
return Ok(());
2349+
}
2350+
23432351
match peer_state.channel_by_id.entry(channel_id.clone()) {
23442352
hash_map::Entry::Occupied(mut chan_entry) => {
23452353
let funding_txo_opt = chan_entry.get().context.get_funding_txo();

0 commit comments

Comments
 (0)