@@ -1012,9 +1012,7 @@ impl <SP: Deref> PeerState<SP> where SP::Target: SignerProvider {
1012
1012
match phase {
1013
1013
ChannelPhase::Funded(_) | ChannelPhase::UnfundedOutboundV1(_) => true,
1014
1014
ChannelPhase::UnfundedInboundV1(_) => false,
1015
- #[cfg(any(dual_funding, splicing))]
1016
1015
ChannelPhase::UnfundedOutboundV2(_) => true,
1017
- #[cfg(any(dual_funding, splicing))]
1018
1016
ChannelPhase::UnfundedInboundV2(_) => false,
1019
1017
}
1020
1018
)
@@ -2579,11 +2577,9 @@ macro_rules! convert_chan_phase_err {
2579
2577
ChannelPhase::UnfundedInboundV1(channel) => {
2580
2578
convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
2581
2579
},
2582
- #[cfg(any(dual_funding, splicing))]
2583
2580
ChannelPhase::UnfundedOutboundV2(channel) => {
2584
2581
convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
2585
2582
},
2586
- #[cfg(any(dual_funding, splicing))]
2587
2583
ChannelPhase::UnfundedInboundV2(channel) => {
2588
2584
convert_chan_phase_err!($self, $err, channel, $channel_id, UNFUNDED_CHANNEL)
2589
2585
},
@@ -3455,13 +3451,7 @@ where
3455
3451
self.finish_close_channel(chan.context.force_shutdown(broadcast, closure_reason));
3456
3452
(self.get_channel_update_for_broadcast(&chan).ok(), chan.context.get_counterparty_node_id())
3457
3453
},
3458
- ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => {
3459
- self.finish_close_channel(chan_phase.context_mut().force_shutdown(false, closure_reason));
3460
- // Unfunded channel has no update
3461
- (None, chan_phase.context().get_counterparty_node_id())
3462
- },
3463
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
3464
- #[cfg(any(dual_funding, splicing))]
3454
+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) |
3465
3455
ChannelPhase::UnfundedOutboundV2(_) | ChannelPhase::UnfundedInboundV2(_) => {
3466
3456
self.finish_close_channel(chan_phase.context_mut().force_shutdown(false, closure_reason));
3467
3457
// Unfunded channel has no update
@@ -5816,12 +5806,10 @@ where
5816
5806
process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
5817
5807
pending_msg_events, counterparty_node_id)
5818
5808
},
5819
- #[cfg(any(dual_funding, splicing))]
5820
5809
ChannelPhase::UnfundedInboundV2(chan) => {
5821
5810
process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
5822
5811
pending_msg_events, counterparty_node_id)
5823
5812
},
5824
- #[cfg(any(dual_funding, splicing))]
5825
5813
ChannelPhase::UnfundedOutboundV2(chan) => {
5826
5814
process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context,
5827
5815
pending_msg_events, counterparty_node_id)
@@ -7119,8 +7107,6 @@ where
7119
7107
num_unfunded_channels += 1;
7120
7108
}
7121
7109
},
7122
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
7123
- #[cfg(any(dual_funding, splicing))]
7124
7110
ChannelPhase::UnfundedInboundV2(chan) => {
7125
7111
// Only inbound V2 channels that are not 0conf and that we do not contribute to will be
7126
7112
// included in the unfunded count.
@@ -7129,16 +7115,10 @@ where
7129
7115
num_unfunded_channels += 1;
7130
7116
}
7131
7117
},
7132
- ChannelPhase::UnfundedOutboundV1(_) => {
7118
+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedOutboundV2(_) => {
7133
7119
// Outbound channels don't contribute to the unfunded count in the DoS context.
7134
7120
continue;
7135
7121
},
7136
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
7137
- #[cfg(any(dual_funding, splicing))]
7138
- ChannelPhase::UnfundedOutboundV2(_) => {
7139
- // Outbound channels don't contribute to the unfunded count in the DoS context.
7140
- continue;
7141
- }
7142
7122
}
7143
7123
}
7144
7124
num_unfunded_channels + peer.inbound_channel_request_by_id.len()
@@ -7554,21 +7534,14 @@ where
7554
7534
peer_state_lock, peer_state, per_peer_state, chan);
7555
7535
}
7556
7536
},
7557
- ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) => {
7537
+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) |
7538
+ ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {
7558
7539
let context = phase.context_mut();
7559
7540
let logger = WithChannelContext::from(&self.logger, context, None);
7560
7541
log_error!(logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
7561
7542
let mut chan = remove_channel_phase!(self, chan_phase_entry);
7562
7543
finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
7563
7544
},
7564
- // TODO(dual_funding): Combine this match arm with above.
7565
- #[cfg(any(dual_funding, splicing))]
7566
- ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {
7567
- let context = phase.context_mut();
7568
- log_error!(self.logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
7569
- let mut chan = remove_channel_phase!(self, chan_phase_entry);
7570
- finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
7571
- },
7572
7545
}
7573
7546
} else {
7574
7547
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))
@@ -8466,7 +8439,7 @@ where
8466
8439
});
8467
8440
}
8468
8441
}
8469
- ChannelPhase::UnfundedInboundV1(_) => {},
8442
+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {},
8470
8443
}
8471
8444
};
8472
8445
@@ -9633,9 +9606,7 @@ where
9633
9606
peer_state.channel_by_id.retain(|_, phase| {
9634
9607
match phase {
9635
9608
// Retain unfunded channels.
9636
- ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => true,
9637
- // TODO(dual_funding): Combine this match arm with above.
9638
- #[cfg(any(dual_funding, splicing))]
9609
+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) |
9639
9610
ChannelPhase::UnfundedOutboundV2(_) | ChannelPhase::UnfundedInboundV2(_) => true,
9640
9611
ChannelPhase::Funded(channel) => {
9641
9612
let res = f(channel);
@@ -10117,11 +10088,9 @@ where
10117
10088
ChannelPhase::UnfundedInboundV1(chan) => {
10118
10089
&mut chan.context
10119
10090
},
10120
- #[cfg(any(dual_funding, splicing))]
10121
10091
ChannelPhase::UnfundedOutboundV2(chan) => {
10122
10092
&mut chan.context
10123
10093
},
10124
- #[cfg(any(dual_funding, splicing))]
10125
10094
ChannelPhase::UnfundedInboundV2(chan) => {
10126
10095
&mut chan.context
10127
10096
},
@@ -10282,30 +10251,19 @@ where
10282
10251
});
10283
10252
}
10284
10253
10285
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
10286
- #[cfg(any(dual_funding, splicing))]
10287
10254
ChannelPhase::UnfundedOutboundV2(chan) => {
10288
10255
pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
10289
10256
node_id: chan.context.get_counterparty_node_id(),
10290
10257
msg: chan.get_open_channel_v2(self.chain_hash),
10291
10258
});
10292
10259
},
10293
10260
10294
- ChannelPhase::UnfundedInboundV1(_) => {
10261
+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) => {
10295
10262
// Since unfunded inbound channel maps are cleared upon disconnecting a peer,
10296
10263
// they are not persisted and won't be recovered after a crash.
10297
10264
// Therefore, they shouldn't exist at this point.
10298
10265
debug_assert!(false);
10299
10266
}
10300
-
10301
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
10302
- #[cfg(any(dual_funding, splicing))]
10303
- ChannelPhase::UnfundedInboundV2(channel) => {
10304
- // Since unfunded inbound channel maps are cleared upon disconnecting a peer,
10305
- // they are not persisted and won't be recovered after a crash.
10306
- // Therefore, they shouldn't exist at this point.
10307
- debug_assert!(false);
10308
- },
10309
10267
}
10310
10268
}
10311
10269
}
@@ -10402,7 +10360,6 @@ where
10402
10360
return;
10403
10361
}
10404
10362
},
10405
- #[cfg(any(dual_funding, splicing))]
10406
10363
Some(ChannelPhase::UnfundedOutboundV2(ref mut chan)) => {
10407
10364
if let Ok(msg) = chan.maybe_handle_error_without_close(self.chain_hash, &self.fee_estimator) {
10408
10365
peer_state.pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
@@ -10412,9 +10369,7 @@ where
10412
10369
return;
10413
10370
}
10414
10371
},
10415
- None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::Funded(_)) => (),
10416
- #[cfg(any(dual_funding, splicing))]
10417
- Some(ChannelPhase::UnfundedInboundV2(_)) => (),
10372
+ None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::Funded(_)) => (),
10418
10373
}
10419
10374
}
10420
10375
0 commit comments