@@ -1336,9 +1336,7 @@ impl <SP: Deref> PeerState<SP> where SP::Target: SignerProvider {
1336
1336
match phase {
1337
1337
ChannelPhase::Funded(_) | ChannelPhase::UnfundedOutboundV1(_) => true,
1338
1338
ChannelPhase::UnfundedInboundV1(_) => false,
1339
- #[cfg(any(dual_funding, splicing))]
1340
1339
ChannelPhase::UnfundedOutboundV2(_) => true,
1341
- #[cfg(any(dual_funding, splicing))]
1342
1340
ChannelPhase::UnfundedInboundV2(_) => false,
1343
1341
}
1344
1342
)
@@ -3009,11 +3007,9 @@ macro_rules! convert_chan_phase_err {
3009
3007
ChannelPhase::UnfundedInboundV1(channel) => {
3010
3008
convert_chan_phase_err!($self, $peer_state, $err, channel, $channel_id, UNFUNDED_CHANNEL)
3011
3009
},
3012
- #[cfg(any(dual_funding, splicing))]
3013
3010
ChannelPhase::UnfundedOutboundV2(channel) => {
3014
3011
convert_chan_phase_err!($self, $peer_state, $err, channel, $channel_id, UNFUNDED_CHANNEL)
3015
3012
},
3016
- #[cfg(any(dual_funding, splicing))]
3017
3013
ChannelPhase::UnfundedInboundV2(channel) => {
3018
3014
convert_chan_phase_err!($self, $peer_state, $err, channel, $channel_id, UNFUNDED_CHANNEL)
3019
3015
},
@@ -3997,13 +3993,7 @@ where
3997
3993
self.finish_close_channel(chan.context.force_shutdown(broadcast, closure_reason));
3998
3994
(self.get_channel_update_for_broadcast(&chan).ok(), chan.context.get_counterparty_node_id())
3999
3995
},
4000
- ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => {
4001
- self.finish_close_channel(chan_phase.context_mut().force_shutdown(false, closure_reason));
4002
- // Unfunded channel has no update
4003
- (None, chan_phase.context().get_counterparty_node_id())
4004
- },
4005
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
4006
- #[cfg(any(dual_funding, splicing))]
3996
+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) |
4007
3997
ChannelPhase::UnfundedOutboundV2(_) | ChannelPhase::UnfundedInboundV2(_) => {
4008
3998
self.finish_close_channel(chan_phase.context_mut().force_shutdown(false, closure_reason));
4009
3999
// Unfunded channel has no update
@@ -6482,11 +6472,9 @@ where
6482
6472
ChannelPhase::UnfundedOutboundV1(chan) => {
6483
6473
process_unfunded_channel_tick!(peer_state, chan, pending_msg_events)
6484
6474
},
6485
- #[cfg(any(dual_funding, splicing))]
6486
6475
ChannelPhase::UnfundedInboundV2(chan) => {
6487
6476
process_unfunded_channel_tick!(peer_state, chan, pending_msg_events)
6488
6477
},
6489
- #[cfg(any(dual_funding, splicing))]
6490
6478
ChannelPhase::UnfundedOutboundV2(chan) => {
6491
6479
process_unfunded_channel_tick!(peer_state, chan, pending_msg_events)
6492
6480
},
@@ -7772,8 +7760,6 @@ where
7772
7760
num_unfunded_channels += 1;
7773
7761
}
7774
7762
},
7775
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
7776
- #[cfg(any(dual_funding, splicing))]
7777
7763
ChannelPhase::UnfundedInboundV2(chan) => {
7778
7764
// Only inbound V2 channels that are not 0conf and that we do not contribute to will be
7779
7765
// included in the unfunded count.
@@ -7782,16 +7768,10 @@ where
7782
7768
num_unfunded_channels += 1;
7783
7769
}
7784
7770
},
7785
- ChannelPhase::UnfundedOutboundV1(_) => {
7771
+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedOutboundV2(_) => {
7786
7772
// Outbound channels don't contribute to the unfunded count in the DoS context.
7787
7773
continue;
7788
7774
},
7789
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
7790
- #[cfg(any(dual_funding, splicing))]
7791
- ChannelPhase::UnfundedOutboundV2(_) => {
7792
- // Outbound channels don't contribute to the unfunded count in the DoS context.
7793
- continue;
7794
- }
7795
7775
}
7796
7776
}
7797
7777
num_unfunded_channels + peer.inbound_channel_request_by_id.len()
@@ -8210,17 +8190,8 @@ where
8210
8190
peer_state_lock, peer_state, per_peer_state, chan);
8211
8191
}
8212
8192
},
8213
- ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) => {
8214
- let context = phase.context_mut();
8215
- let logger = WithChannelContext::from(&self.logger, context, None);
8216
- log_error!(logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
8217
- let mut chan = remove_channel_phase!(self, peer_state, chan_phase_entry);
8218
- finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
8219
- },
8220
- // TODO(dual_funding): Combine this match arm with above.
8221
- #[cfg(any(dual_funding, splicing))]
8193
+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedOutboundV1(_) |
8222
8194
ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => {
8223
- let context = phase.context_mut();
8224
8195
log_error!(self.logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
8225
8196
let mut chan = remove_channel_phase!(self, peer_state, chan_phase_entry);
8226
8197
finish_shutdown = Some(chan.context_mut().force_shutdown(false, ClosureReason::CounterpartyCoopClosedUnfundedChannel));
@@ -9145,7 +9116,7 @@ where
9145
9116
}
9146
9117
None
9147
9118
}
9148
- ChannelPhase::UnfundedInboundV1(_) => None,
9119
+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::UnfundedOutboundV2(_) => None,
9149
9120
}
9150
9121
};
9151
9122
@@ -10601,9 +10572,7 @@ where
10601
10572
peer_state.channel_by_id.retain(|_, phase| {
10602
10573
match phase {
10603
10574
// Retain unfunded channels.
10604
- ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => true,
10605
- // TODO(dual_funding): Combine this match arm with above.
10606
- #[cfg(any(dual_funding, splicing))]
10575
+ ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) |
10607
10576
ChannelPhase::UnfundedOutboundV2(_) | ChannelPhase::UnfundedInboundV2(_) => true,
10608
10577
ChannelPhase::Funded(channel) => {
10609
10578
let res = f(channel);
@@ -11111,11 +11080,9 @@ where
11111
11080
ChannelPhase::UnfundedInboundV1(chan) => {
11112
11081
&mut chan.context
11113
11082
},
11114
- #[cfg(any(dual_funding, splicing))]
11115
11083
ChannelPhase::UnfundedOutboundV2(chan) => {
11116
11084
&mut chan.context
11117
11085
},
11118
- #[cfg(any(dual_funding, splicing))]
11119
11086
ChannelPhase::UnfundedInboundV2(chan) => {
11120
11087
&mut chan.context
11121
11088
},
@@ -11277,30 +11244,19 @@ where
11277
11244
});
11278
11245
}
11279
11246
11280
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
11281
- #[cfg(any(dual_funding, splicing))]
11282
11247
ChannelPhase::UnfundedOutboundV2(chan) => {
11283
11248
pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
11284
11249
node_id: chan.context.get_counterparty_node_id(),
11285
11250
msg: chan.get_open_channel_v2(self.chain_hash),
11286
11251
});
11287
11252
},
11288
11253
11289
- ChannelPhase::UnfundedInboundV1(_) => {
11254
+ ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) => {
11290
11255
// Since unfunded inbound channel maps are cleared upon disconnecting a peer,
11291
11256
// they are not persisted and won't be recovered after a crash.
11292
11257
// Therefore, they shouldn't exist at this point.
11293
11258
debug_assert!(false);
11294
11259
}
11295
-
11296
- // TODO(dual_funding): Combine this match arm with above once #[cfg(any(dual_funding, splicing))] is removed.
11297
- #[cfg(any(dual_funding, splicing))]
11298
- ChannelPhase::UnfundedInboundV2(channel) => {
11299
- // Since unfunded inbound channel maps are cleared upon disconnecting a peer,
11300
- // they are not persisted and won't be recovered after a crash.
11301
- // Therefore, they shouldn't exist at this point.
11302
- debug_assert!(false);
11303
- },
11304
11260
}
11305
11261
}
11306
11262
}
@@ -11397,7 +11353,6 @@ where
11397
11353
return;
11398
11354
}
11399
11355
},
11400
- #[cfg(any(dual_funding, splicing))]
11401
11356
Some(ChannelPhase::UnfundedOutboundV2(ref mut chan)) => {
11402
11357
if let Ok(msg) = chan.maybe_handle_error_without_close(self.chain_hash, &self.fee_estimator) {
11403
11358
peer_state.pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
@@ -11407,9 +11362,7 @@ where
11407
11362
return;
11408
11363
}
11409
11364
},
11410
- None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::Funded(_)) => (),
11411
- #[cfg(any(dual_funding, splicing))]
11412
- Some(ChannelPhase::UnfundedInboundV2(_)) => (),
11365
+ None | Some(ChannelPhase::UnfundedInboundV1(_) | ChannelPhase::UnfundedInboundV2(_) | ChannelPhase::Funded(_)) => (),
11413
11366
}
11414
11367
}
11415
11368
0 commit comments