@@ -927,9 +927,7 @@ impl <SP: Deref> PeerState<SP> where SP::Target: SignerProvider {
927
927
match phase {
928
928
ChannelPhase::Funded(_) | ChannelPhase::UnfundedOutboundV1(_) => true,
929
929
ChannelPhase::UnfundedInboundV1(_) => false,
930
- #[cfg(any(dual_funding, splicing))]
931
930
ChannelPhase::UnfundedOutboundV2(_) => true,
932
- #[cfg(any(dual_funding, splicing))]
933
931
ChannelPhase::UnfundedInboundV2(_) => false,
934
932
}
935
933
)
@@ -2494,11 +2492,9 @@ macro_rules! convert_chan_phase_err {
2494
2492
ChannelPhase::UnfundedInboundV1(channel) => {
2495
2493
convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
2496
2494
},
2497
- #[cfg(any(dual_funding, splicing))]
2498
2495
ChannelPhase::UnfundedOutboundV2(channel) => {
2499
2496
convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
2500
2497
},
2501
- #[cfg(any(dual_funding, splicing))]
2502
2498
ChannelPhase::UnfundedInboundV2(channel) => {
2503
2499
convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
2504
2500
},
@@ -3370,13 +3366,7 @@ where
3370
3366
self.finish_close_channel(chan.context.force_shutdown(broadcast, closure_reason));
3371
3367
(self.get_channel_update_for_broadcast(&chan).ok(), chan.context.get_counterparty_node_id())
3372
3368
},
3373
- ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => {
3374
- self.finish_close_channel(chan_phase.context_mut().force_shutdown(false, closure_reason));
3375
- // Unfunded channel has no update
3376
- (None, chan_phase.context().get_counterparty_node_id())
3377
- },
3378
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
3379
- #[cfg(any(dual_funding, splicing))]
3369
+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) |
3380
3370
ChannelPhase::UnfundedOutboundV2(_) | ChannelPhase::UnfundedInboundV2(_) => {
3381
3371
self.finish_close_channel(chan_phase.context_mut().force_shutdown(false, closure_reason));
3382
3372
// Unfunded channel has no update
@@ -5667,12 +5657,10 @@ where
5667
5657
process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
5668
5658
pending_msg_events, counterparty_node_id)
5669
5659
},
5670
- #[cfg(any(dual_funding, splicing))]
5671
5660
ChannelPhase::UnfundedInboundV2(chan) => {
5672
5661
process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
5673
5662
pending_msg_events, counterparty_node_id)
5674
5663
},
5675
- #[cfg(any(dual_funding, splicing))]
5676
5664
ChannelPhase::UnfundedOutboundV2(chan) => {
5677
5665
process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
5678
5666
pending_msg_events, counterparty_node_id)
@@ -6842,8 +6830,6 @@ where
6842
6830
num_unfunded_channels += 1;
6843
6831
}
6844
6832
},
6845
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
6846
- #[cfg(any(dual_funding, splicing))]
6847
6833
ChannelPhase::UnfundedInboundV2(chan) => {
6848
6834
// Only inbound V2 channels that are not 0conf and that we do not contribute to will be
6849
6835
// included in the unfunded count.
@@ -6852,16 +6838,10 @@ where
6852
6838
num_unfunded_channels += 1;
6853
6839
}
6854
6840
},
6855
- ChannelPhase::UnfundedOutboundV1(_) => {
6841
+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedOutboundV2(_) => {
6856
6842
// Outbound channels don't contribute to the unfunded count in the DoS context.
6857
6843
continue;
6858
6844
},
6859
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
6860
- #[cfg(any(dual_funding, splicing))]
6861
- ChannelPhase::UnfundedOutboundV2(_) => {
6862
- // Outbound channels don't contribute to the unfunded count in the DoS context.
6863
- continue;
6864
- }
6865
6845
}
6866
6846
}
6867
6847
num_unfunded_channels + peer.inbound_channel_request_by_id.len()
@@ -7277,21 +7257,14 @@ where
7277
7257
peer_state_lock, peer_state, per_peer_state, chan);
7278
7258
}
7279
7259
},
7280
- ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) => {
7260
+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) |
7261
+ ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {
7281
7262
let context = phase.context_mut();
7282
7263
let logger = WithChannelContext::from(&self.logger, context, None);
7283
7264
log_error!(logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
7284
7265
let mut chan = remove_channel_phase!(self, chan_phase_entry);
7285
7266
finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
7286
7267
},
7287
- // TODO(dual_funding): Combine this match arm with above.
7288
- #[cfg(any(dual_funding, splicing))]
7289
- ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {
7290
- let context = phase.context_mut();
7291
- log_error!(self.logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
7292
- let mut chan = remove_channel_phase!(self, chan_phase_entry);
7293
- finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
7294
- },
7295
7268
}
7296
7269
} else {
7297
7270
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))
@@ -8167,7 +8140,7 @@ where
8167
8140
});
8168
8141
}
8169
8142
}
8170
- ChannelPhase::UnfundedInboundV1(_) => {},
8143
+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {},
8171
8144
}
8172
8145
};
8173
8146
@@ -9331,9 +9304,7 @@ where
9331
9304
peer_state.channel_by_id.retain(|_, phase| {
9332
9305
match phase {
9333
9306
// Retain unfunded channels.
9334
- ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => true,
9335
- // TODO(dual_funding): Combine this match arm with above.
9336
- #[cfg(any(dual_funding, splicing))]
9307
+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) |
9337
9308
ChannelPhase::UnfundedOutboundV2(_) | ChannelPhase::UnfundedInboundV2(_) => true,
9338
9309
ChannelPhase::Funded(channel) => {
9339
9310
let res = f(channel);
@@ -9814,11 +9785,9 @@ where
9814
9785
ChannelPhase::UnfundedInboundV1(chan) => {
9815
9786
&mut chan.context
9816
9787
},
9817
- #[cfg(any(dual_funding, splicing))]
9818
9788
ChannelPhase::UnfundedOutboundV2(chan) => {
9819
9789
&mut chan.context
9820
9790
},
9821
- #[cfg(any(dual_funding, splicing))]
9822
9791
ChannelPhase::UnfundedInboundV2(chan) => {
9823
9792
&mut chan.context
9824
9793
},
@@ -9979,30 +9948,19 @@ where
9979
9948
});
9980
9949
}
9981
9950
9982
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
9983
- #[cfg(any(dual_funding, splicing))]
9984
9951
ChannelPhase::UnfundedOutboundV2(chan) => {
9985
9952
pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
9986
9953
node_id: chan.context.get_counterparty_node_id(),
9987
9954
msg: chan.get_open_channel_v2(self.chain_hash),
9988
9955
});
9989
9956
},
9990
9957
9991
- ChannelPhase::UnfundedInboundV1(_) => {
9958
+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) => {
9992
9959
// Since unfunded inbound channel maps are cleared upon disconnecting a peer,
9993
9960
// they are not persisted and won't be recovered after a crash.
9994
9961
// Therefore, they shouldn't exist at this point.
9995
9962
debug_assert!(false);
9996
9963
}
9997
-
9998
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
9999
- #[cfg(any(dual_funding, splicing))]
10000
- ChannelPhase::UnfundedInboundV2(channel) => {
10001
- // Since unfunded inbound channel maps are cleared upon disconnecting a peer,
10002
- // they are not persisted and won't be recovered after a crash.
10003
- // Therefore, they shouldn't exist at this point.
10004
- debug_assert!(false);
10005
- },
10006
9964
}
10007
9965
}
10008
9966
}
@@ -10099,7 +10057,6 @@ where
10099
10057
return;
10100
10058
}
10101
10059
},
10102
- #[cfg(any(dual_funding, splicing))]
10103
10060
Some(ChannelPhase::UnfundedOutboundV2(ref mut chan)) => {
10104
10061
if let Ok(msg) = chan.maybe_handle_error_without_close(self.chain_hash, &self.fee_estimator) {
10105
10062
peer_state.pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
@@ -10109,9 +10066,7 @@ where
10109
10066
return;
10110
10067
}
10111
10068
},
10112
- None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::Funded(_)) => (),
10113
- #[cfg(any(dual_funding, splicing))]
10114
- Some(ChannelPhase::UnfundedInboundV2(_)) => (),
10069
+ None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::Funded(_)) => (),
10115
10070
}
10116
10071
}
10117
10072
0 commit comments