Merge pull request #2780 from wpaulino/2691-follow-ups
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Tue, 30 Jan 2024 23:21:42 +0000 (23:21 +0000)
committerGitHub <noreply@github.com>
Tue, 30 Jan 2024 23:21:42 +0000 (23:21 +0000)
2691 follow-ups

1  2 
lightning/src/ln/channel.rs

index d1c91ce1495fbbc636651b75cdc0fab2e62e11f3,949b88637e4a1f6f81100916b0d65ced0275b2b2..2007a9e772c780cafe02a308bbabf5ccd5142fca
@@@ -2388,13 -2412,9 +2413,9 @@@ impl<SP: Deref> ChannelContext<SP> wher
                        // 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 {
 +                              Some((self.get_counterparty_node_id(), funding_txo, self.channel_id(), ChannelMonitorUpdate {
                                        update_id: self.latest_monitor_update_id,
                                        counterparty_node_id: Some(self.counterparty_node_id),
                                        updates: vec![ChannelMonitorUpdateStep::ChannelForceClosed { should_broadcast }],
@@@ -2778,10 -2796,9 +2799,10 @@@ impl<SP: Deref> Channel<SP> wher
                        updates: vec![ChannelMonitorUpdateStep::PaymentPreimage {
                                payment_preimage: payment_preimage_arg.clone(),
                        }],
 +                      channel_id: Some(self.context.channel_id()),
                };
  
-               if self.context.channel_state.should_force_holding_cell() {
+               if !self.context.channel_state.can_generate_new_commitment() {
                        // Note that this condition is the same as the assertion in
                        // `claim_htlc_while_disconnected_dropping_mon_update` and must match exactly -
                        // `claim_htlc_while_disconnected_dropping_mon_update` would not work correctly if we