@@ -928,9 +928,7 @@ impl <SP: Deref> PeerState<SP> where SP::Target: SignerProvider {
928
928
match phase {
929
929
ChannelPhase::Funded(_) | ChannelPhase::UnfundedOutboundV1(_) => true,
930
930
ChannelPhase::UnfundedInboundV1(_) => false,
931
- #[cfg(any(dual_funding, splicing))]
932
931
ChannelPhase::UnfundedOutboundV2(_) => true,
933
- #[cfg(any(dual_funding, splicing))]
934
932
ChannelPhase::UnfundedInboundV2(_) => false,
935
933
}
936
934
)
@@ -2495,11 +2493,9 @@ macro_rules! convert_chan_phase_err {
2495
2493
ChannelPhase::UnfundedInboundV1(channel) => {
2496
2494
convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
2497
2495
},
2498
- #[cfg(any(dual_funding, splicing))]
2499
2496
ChannelPhase::UnfundedOutboundV2(channel) => {
2500
2497
convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
2501
2498
},
2502
- #[cfg(any(dual_funding, splicing))]
2503
2499
ChannelPhase::UnfundedInboundV2(channel) => {
2504
2500
convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
2505
2501
},
@@ -3371,13 +3367,7 @@ where
3371
3367
self.finish_close_channel(chan.context.force_shutdown(broadcast, closure_reason));
3372
3368
(self.get_channel_update_for_broadcast(&chan).ok(), chan.context.get_counterparty_node_id())
3373
3369
},
3374
- ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => {
3375
- self.finish_close_channel(chan_phase.context_mut().force_shutdown(false, closure_reason));
3376
- // Unfunded channel has no update
3377
- (None, chan_phase.context().get_counterparty_node_id())
3378
- },
3379
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
3380
- #[cfg(any(dual_funding, splicing))]
3370
+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) |
3381
3371
ChannelPhase::UnfundedOutboundV2(_) | ChannelPhase::UnfundedInboundV2(_) => {
3382
3372
self.finish_close_channel(chan_phase.context_mut().force_shutdown(false, closure_reason));
3383
3373
// Unfunded channel has no update
@@ -5721,12 +5711,10 @@ where
5721
5711
process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
5722
5712
pending_msg_events, counterparty_node_id)
5723
5713
},
5724
- #[cfg(any(dual_funding, splicing))]
5725
5714
ChannelPhase::UnfundedInboundV2(chan) => {
5726
5715
process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
5727
5716
pending_msg_events, counterparty_node_id)
5728
5717
},
5729
- #[cfg(any(dual_funding, splicing))]
5730
5718
ChannelPhase::UnfundedOutboundV2(chan) => {
5731
5719
process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
5732
5720
pending_msg_events, counterparty_node_id)
@@ -6896,8 +6884,6 @@ where
6896
6884
num_unfunded_channels += 1;
6897
6885
}
6898
6886
},
6899
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
6900
- #[cfg(any(dual_funding, splicing))]
6901
6887
ChannelPhase::UnfundedInboundV2(chan) => {
6902
6888
// Only inbound V2 channels that are not 0conf and that we do not contribute to will be
6903
6889
// included in the unfunded count.
@@ -6906,16 +6892,10 @@ where
6906
6892
num_unfunded_channels += 1;
6907
6893
}
6908
6894
},
6909
- ChannelPhase::UnfundedOutboundV1(_) => {
6895
+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedOutboundV2(_) => {
6910
6896
// Outbound channels don't contribute to the unfunded count in the DoS context.
6911
6897
continue;
6912
6898
},
6913
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
6914
- #[cfg(any(dual_funding, splicing))]
6915
- ChannelPhase::UnfundedOutboundV2(_) => {
6916
- // Outbound channels don't contribute to the unfunded count in the DoS context.
6917
- continue;
6918
- }
6919
6899
}
6920
6900
}
6921
6901
num_unfunded_channels + peer.inbound_channel_request_by_id.len()
@@ -7331,21 +7311,14 @@ where
7331
7311
peer_state_lock, peer_state, per_peer_state, chan);
7332
7312
}
7333
7313
},
7334
- ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) => {
7314
+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) |
7315
+ ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {
7335
7316
let context = phase.context_mut();
7336
7317
let logger = WithChannelContext::from(&self.logger, context, None);
7337
7318
log_error!(logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
7338
7319
let mut chan = remove_channel_phase!(self, chan_phase_entry);
7339
7320
finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
7340
7321
},
7341
- // TODO(dual_funding): Combine this match arm with above.
7342
- #[cfg(any(dual_funding, splicing))]
7343
- ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {
7344
- let context = phase.context_mut();
7345
- log_error!(self.logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
7346
- let mut chan = remove_channel_phase!(self, chan_phase_entry);
7347
- finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
7348
- },
7349
7322
}
7350
7323
} else {
7351
7324
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))
@@ -8221,7 +8194,7 @@ where
8221
8194
});
8222
8195
}
8223
8196
}
8224
- ChannelPhase::UnfundedInboundV1(_) => {},
8197
+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {},
8225
8198
}
8226
8199
};
8227
8200
@@ -9385,9 +9358,7 @@ where
9385
9358
peer_state.channel_by_id.retain(|_, phase| {
9386
9359
match phase {
9387
9360
// Retain unfunded channels.
9388
- ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => true,
9389
- // TODO(dual_funding): Combine this match arm with above.
9390
- #[cfg(any(dual_funding, splicing))]
9361
+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) |
9391
9362
ChannelPhase::UnfundedOutboundV2(_) | ChannelPhase::UnfundedInboundV2(_) => true,
9392
9363
ChannelPhase::Funded(channel) => {
9393
9364
let res = f(channel);
@@ -9868,11 +9839,9 @@ where
9868
9839
ChannelPhase::UnfundedInboundV1(chan) => {
9869
9840
&mut chan.context
9870
9841
},
9871
- #[cfg(any(dual_funding, splicing))]
9872
9842
ChannelPhase::UnfundedOutboundV2(chan) => {
9873
9843
&mut chan.context
9874
9844
},
9875
- #[cfg(any(dual_funding, splicing))]
9876
9845
ChannelPhase::UnfundedInboundV2(chan) => {
9877
9846
&mut chan.context
9878
9847
},
@@ -10033,30 +10002,19 @@ where
10033
10002
});
10034
10003
}
10035
10004
10036
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
10037
- #[cfg(any(dual_funding, splicing))]
10038
10005
ChannelPhase::UnfundedOutboundV2(chan) => {
10039
10006
pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
10040
10007
node_id: chan.context.get_counterparty_node_id(),
10041
10008
msg: chan.get_open_channel_v2(self.chain_hash),
10042
10009
});
10043
10010
},
10044
10011
10045
- ChannelPhase::UnfundedInboundV1(_) => {
10012
+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) => {
10046
10013
// Since unfunded inbound channel maps are cleared upon disconnecting a peer,
10047
10014
// they are not persisted and won't be recovered after a crash.
10048
10015
// Therefore, they shouldn't exist at this point.
10049
10016
debug_assert!(false);
10050
10017
}
10051
-
10052
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
10053
- #[cfg(any(dual_funding, splicing))]
10054
- ChannelPhase::UnfundedInboundV2(channel) => {
10055
- // Since unfunded inbound channel maps are cleared upon disconnecting a peer,
10056
- // they are not persisted and won't be recovered after a crash.
10057
- // Therefore, they shouldn't exist at this point.
10058
- debug_assert!(false);
10059
- },
10060
10018
}
10061
10019
}
10062
10020
}
@@ -10153,7 +10111,6 @@ where
10153
10111
return;
10154
10112
}
10155
10113
},
10156
- #[cfg(any(dual_funding, splicing))]
10157
10114
Some(ChannelPhase::UnfundedOutboundV2(ref mut chan)) => {
10158
10115
if let Ok(msg) = chan.maybe_handle_error_without_close(self.chain_hash, &self.fee_estimator) {
10159
10116
peer_state.pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
@@ -10163,9 +10120,7 @@ where
10163
10120
return;
10164
10121
}
10165
10122
},
10166
- None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::Funded(_)) => (),
10167
- #[cfg(any(dual_funding, splicing))]
10168
- Some(ChannelPhase::UnfundedInboundV2(_)) => (),
10123
+ None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::Funded(_)) => (),
10169
10124
}
10170
10125
}
10171
10126
0 commit comments