]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Simplify ChannelState checks
authorWilmer Paulino <wilmer@wilmerpaulino.com>
Fri, 8 Dec 2023 18:21:29 +0000 (10:21 -0800)
committerWilmer Paulino <wilmer@wilmerpaulino.com>
Thu, 11 Jan 2024 02:29:00 +0000 (18:29 -0800)
lightning/src/ln/channel.rs

index 5cbc729948bd7210f2f5d12e75d7df0175509330..e77f502d1edb57230e83d3fc0aa15898e3c19cdd 100644 (file)
@@ -2389,11 +2389,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider  {
                        // funding transaction, don't return a funding txo (which prevents providing the
                        // monitor update to the user, even if we return one).
                        // See test_duplicate_chan_id and test_pre_lockin_no_chan_closed_update for more.
-                       let generate_monitor_update = match self.channel_state {
-                               ChannelState::AwaitingChannelReady(_)|ChannelState::ChannelReady(_)|ChannelState::ShutdownComplete => true,
-                               _ => false,
-                       };
-                       if generate_monitor_update {
+                       if !self.channel_state.is_pre_funded_state() {
                                self.latest_monitor_update_id = CLOSED_CHANNEL_UPDATE_ID;
                                Some((self.get_counterparty_node_id(), funding_txo, ChannelMonitorUpdate {
                                        update_id: self.latest_monitor_update_id,