@@ -4731,20 +4731,16 @@ where
47314731 funded_chan
47324732 );
47334733 } else {
4734- let update_id = if let Some(latest_update_id) =
4734+ if let Some(latest_update_id) =
47354735 peer_state.closed_channel_monitor_update_ids.get_mut(&shutdown_res.channel_id)
47364736 {
47374737 *latest_update_id = latest_update_id.saturating_add(1);
4738- *latest_update_id
4739- } else {
4740- panic!("We need the latest ChannelMonitorUpdate ID to build a new update");
4741- };
4742- let monitor_update = ChannelMonitorUpdate {
4743- update_id,
4744- updates: vec![monitor_update_step],
4745- channel_id: Some(shutdown_res.channel_id),
4746- };
4747- handle_post_close_monitor_update!(
4738+ let monitor_update = ChannelMonitorUpdate {
4739+ update_id: *latest_update_id,
4740+ updates: vec![monitor_update_step],
4741+ channel_id: Some(shutdown_res.channel_id),
4742+ };
4743+ handle_post_close_monitor_update!(
47484744 self,
47494745 shutdown_res.channel_funding_txo
47504746 .expect("We must have had a funding txo if we are applying a post-close monitor update"),
@@ -4755,6 +4751,9 @@ where
47554751 shutdown_res.counterparty_node_id,
47564752 shutdown_res.channel_id
47574753 );
4754+ } else {
4755+ log_trace!(logger, "No channel or monitor to persist closed channel event");
4756+ };
47584757 }
47594758
47604759 let mut pending_events = self.pending_events.lock().unwrap();
0 commit comments