+ let send_shutdown = (self.channel_state & ChannelState::LocalShutdownSent as u32) != ChannelState::LocalShutdownSent as u32;
+ let monitor_update = match self.shutdown_scriptpubkey {
+ Some(_) => None,
+ None => {
+ assert!(send_shutdown);
+ self.shutdown_scriptpubkey = Some(keys_provider.get_shutdown_scriptpubkey());
+ self.latest_monitor_update_id += 1;
+ Some(ChannelMonitorUpdate {
+ update_id: self.latest_monitor_update_id,
+ updates: vec![ChannelMonitorUpdateStep::ShutdownScript {
+ scriptpubkey: self.get_closing_scriptpubkey(),
+ }],
+ })
+ },
+ };
+ let shutdown = if send_shutdown {