Skip to content

Commit 82771bb

Browse files
committed
f always insert a latest_update_id even if the chan is closed
1 parent 0bf2975 commit 82771bb

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

lightning/src/ln/channelmanager.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -12574,10 +12574,20 @@ where
1257412574
}
1257512575

1257612576
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+
1257712586
if monitor.offchain_closed() {
1257812587
// We already appled a ChannelForceClosed update.
1257912588
continue;
1258012589
}
12590+
1258112591
if !funding_txo_set.contains(funding_txo) {
1258212592
let logger = WithChannelMonitor::from(&args.logger, monitor, None);
1258312593
let channel_id = monitor.channel_id();
@@ -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)