Skip to content

Commit 45063ec

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 4cc8687 commit 45063ec

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7247,7 +7247,6 @@ where
72477247
}
72487248

72497249
fn internal_channel_reestablish(&self, counterparty_node_id: &PublicKey, msg: &msgs::ChannelReestablish) -> Result<NotifyOption, MsgHandleErrInternal> {
7250-
let htlc_forwards;
72517250
let need_lnd_workaround = {
72527251
let per_peer_state = self.per_peer_state.read().unwrap();
72537252

@@ -7290,9 +7289,10 @@ where
72907289
}
72917290
}
72927291
let need_lnd_workaround = chan.context.workaround_lnd_bug_4006.take();
7293-
htlc_forwards = self.handle_channel_resumption(
7292+
let htlc_forwards = self.handle_channel_resumption(
72947293
&mut peer_state.pending_msg_events, chan, responses.raa, responses.commitment_update, responses.order,
72957294
Vec::new(), None, responses.channel_ready, responses.announcement_sigs);
7295+
debug_assert!(htlc_forwards.is_none());
72967296
if let Some(upd) = channel_update {
72977297
peer_state.pending_msg_events.push(upd);
72987298
}
@@ -7338,16 +7338,10 @@ where
73387338
}
73397339
};
73407340

7341-
let mut persist = NotifyOption::SkipPersistHandleEvents;
7342-
if let Some(forwards) = htlc_forwards {
7343-
self.forward_htlcs(&mut [forwards][..]);
7344-
persist = NotifyOption::DoPersist;
7345-
}
7346-
73477341
if let Some(channel_ready_msg) = need_lnd_workaround {
73487342
self.internal_channel_ready(counterparty_node_id, &channel_ready_msg)?;
73497343
}
7350-
Ok(persist)
7344+
Ok(NotifyOption::SkipPersistHandleEvents)
73517345
}
73527346

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

0 commit comments

Comments
 (0)