@@ -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
@@ -5719,12 +5709,10 @@ where
5719
5709
process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
5720
5710
pending_msg_events, counterparty_node_id)
5721
5711
},
5722
- #[cfg(any(dual_funding, splicing))]
5723
5712
ChannelPhase::UnfundedInboundV2(chan) => {
5724
5713
process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
5725
5714
pending_msg_events, counterparty_node_id)
5726
5715
},
5727
- #[cfg(any(dual_funding, splicing))]
5728
5716
ChannelPhase::UnfundedOutboundV2(chan) => {
5729
5717
process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
5730
5718
pending_msg_events, counterparty_node_id)
@@ -6894,8 +6882,6 @@ where
6894
6882
num_unfunded_channels += 1;
6895
6883
}
6896
6884
},
6897
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
6898
- #[cfg(any(dual_funding, splicing))]
6899
6885
ChannelPhase::UnfundedInboundV2(chan) => {
6900
6886
// Only inbound V2 channels that are not 0conf and that we do not contribute to will be
6901
6887
// included in the unfunded count.
@@ -6904,16 +6890,10 @@ where
6904
6890
num_unfunded_channels += 1;
6905
6891
}
6906
6892
},
6907
- ChannelPhase::UnfundedOutboundV1(_) => {
6893
+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedOutboundV2(_) => {
6908
6894
// Outbound channels don't contribute to the unfunded count in the DoS context.
6909
6895
continue;
6910
6896
},
6911
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
6912
- #[cfg(any(dual_funding, splicing))]
6913
- ChannelPhase::UnfundedOutboundV2(_) => {
6914
- // Outbound channels don't contribute to the unfunded count in the DoS context.
6915
- continue;
6916
- }
6917
6897
}
6918
6898
}
6919
6899
num_unfunded_channels + peer.inbound_channel_request_by_id.len()
@@ -7329,21 +7309,14 @@ where
7329
7309
peer_state_lock, peer_state, per_peer_state, chan);
7330
7310
}
7331
7311
},
7332
- ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) => {
7312
+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) |
7313
+ ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {
7333
7314
let context = phase.context_mut();
7334
7315
let logger = WithChannelContext::from(&self.logger, context, None);
7335
7316
log_error!(logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
7336
7317
let mut chan = remove_channel_phase!(self, chan_phase_entry);
7337
7318
finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
7338
7319
},
7339
- // TODO(dual_funding): Combine this match arm with above.
7340
- #[cfg(any(dual_funding, splicing))]
7341
- ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {
7342
- let context = phase.context_mut();
7343
- log_error!(self.logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
7344
- let mut chan = remove_channel_phase!(self, chan_phase_entry);
7345
- finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
7346
- },
7347
7320
}
7348
7321
} else {
7349
7322
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))
@@ -8219,7 +8192,7 @@ where
8219
8192
});
8220
8193
}
8221
8194
}
8222
- ChannelPhase::UnfundedInboundV1(_) => {},
8195
+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {},
8223
8196
}
8224
8197
};
8225
8198
@@ -9383,9 +9356,7 @@ where
9383
9356
peer_state.channel_by_id.retain(|_, phase| {
9384
9357
match phase {
9385
9358
// Retain unfunded channels.
9386
- ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => true,
9387
- // TODO(dual_funding): Combine this match arm with above.
9388
- #[cfg(any(dual_funding, splicing))]
9359
+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) |
9389
9360
ChannelPhase::UnfundedOutboundV2(_) | ChannelPhase::UnfundedInboundV2(_) => true,
9390
9361
ChannelPhase::Funded(channel) => {
9391
9362
let res = f(channel);
@@ -9866,11 +9837,9 @@ where
9866
9837
ChannelPhase::UnfundedInboundV1(chan) => {
9867
9838
&mut chan.context
9868
9839
},
9869
- #[cfg(any(dual_funding, splicing))]
9870
9840
ChannelPhase::UnfundedOutboundV2(chan) => {
9871
9841
&mut chan.context
9872
9842
},
9873
- #[cfg(any(dual_funding, splicing))]
9874
9843
ChannelPhase::UnfundedInboundV2(chan) => {
9875
9844
&mut chan.context
9876
9845
},
@@ -10031,30 +10000,19 @@ where
10031
10000
});
10032
10001
}
10033
10002
10034
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
10035
- #[cfg(any(dual_funding, splicing))]
10036
10003
ChannelPhase::UnfundedOutboundV2(chan) => {
10037
10004
pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
10038
10005
node_id: chan.context.get_counterparty_node_id(),
10039
10006
msg: chan.get_open_channel_v2(self.chain_hash),
10040
10007
});
10041
10008
},
10042
10009
10043
- ChannelPhase::UnfundedInboundV1(_) => {
10010
+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) => {
10044
10011
// Since unfunded inbound channel maps are cleared upon disconnecting a peer,
10045
10012
// they are not persisted and won't be recovered after a crash.
10046
10013
// Therefore, they shouldn't exist at this point.
10047
10014
debug_assert!(false);
10048
10015
}
10049
-
10050
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
10051
- #[cfg(any(dual_funding, splicing))]
10052
- ChannelPhase::UnfundedInboundV2(channel) => {
10053
- // Since unfunded inbound channel maps are cleared upon disconnecting a peer,
10054
- // they are not persisted and won't be recovered after a crash.
10055
- // Therefore, they shouldn't exist at this point.
10056
- debug_assert!(false);
10057
- },
10058
10016
}
10059
10017
}
10060
10018
}
@@ -10151,7 +10109,6 @@ where
10151
10109
return;
10152
10110
}
10153
10111
},
10154
- #[cfg(any(dual_funding, splicing))]
10155
10112
Some(ChannelPhase::UnfundedOutboundV2(ref mut chan)) => {
10156
10113
if let Ok(msg) = chan.maybe_handle_error_without_close(self.chain_hash, &self.fee_estimator) {
10157
10114
peer_state.pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
@@ -10161,9 +10118,7 @@ where
10161
10118
return;
10162
10119
}
10163
10120
},
10164
- None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::Funded(_)) => (),
10165
- #[cfg(any(dual_funding, splicing))]
10166
- Some(ChannelPhase::UnfundedInboundV2(_)) => (),
10121
+ None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::Funded(_)) => (),
10167
10122
}
10168
10123
}
10169
10124
0 commit comments