@@ -1183,9 +1183,7 @@ impl <SP: Deref> PeerState<SP> where SP::Target: SignerProvider {
11831183 match phase {
11841184 ChannelPhase::Funded(_) | ChannelPhase::UnfundedOutboundV1(_) => true,
11851185 ChannelPhase::UnfundedInboundV1(_) => false,
1186- #[cfg(any(dual_funding, splicing))]
11871186 ChannelPhase::UnfundedOutboundV2(_) => true,
1188- #[cfg(any(dual_funding, splicing))]
11891187 ChannelPhase::UnfundedInboundV2(_) => false,
11901188 }
11911189 )
@@ -2814,11 +2812,9 @@ macro_rules! convert_chan_phase_err {
28142812 ChannelPhase::UnfundedInboundV1(channel) => {
28152813 convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
28162814 },
2817- #[cfg(any(dual_funding, splicing))]
28182815 ChannelPhase::UnfundedOutboundV2(channel) => {
28192816 convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
28202817 },
2821- #[cfg(any(dual_funding, splicing))]
28222818 ChannelPhase::UnfundedInboundV2(channel) => {
28232819 convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
28242820 },
@@ -3732,13 +3728,7 @@ where
37323728 self.finish_close_channel(chan.context.force_shutdown(broadcast, closure_reason));
37333729 (self.get_channel_update_for_broadcast(&chan).ok(), chan.context.get_counterparty_node_id())
37343730 },
3735- ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => {
3736- self.finish_close_channel(chan_phase.context_mut().force_shutdown(false, closure_reason));
3737- // Unfunded channel has no update
3738- (None, chan_phase.context().get_counterparty_node_id())
3739- },
3740- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
3741- #[cfg(any(dual_funding, splicing))]
3731+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) |
37423732 ChannelPhase::UnfundedOutboundV2(_) | ChannelPhase::UnfundedInboundV2(_) => {
37433733 self.finish_close_channel(chan_phase.context_mut().force_shutdown(false, closure_reason));
37443734 // Unfunded channel has no update
@@ -6262,12 +6252,10 @@ where
62626252 process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
62636253 pending_msg_events, counterparty_node_id)
62646254 },
6265- #[cfg(any(dual_funding, splicing))]
62666255 ChannelPhase::UnfundedInboundV2(chan) => {
62676256 process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
62686257 pending_msg_events, counterparty_node_id)
62696258 },
6270- #[cfg(any(dual_funding, splicing))]
62716259 ChannelPhase::UnfundedOutboundV2(chan) => {
62726260 process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
62736261 pending_msg_events, counterparty_node_id)
@@ -7583,8 +7571,6 @@ where
75837571 num_unfunded_channels += 1;
75847572 }
75857573 },
7586- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
7587- #[cfg(any(dual_funding, splicing))]
75887574 ChannelPhase::UnfundedInboundV2(chan) => {
75897575 // Only inbound V2 channels that are not 0conf and that we do not contribute to will be
75907576 // included in the unfunded count.
@@ -7593,16 +7579,10 @@ where
75937579 num_unfunded_channels += 1;
75947580 }
75957581 },
7596- ChannelPhase::UnfundedOutboundV1(_) => {
7582+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedOutboundV2(_) => {
75977583 // Outbound channels don't contribute to the unfunded count in the DoS context.
75987584 continue;
75997585 },
7600- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
7601- #[cfg(any(dual_funding, splicing))]
7602- ChannelPhase::UnfundedOutboundV2(_) => {
7603- // Outbound channels don't contribute to the unfunded count in the DoS context.
7604- continue;
7605- }
76067586 }
76077587 }
76087588 num_unfunded_channels + peer.inbound_channel_request_by_id.len()
@@ -8021,21 +8001,14 @@ where
80218001 peer_state_lock, peer_state, per_peer_state, chan);
80228002 }
80238003 },
8024- ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) => {
8004+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) |
8005+ ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {
80258006 let context = phase.context_mut();
80268007 let logger = WithChannelContext::from(&self.logger, context, None);
80278008 log_error!(logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
80288009 let mut chan = remove_channel_phase!(self, chan_phase_entry);
80298010 finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
80308011 },
8031- // TODO(dual_funding): Combine this match arm with above.
8032- #[cfg(any(dual_funding, splicing))]
8033- ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {
8034- let context = phase.context_mut();
8035- log_error!(self.logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
8036- let mut chan = remove_channel_phase!(self, chan_phase_entry);
8037- finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
8038- },
80398012 }
80408013 } else {
80418014 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))
@@ -8956,7 +8929,7 @@ where
89568929 }
89578930 None
89588931 }
8959- ChannelPhase::UnfundedInboundV1(_) => None,
8932+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => None,
89608933 }
89618934 };
89628935
@@ -10184,9 +10157,7 @@ where
1018410157 peer_state.channel_by_id.retain(|_, phase| {
1018510158 match phase {
1018610159 // Retain unfunded channels.
10187- ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => true,
10188- // TODO(dual_funding): Combine this match arm with above.
10189- #[cfg(any(dual_funding, splicing))]
10160+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) |
1019010161 ChannelPhase::UnfundedOutboundV2(_) | ChannelPhase::UnfundedInboundV2(_) => true,
1019110162 ChannelPhase::Funded(channel) => {
1019210163 let res = f(channel);
@@ -10669,11 +10640,9 @@ where
1066910640 ChannelPhase::UnfundedInboundV1(chan) => {
1067010641 &mut chan.context
1067110642 },
10672- #[cfg(any(dual_funding, splicing))]
1067310643 ChannelPhase::UnfundedOutboundV2(chan) => {
1067410644 &mut chan.context
1067510645 },
10676- #[cfg(any(dual_funding, splicing))]
1067710646 ChannelPhase::UnfundedInboundV2(chan) => {
1067810647 &mut chan.context
1067910648 },
@@ -10834,30 +10803,19 @@ where
1083410803 });
1083510804 }
1083610805
10837- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
10838- #[cfg(any(dual_funding, splicing))]
1083910806 ChannelPhase::UnfundedOutboundV2(chan) => {
1084010807 pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
1084110808 node_id: chan.context.get_counterparty_node_id(),
1084210809 msg: chan.get_open_channel_v2(self.chain_hash),
1084310810 });
1084410811 },
1084510812
10846- ChannelPhase::UnfundedInboundV1(_) => {
10813+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) => {
1084710814 // Since unfunded inbound channel maps are cleared upon disconnecting a peer,
1084810815 // they are not persisted and won't be recovered after a crash.
1084910816 // Therefore, they shouldn't exist at this point.
1085010817 debug_assert!(false);
1085110818 }
10852-
10853- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
10854- #[cfg(any(dual_funding, splicing))]
10855- ChannelPhase::UnfundedInboundV2(channel) => {
10856- // Since unfunded inbound channel maps are cleared upon disconnecting a peer,
10857- // they are not persisted and won't be recovered after a crash.
10858- // Therefore, they shouldn't exist at this point.
10859- debug_assert!(false);
10860- },
1086110819 }
1086210820 }
1086310821 }
@@ -10954,7 +10912,6 @@ where
1095410912 return;
1095510913 }
1095610914 },
10957- #[cfg(any(dual_funding, splicing))]
1095810915 Some(ChannelPhase::UnfundedOutboundV2(ref mut chan)) => {
1095910916 if let Ok(msg) = chan.maybe_handle_error_without_close(self.chain_hash, &self.fee_estimator) {
1096010917 peer_state.pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
@@ -10964,9 +10921,7 @@ where
1096410921 return;
1096510922 }
1096610923 },
10967- None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::Funded(_)) => (),
10968- #[cfg(any(dual_funding, splicing))]
10969- Some(ChannelPhase::UnfundedInboundV2(_)) => (),
10924+ None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::Funded(_)) => (),
1097010925 }
1097110926 }
1097210927
0 commit comments