From: Wilmer Paulino Date: Mon, 22 Jan 2024 23:28:59 +0000 (-0800) Subject: Remove unreachable handling of htlc_forwards upon channel_reestablish X-Git-Tag: v0.0.123-beta~21^2~11 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=60ddd5d036f84f8df1be9aa27998873c40a341d2;p=rust-lightning 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. --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index bddcd4c9b..505337865 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -7265,7 +7265,6 @@ where } fn internal_channel_reestablish(&self, counterparty_node_id: &PublicKey, msg: &msgs::ChannelReestablish) -> Result { - let htlc_forwards; let need_lnd_workaround = { let per_peer_state = self.per_peer_state.read().unwrap(); @@ -7308,9 +7307,10 @@ where } } let need_lnd_workaround = chan.context.workaround_lnd_bug_4006.take(); - htlc_forwards = self.handle_channel_resumption( + let htlc_forwards = self.handle_channel_resumption( &mut peer_state.pending_msg_events, chan, responses.raa, responses.commitment_update, responses.order, Vec::new(), None, responses.channel_ready, responses.announcement_sigs); + debug_assert!(htlc_forwards.is_none()); if let Some(upd) = channel_update { peer_state.pending_msg_events.push(upd); } @@ -7356,16 +7356,10 @@ where } }; - let mut persist = NotifyOption::SkipPersistHandleEvents; - if let Some(forwards) = htlc_forwards { - self.forward_htlcs(&mut [forwards][..]); - persist = NotifyOption::DoPersist; - } - if let Some(channel_ready_msg) = need_lnd_workaround { self.internal_channel_ready(counterparty_node_id, &channel_ready_msg)?; } - Ok(persist) + Ok(NotifyOption::SkipPersistHandleEvents) } /// Process pending events from the [`chain::Watch`], returning whether any events were processed.