@@ -12574,10 +12574,20 @@ where
12574
12574
}
12575
12575
12576
12576
for (funding_txo, monitor) in args.channel_monitors.iter() {
12577
+ if let Some(counterparty_node_id) = monitor.get_counterparty_node_id() {
12578
+ per_peer_state.entry(counterparty_node_id)
12579
+ .or_insert_with(|| Mutex::new(empty_peer_state()))
12580
+ .lock().unwrap()
12581
+ .closed_channel_monitor_update_ids.entry(monitor.channel_id())
12582
+ .and_modify(|v| *v = cmp::max(monitor.get_latest_update_id(), *v))
12583
+ .or_insert(monitor.get_latest_update_id());
12584
+ }
12585
+
12577
12586
if monitor.offchain_closed() {
12578
12587
// We already appled a ChannelForceClosed update.
12579
12588
continue;
12580
12589
}
12590
+
12581
12591
if !funding_txo_set.contains(funding_txo) {
12582
12592
let logger = WithChannelMonitor::from(&args.logger, monitor, None);
12583
12593
let channel_id = monitor.channel_id();
@@ -12597,13 +12607,6 @@ where
12597
12607
update: monitor_update,
12598
12608
};
12599
12609
close_background_events.push(update);
12600
-
12601
- per_peer_state.entry(counterparty_node_id)
12602
- .or_insert_with(|| Mutex::new(empty_peer_state()))
12603
- .lock().unwrap()
12604
- .closed_channel_monitor_update_ids.entry(monitor.channel_id())
12605
- .and_modify(|v| *v = cmp::max(monitor.get_latest_update_id(), *v))
12606
- .or_insert(monitor.get_latest_update_id());
12607
12610
} else {
12608
12611
// This is a fairly old `ChannelMonitor` that hasn't seen an update to its
12609
12612
// off-chain state since LDK 0.0.118 (as in LDK 0.0.119 any off-chain
0 commit comments