Skip to content

Commit e3225a9

Browse files
committed
Correct channel closed detection in payment state replay
While the case of not having a per-peer-state for a peer that we have a `ChannelMonitor` with should be unreachable by this point in `ChannelManager` loading (we have to at least store the latest update id of the monitor in the peer state), considering a channel as still-live and not replaying its payment state when we don't have a per-peer-state is wrong, so here we fix it.
1 parent b7f0c6e commit e3225a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16455,7 +16455,7 @@ where
1645516455
// First we rebuild all pending payments, then separately re-claim and re-fail pending
1645616456
// payments. This avoids edge-cases around MPP payments resulting in redundant actions.
1645716457
for (channel_id, monitor) in args.channel_monitors.iter() {
16458-
let mut is_channel_closed = false;
16458+
let mut is_channel_closed = true;
1645916459
let counterparty_node_id = monitor.get_counterparty_node_id();
1646016460
if let Some(peer_state_mtx) = per_peer_state.get(&counterparty_node_id) {
1646116461
let mut peer_state_lock = peer_state_mtx.lock().unwrap();
@@ -16495,7 +16495,7 @@ where
1649516495
}
1649616496
}
1649716497
for (channel_id, monitor) in args.channel_monitors.iter() {
16498-
let mut is_channel_closed = false;
16498+
let mut is_channel_closed = true;
1649916499
let counterparty_node_id = monitor.get_counterparty_node_id();
1650016500
if let Some(peer_state_mtx) = per_peer_state.get(&counterparty_node_id) {
1650116501
let mut peer_state_lock = peer_state_mtx.lock().unwrap();

0 commit comments

Comments
 (0)