Skip to content

Commit 0ad0d60

Browse files
committed
f always insert a latest_update_id even if the chan is closed
1 parent 2c0f86c commit 0ad0d60

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

lightning/src/ln/channelmanager.rs

+14-11
Original file line numberDiff line numberDiff line change
@@ -12574,11 +12574,21 @@ where
1257412574
}
1257512575

1257612576
for (funding_txo, monitor) in args.channel_monitors.iter() {
12577-
if monitor.offchain_closed() {
12578-
// We already appled a ChannelForceClosed update.
12579-
continue;
12580-
}
1258112577
if !funding_txo_set.contains(funding_txo) {
12578+
if let Some(counterparty_node_id) = monitor.get_counterparty_node_id() {
12579+
per_peer_state.entry(counterparty_node_id)
12580+
.or_insert_with(|| Mutex::new(empty_peer_state()))
12581+
.lock().unwrap()
12582+
.closed_channel_monitor_update_ids.entry(monitor.channel_id())
12583+
.and_modify(|v| *v = cmp::max(monitor.get_latest_update_id(), *v))
12584+
.or_insert(monitor.get_latest_update_id());
12585+
}
12586+
12587+
if monitor.offchain_closed() {
12588+
// We already appled a ChannelForceClosed update.
12589+
continue;
12590+
}
12591+
1258212592
let logger = WithChannelMonitor::from(&args.logger, monitor, None);
1258312593
let channel_id = monitor.channel_id();
1258412594
log_info!(logger, "Queueing monitor update to ensure missing channel {} is force closed",
@@ -12597,13 +12607,6 @@ where
1259712607
update: monitor_update,
1259812608
};
1259912609
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());
1260712610
} else {
1260812611
// This is a fairly old `ChannelMonitor` that hasn't seen an update to its
1260912612
// off-chain state since LDK 0.0.118 (as in LDK 0.0.119 any off-chain

0 commit comments

Comments
 (0)