Skip to content

Commit 4ed4d02

Browse files
committed
f add comments suggested by val
1 parent 6512f01 commit 4ed4d02

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,18 @@ macro_rules! handle_chan_restoration_locked {
813813

814814
let chanmon_update: Option<ChannelMonitorUpdate> = $chanmon_update; // Force type-checking to resolve
815815
if chanmon_update.is_some() {
816-
assert!($commitment_update.is_some());
816+
// On reconnect (or monitor restoration), we, by definition, only resend a
817+
// funding_locked if there have been no commitment updates, so the only channel
818+
// monitor update which could also be associated with a funding_locked would be
819+
// the funding_created/funding_signed monitor update. That monitor update failing
820+
// implies that we won't send funding_locked until its been updated, so we can't
821+
// have a funding_locked and a monitor update here (so we don't bother to handle it
822+
// correctly below).
817823
assert!($funding_locked.is_none());
824+
// A channel monitor update makes no sense without either a funding_locked or a
825+
// commitment update to process after it. Since we can't have a funding_locked, we
826+
// only bother to handle the monitor-update + commitment_update case below.
827+
assert!($commitment_update.is_some());
818828
}
819829

820830
if let Some(msg) = $funding_locked {

0 commit comments

Comments
 (0)