From: Matt Corallo Date: Wed, 5 Jul 2023 17:06:19 +0000 (+0000) Subject: Add comment describing when a completion action can be discarded X-Git-Tag: v0.0.116-rc1~4^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=550cf91439a2aa2befe89704e13c781800e8612e;p=rust-lightning Add comment describing when a completion action can be discarded In an older PR a reviewer had asked why the discarding of a channel being blocked on another monitor update is okay if the blocked channel has since closed. At the time, this was not actually okay - the monitor updates in the channel weren't moved to the `ChannelManager` on close so the whole pipeline was busted, but with the changes in 4041f0899f86eaf6a0a4576a91918fa54026ac46 the handling of channel closes with pending monitor updates is now correct, and so is the existing code block. --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index b4eed11f..7ec75e20 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -8943,6 +8943,12 @@ where blocked_peer_state.lock().unwrap().actions_blocking_raa_monitor_updates .entry(blocked_channel_outpoint.to_channel_id()) .or_insert_with(Vec::new).push(blocking_action.clone()); + } else { + // If the channel we were blocking has closed, we don't need to + // worry about it - the blocked monitor update should never have + // been released from the `Channel` object so it can't have + // completed, and if the channel closed there's no reason to bother + // anymore. } } }