Skip to content

Commit c1ee493

Browse files
committed
Remove unreachable handling of htlc_forwards upon channel_reestablish
`htlc_forwards` only returns a `Some` value from `handle_channel_resumption` if we provide it a non-empty `pending_forwards`. Since we don't, we'll never have a value to handle.
1 parent 67f5ce8 commit c1ee493

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lightning/src/ln/channelmanager.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -7153,7 +7153,6 @@ where
71537153
}
71547154

71557155
fn internal_channel_reestablish(&self, counterparty_node_id: &PublicKey, msg: &msgs::ChannelReestablish) -> Result<NotifyOption, MsgHandleErrInternal> {
7156-
let htlc_forwards;
71577156
let need_lnd_workaround = {
71587157
let per_peer_state = self.per_peer_state.read().unwrap();
71597158

@@ -7196,9 +7195,10 @@ where
71967195
}
71977196
}
71987197
let need_lnd_workaround = chan.context.workaround_lnd_bug_4006.take();
7199-
htlc_forwards = self.handle_channel_resumption(
7198+
let htlc_forwards = self.handle_channel_resumption(
72007199
&mut peer_state.pending_msg_events, chan, responses.raa, responses.commitment_update, responses.order,
72017200
Vec::new(), None, responses.channel_ready, responses.announcement_sigs);
7201+
debug_assert!(htlc_forwards.is_none());
72027202
if let Some(upd) = channel_update {
72037203
peer_state.pending_msg_events.push(upd);
72047204
}
@@ -7244,16 +7244,10 @@ where
72447244
}
72457245
};
72467246

7247-
let mut persist = NotifyOption::SkipPersistHandleEvents;
7248-
if let Some(forwards) = htlc_forwards {
7249-
self.forward_htlcs(&mut [forwards][..]);
7250-
persist = NotifyOption::DoPersist;
7251-
}
7252-
72537247
if let Some(channel_ready_msg) = need_lnd_workaround {
72547248
self.internal_channel_ready(counterparty_node_id, &channel_ready_msg)?;
72557249
}
7256-
Ok(persist)
7250+
Ok(NotifyOption::SkipPersistHandleEvents)
72577251
}
72587252

72597253
/// Process pending events from the [`chain::Watch`], returning whether any events were processed.

0 commit comments

Comments
 (0)