Skip to content

Commit c6305f3

Browse files
committed
f add comment as to why we do a double-pass
1 parent 0a69a78 commit c6305f3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8386,6 +8386,15 @@ where
83868386
retry_lock: Mutex::new(())
83878387
};
83888388

8389+
// We have to replay (or skip, if they were completed after we wrote the `ChannelManager`)
8390+
// each `ChannelMonitorUpdate` in `in_flight_monitor_updates`. After doing so, we have to
8391+
// check that each channel we have isn't newer than the latest `ChannelMonitorUpdate`(s) we
8392+
// replayed, and for each monitor update we have to replay we have to ensure there's a
8393+
// `ChannelMonitor` for it.
8394+
//
8395+
// In order to do so we first walk the all of our live channels (so that we can check their
8396+
// state immediately after doing the update replays, when we have the `update_id`s
8397+
// available) and then walk any remaining in-flight updates.
83898398
let mut pending_background_events = Vec::new();
83908399
for (counterparty_id, peer_state_mtx) in per_peer_state.iter_mut() {
83918400
let mut peer_state_lock = peer_state_mtx.lock().unwrap();

0 commit comments

Comments
 (0)