@@ -1182,9 +1182,7 @@ impl <SP: Deref> PeerState<SP> where SP::Target: SignerProvider {
11821182 match phase {
11831183 ChannelPhase::Funded(_) | ChannelPhase::UnfundedOutboundV1(_) => true,
11841184 ChannelPhase::UnfundedInboundV1(_) => false,
1185- #[cfg(any(dual_funding, splicing))]
11861185 ChannelPhase::UnfundedOutboundV2(_) => true,
1187- #[cfg(any(dual_funding, splicing))]
11881186 ChannelPhase::UnfundedInboundV2(_) => false,
11891187 }
11901188 )
@@ -2813,11 +2811,9 @@ macro_rules! convert_chan_phase_err {
28132811 ChannelPhase::UnfundedInboundV1(channel) => {
28142812 convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
28152813 },
2816- #[cfg(any(dual_funding, splicing))]
28172814 ChannelPhase::UnfundedOutboundV2(channel) => {
28182815 convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
28192816 },
2820- #[cfg(any(dual_funding, splicing))]
28212817 ChannelPhase::UnfundedInboundV2(channel) => {
28222818 convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
28232819 },
@@ -3731,13 +3727,7 @@ where
37313727 self.finish_close_channel(chan.context.force_shutdown(broadcast, closure_reason));
37323728 (self.get_channel_update_for_broadcast(&chan).ok(), chan.context.get_counterparty_node_id())
37333729 },
3734- ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => {
3735- self.finish_close_channel(chan_phase.context_mut().force_shutdown(false, closure_reason));
3736- // Unfunded channel has no update
3737- (None, chan_phase.context().get_counterparty_node_id())
3738- },
3739- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
3740- #[cfg(any(dual_funding, splicing))]
3730+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) |
37413731 ChannelPhase::UnfundedOutboundV2(_) | ChannelPhase::UnfundedInboundV2(_) => {
37423732 self.finish_close_channel(chan_phase.context_mut().force_shutdown(false, closure_reason));
37433733 // Unfunded channel has no update
@@ -6261,12 +6251,10 @@ where
62616251 process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
62626252 pending_msg_events, counterparty_node_id)
62636253 },
6264- #[cfg(any(dual_funding, splicing))]
62656254 ChannelPhase::UnfundedInboundV2(chan) => {
62666255 process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
62676256 pending_msg_events, counterparty_node_id)
62686257 },
6269- #[cfg(any(dual_funding, splicing))]
62706258 ChannelPhase::UnfundedOutboundV2(chan) => {
62716259 process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
62726260 pending_msg_events, counterparty_node_id)
@@ -7582,8 +7570,6 @@ where
75827570 num_unfunded_channels += 1;
75837571 }
75847572 },
7585- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
7586- #[cfg(any(dual_funding, splicing))]
75877573 ChannelPhase::UnfundedInboundV2(chan) => {
75887574 // Only inbound V2 channels that are not 0conf and that we do not contribute to will be
75897575 // included in the unfunded count.
@@ -7592,16 +7578,10 @@ where
75927578 num_unfunded_channels += 1;
75937579 }
75947580 },
7595- ChannelPhase::UnfundedOutboundV1(_) => {
7581+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedOutboundV2(_) => {
75967582 // Outbound channels don't contribute to the unfunded count in the DoS context.
75977583 continue;
75987584 },
7599- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
7600- #[cfg(any(dual_funding, splicing))]
7601- ChannelPhase::UnfundedOutboundV2(_) => {
7602- // Outbound channels don't contribute to the unfunded count in the DoS context.
7603- continue;
7604- }
76057585 }
76067586 }
76077587 num_unfunded_channels + peer.inbound_channel_request_by_id.len()
@@ -8020,21 +8000,14 @@ where
80208000 peer_state_lock, peer_state, per_peer_state, chan);
80218001 }
80228002 },
8023- ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) => {
8003+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) |
8004+ ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {
80248005 let context = phase.context_mut();
80258006 let logger = WithChannelContext::from(&self.logger, context, None);
80268007 log_error!(logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
80278008 let mut chan = remove_channel_phase!(self, chan_phase_entry);
80288009 finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
80298010 },
8030- // TODO(dual_funding): Combine this match arm with above.
8031- #[cfg(any(dual_funding, splicing))]
8032- ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {
8033- let context = phase.context_mut();
8034- log_error!(self.logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
8035- let mut chan = remove_channel_phase!(self, chan_phase_entry);
8036- finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
8037- },
80388011 }
80398012 } else {
80408013 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))
@@ -8955,7 +8928,7 @@ where
89558928 }
89568929 None
89578930 }
8958- ChannelPhase::UnfundedInboundV1(_) => None,
8931+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => None,
89598932 }
89608933 };
89618934
@@ -10183,9 +10156,7 @@ where
1018310156 peer_state.channel_by_id.retain(|_, phase| {
1018410157 match phase {
1018510158 // Retain unfunded channels.
10186- ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => true,
10187- // TODO(dual_funding): Combine this match arm with above.
10188- #[cfg(any(dual_funding, splicing))]
10159+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) |
1018910160 ChannelPhase::UnfundedOutboundV2(_) | ChannelPhase::UnfundedInboundV2(_) => true,
1019010161 ChannelPhase::Funded(channel) => {
1019110162 let res = f(channel);
@@ -10668,11 +10639,9 @@ where
1066810639 ChannelPhase::UnfundedInboundV1(chan) => {
1066910640 &mut chan.context
1067010641 },
10671- #[cfg(any(dual_funding, splicing))]
1067210642 ChannelPhase::UnfundedOutboundV2(chan) => {
1067310643 &mut chan.context
1067410644 },
10675- #[cfg(any(dual_funding, splicing))]
1067610645 ChannelPhase::UnfundedInboundV2(chan) => {
1067710646 &mut chan.context
1067810647 },
@@ -10833,30 +10802,19 @@ where
1083310802 });
1083410803 }
1083510804
10836- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
10837- #[cfg(any(dual_funding, splicing))]
1083810805 ChannelPhase::UnfundedOutboundV2(chan) => {
1083910806 pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
1084010807 node_id: chan.context.get_counterparty_node_id(),
1084110808 msg: chan.get_open_channel_v2(self.chain_hash),
1084210809 });
1084310810 },
1084410811
10845- ChannelPhase::UnfundedInboundV1(_) => {
10812+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) => {
1084610813 // Since unfunded inbound channel maps are cleared upon disconnecting a peer,
1084710814 // they are not persisted and won't be recovered after a crash.
1084810815 // Therefore, they shouldn't exist at this point.
1084910816 debug_assert!(false);
1085010817 }
10851-
10852- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
10853- #[cfg(any(dual_funding, splicing))]
10854- ChannelPhase::UnfundedInboundV2(channel) => {
10855- // Since unfunded inbound channel maps are cleared upon disconnecting a peer,
10856- // they are not persisted and won't be recovered after a crash.
10857- // Therefore, they shouldn't exist at this point.
10858- debug_assert!(false);
10859- },
1086010818 }
1086110819 }
1086210820 }
@@ -10953,7 +10911,6 @@ where
1095310911 return;
1095410912 }
1095510913 },
10956- #[cfg(any(dual_funding, splicing))]
1095710914 Some(ChannelPhase::UnfundedOutboundV2(ref mut chan)) => {
1095810915 if let Ok(msg) = chan.maybe_handle_error_without_close(self.chain_hash, &self.fee_estimator) {
1095910916 peer_state.pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
@@ -10963,9 +10920,7 @@ where
1096310920 return;
1096410921 }
1096510922 },
10966- None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::Funded(_)) => (),
10967- #[cfg(any(dual_funding, splicing))]
10968- Some(ChannelPhase::UnfundedInboundV2(_)) => (),
10923+ None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::Funded(_)) => (),
1096910924 }
1097010925 }
1097110926
0 commit comments