@@ -1135,9 +1135,7 @@ impl <SP: Deref> PeerState<SP> where SP::Target: SignerProvider {
11351135 match phase {
11361136 ChannelPhase::Funded(_) | ChannelPhase::UnfundedOutboundV1(_) => true,
11371137 ChannelPhase::UnfundedInboundV1(_) => false,
1138- #[cfg(any(dual_funding, splicing))]
11391138 ChannelPhase::UnfundedOutboundV2(_) => true,
1140- #[cfg(any(dual_funding, splicing))]
11411139 ChannelPhase::UnfundedInboundV2(_) => false,
11421140 }
11431141 )
@@ -2742,11 +2740,9 @@ macro_rules! convert_chan_phase_err {
27422740 ChannelPhase::UnfundedInboundV1(channel) => {
27432741 convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
27442742 },
2745- #[cfg(any(dual_funding, splicing))]
27462743 ChannelPhase::UnfundedOutboundV2(channel) => {
27472744 convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
27482745 },
2749- #[cfg(any(dual_funding, splicing))]
27502746 ChannelPhase::UnfundedInboundV2(channel) => {
27512747 convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
27522748 },
@@ -3656,13 +3652,7 @@ where
36563652 self.finish_close_channel(chan.context.force_shutdown(broadcast, closure_reason));
36573653 (self.get_channel_update_for_broadcast(&chan).ok(), chan.context.get_counterparty_node_id())
36583654 },
3659- ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => {
3660- self.finish_close_channel(chan_phase.context_mut().force_shutdown(false, closure_reason));
3661- // Unfunded channel has no update
3662- (None, chan_phase.context().get_counterparty_node_id())
3663- },
3664- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
3665- #[cfg(any(dual_funding, splicing))]
3655+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) |
36663656 ChannelPhase::UnfundedOutboundV2(_) | ChannelPhase::UnfundedInboundV2(_) => {
36673657 self.finish_close_channel(chan_phase.context_mut().force_shutdown(false, closure_reason));
36683658 // Unfunded channel has no update
@@ -6181,12 +6171,10 @@ where
61816171 process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
61826172 pending_msg_events, counterparty_node_id)
61836173 },
6184- #[cfg(any(dual_funding, splicing))]
61856174 ChannelPhase::UnfundedInboundV2(chan) => {
61866175 process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
61876176 pending_msg_events, counterparty_node_id)
61886177 },
6189- #[cfg(any(dual_funding, splicing))]
61906178 ChannelPhase::UnfundedOutboundV2(chan) => {
61916179 process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
61926180 pending_msg_events, counterparty_node_id)
@@ -7498,8 +7486,6 @@ where
74987486 num_unfunded_channels += 1;
74997487 }
75007488 },
7501- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
7502- #[cfg(any(dual_funding, splicing))]
75037489 ChannelPhase::UnfundedInboundV2(chan) => {
75047490 // Only inbound V2 channels that are not 0conf and that we do not contribute to will be
75057491 // included in the unfunded count.
@@ -7508,16 +7494,10 @@ where
75087494 num_unfunded_channels += 1;
75097495 }
75107496 },
7511- ChannelPhase::UnfundedOutboundV1(_) => {
7497+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedOutboundV2(_) => {
75127498 // Outbound channels don't contribute to the unfunded count in the DoS context.
75137499 continue;
75147500 },
7515- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
7516- #[cfg(any(dual_funding, splicing))]
7517- ChannelPhase::UnfundedOutboundV2(_) => {
7518- // Outbound channels don't contribute to the unfunded count in the DoS context.
7519- continue;
7520- }
75217501 }
75227502 }
75237503 num_unfunded_channels + peer.inbound_channel_request_by_id.len()
@@ -7936,21 +7916,14 @@ where
79367916 peer_state_lock, peer_state, per_peer_state, chan);
79377917 }
79387918 },
7939- ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) => {
7919+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) |
7920+ ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {
79407921 let context = phase.context_mut();
79417922 let logger = WithChannelContext::from(&self.logger, context, None);
79427923 log_error!(logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
79437924 let mut chan = remove_channel_phase!(self, chan_phase_entry);
79447925 finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
79457926 },
7946- // TODO(dual_funding): Combine this match arm with above.
7947- #[cfg(any(dual_funding, splicing))]
7948- ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {
7949- let context = phase.context_mut();
7950- log_error!(self.logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
7951- let mut chan = remove_channel_phase!(self, chan_phase_entry);
7952- finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
7953- },
79547927 }
79557928 } else {
79567929 return Err(MsgHandleErrInternal::send_err_msg_no_close(format!("Got a message for a channel from the wrong node! No such channel for the passed counterparty_node_id {}", counterparty_node_id), msg.channel_id))
@@ -8871,7 +8844,7 @@ where
88718844 }
88728845 None
88738846 }
8874- ChannelPhase::UnfundedInboundV1(_) => None,
8847+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => None,
88758848 }
88768849 };
88778850
@@ -10093,9 +10066,7 @@ where
1009310066 peer_state.channel_by_id.retain(|_, phase| {
1009410067 match phase {
1009510068 // Retain unfunded channels.
10096- ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => true,
10097- // TODO(dual_funding): Combine this match arm with above.
10098- #[cfg(any(dual_funding, splicing))]
10069+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) |
1009910070 ChannelPhase::UnfundedOutboundV2(_) | ChannelPhase::UnfundedInboundV2(_) => true,
1010010071 ChannelPhase::Funded(channel) => {
1010110072 let res = f(channel);
@@ -10577,11 +10548,9 @@ where
1057710548 ChannelPhase::UnfundedInboundV1(chan) => {
1057810549 &mut chan.context
1057910550 },
10580- #[cfg(any(dual_funding, splicing))]
1058110551 ChannelPhase::UnfundedOutboundV2(chan) => {
1058210552 &mut chan.context
1058310553 },
10584- #[cfg(any(dual_funding, splicing))]
1058510554 ChannelPhase::UnfundedInboundV2(chan) => {
1058610555 &mut chan.context
1058710556 },
@@ -10742,30 +10711,19 @@ where
1074210711 });
1074310712 }
1074410713
10745- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
10746- #[cfg(any(dual_funding, splicing))]
1074710714 ChannelPhase::UnfundedOutboundV2(chan) => {
1074810715 pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
1074910716 node_id: chan.context.get_counterparty_node_id(),
1075010717 msg: chan.get_open_channel_v2(self.chain_hash),
1075110718 });
1075210719 },
1075310720
10754- ChannelPhase::UnfundedInboundV1(_) => {
10721+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) => {
1075510722 // Since unfunded inbound channel maps are cleared upon disconnecting a peer,
1075610723 // they are not persisted and won't be recovered after a crash.
1075710724 // Therefore, they shouldn't exist at this point.
1075810725 debug_assert!(false);
1075910726 }
10760-
10761- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
10762- #[cfg(any(dual_funding, splicing))]
10763- ChannelPhase::UnfundedInboundV2(channel) => {
10764- // Since unfunded inbound channel maps are cleared upon disconnecting a peer,
10765- // they are not persisted and won't be recovered after a crash.
10766- // Therefore, they shouldn't exist at this point.
10767- debug_assert!(false);
10768- },
1076910727 }
1077010728 }
1077110729 }
@@ -10862,7 +10820,6 @@ where
1086210820 return;
1086310821 }
1086410822 },
10865- #[cfg(any(dual_funding, splicing))]
1086610823 Some(ChannelPhase::UnfundedOutboundV2(ref mut chan)) => {
1086710824 if let Ok(msg) = chan.maybe_handle_error_without_close(self.chain_hash, &self.fee_estimator) {
1086810825 peer_state.pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
@@ -10872,9 +10829,7 @@ where
1087210829 return;
1087310830 }
1087410831 },
10875- None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::Funded(_)) => (),
10876- #[cfg(any(dual_funding, splicing))]
10877- Some(ChannelPhase::UnfundedInboundV2(_)) => (),
10832+ None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::Funded(_)) => (),
1087810833 }
1087910834 }
1088010835
0 commit comments