Skip to content

Commit cbd0999

Browse files
committed
Remove dual_funding cfg-flags
Since we now have release branches, and dual-funded channels are expected in v0.2.0, we can remove the cfg flags. This should also speed up CI a bit as a bonus.
1 parent 605184f commit cbd0999

File tree

5 files changed

+1
-35
lines changed

5 files changed

+1
-35
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,4 @@ check-cfg = [
6666
"cfg(require_route_graph_test)",
6767
"cfg(splicing)",
6868
"cfg(async_payments)",
69-
"cfg(dual_funding)",
7069
]

lightning/src/ln/channel.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,6 @@ enum ChannelPhase<SP: Deref> where SP::Target: SignerProvider {
11471147
Undefined,
11481148
UnfundedOutboundV1(OutboundV1Channel<SP>),
11491149
UnfundedInboundV1(InboundV1Channel<SP>),
1150-
#[allow(dead_code)] // TODO(dual_funding): Remove once creating V2 channels is enabled.
11511150
UnfundedV2(PendingV2Channel<SP>),
11521151
Funded(FundedChannel<SP>),
11531152
}
@@ -1333,7 +1332,6 @@ impl<SP: Deref> Channel<SP> where
13331332
debug_assert!(false);
13341333
ReconnectionMsg::None
13351334
},
1336-
#[cfg(dual_funding)]
13371335
ChannelPhase::UnfundedV2(chan) => {
13381336
if chan.context.is_outbound() {
13391337
ReconnectionMsg::Open(OpenChannelMessage::V2(
@@ -1347,8 +1345,6 @@ impl<SP: Deref> Channel<SP> where
13471345
ReconnectionMsg::None
13481346
}
13491347
},
1350-
#[cfg(not(dual_funding))]
1351-
ChannelPhase::UnfundedV2(_) => ReconnectionMsg::None,
13521348
}
13531349
}
13541350

@@ -1368,7 +1364,6 @@ impl<SP: Deref> Channel<SP> where
13681364
.map(|msg| Some(OpenChannelMessage::V1(msg)))
13691365
},
13701366
ChannelPhase::UnfundedInboundV1(_) => Ok(None),
1371-
#[cfg(dual_funding)]
13721367
ChannelPhase::UnfundedV2(chan) => {
13731368
if chan.context.is_outbound() {
13741369
chan.maybe_handle_error_without_close(chain_hash, fee_estimator)
@@ -1377,11 +1372,6 @@ impl<SP: Deref> Channel<SP> where
13771372
Ok(None)
13781373
}
13791374
},
1380-
#[cfg(not(dual_funding))]
1381-
ChannelPhase::UnfundedV2(_) => {
1382-
debug_assert!(false);
1383-
Ok(None)
1384-
},
13851375
}
13861376
}
13871377

@@ -4386,7 +4376,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
43864376
})
43874377
}
43884378

4389-
#[cfg(all(test, dual_funding))]
4379+
#[cfg(all(test))]
43904380
pub fn get_initial_counterparty_commitment_signature_for_test<L: Deref>(
43914381
&mut self, logger: &L, channel_transaction_parameters: ChannelTransactionParameters,
43924382
counterparty_cur_commitment_point_override: PublicKey,
@@ -9154,7 +9144,6 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
91549144
/// If we receive an error message, it may only be a rejection of the channel type we tried,
91559145
/// not of our ability to open any channel at all. Thus, on error, we should first call this
91569146
/// and see if we get a new `OpenChannelV2` message, otherwise the channel is failed.
9157-
#[cfg(dual_funding)]
91589147
pub(crate) fn maybe_handle_error_without_close<F: Deref>(
91599148
&mut self, chain_hash: ChainHash, fee_estimator: &LowerBoundedFeeEstimator<F>
91609149
) -> Result<msgs::OpenChannelV2, ()>
@@ -9165,7 +9154,6 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
91659154
Ok(self.get_open_channel_v2(chain_hash))
91669155
}
91679156

9168-
#[cfg(dual_funding)]
91699157
pub fn get_open_channel_v2(&self, chain_hash: ChainHash) -> msgs::OpenChannelV2 {
91709158
if !self.context.is_outbound() {
91719159
debug_assert!(false, "Tried to send open_channel2 for an inbound channel?");

lightning/src/ln/channelmanager.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ use crate::ln::inbound_payment;
4949
use crate::ln::types::ChannelId;
5050
use crate::types::payment::{PaymentHash, PaymentPreimage, PaymentSecret};
5151
use crate::ln::channel::{self, Channel, ChannelError, ChannelUpdateStatus, FundedChannel, ShutdownResult, UpdateFulfillCommitFetch, OutboundV1Channel, ReconnectionMsg, InboundV1Channel, WithChannelContext};
52-
#[cfg(any(dual_funding, splicing))]
5352
use crate::ln::channel::PendingV2Channel;
5453
use crate::ln::channel_state::ChannelDetails;
5554
use crate::types::features::{Bolt12InvoiceFeatures, ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures};
@@ -1441,13 +1440,11 @@ impl <SP: Deref> PeerState<SP> where SP::Target: SignerProvider {
14411440
#[derive(Clone)]
14421441
pub(super) enum OpenChannelMessage {
14431442
V1(msgs::OpenChannel),
1444-
#[cfg(dual_funding)]
14451443
V2(msgs::OpenChannelV2),
14461444
}
14471445

14481446
pub(super) enum OpenChannelMessageRef<'a> {
14491447
V1(&'a msgs::OpenChannel),
1450-
#[cfg(dual_funding)]
14511448
V2(&'a msgs::OpenChannelV2),
14521449
}
14531450

@@ -7828,7 +7825,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
78287825
(*temporary_channel_id, Channel::from(channel), message_send_event)
78297826
})
78307827
},
7831-
#[cfg(dual_funding)]
78327828
OpenChannelMessage::V2(open_channel_msg) => {
78337829
PendingV2Channel::new_inbound(
78347830
&self.fee_estimator, &self.entropy_source, &self.signer_provider,
@@ -7991,7 +7987,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
79917987
fn internal_open_channel(&self, counterparty_node_id: &PublicKey, msg: OpenChannelMessageRef<'_>) -> Result<(), MsgHandleErrInternal> {
79927988
let common_fields = match msg {
79937989
OpenChannelMessageRef::V1(msg) => &msg.common_fields,
7994-
#[cfg(dual_funding)]
79957990
OpenChannelMessageRef::V2(msg) => &msg.common_fields,
79967991
};
79977992

@@ -8069,7 +8064,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
80698064
funding_satoshis: common_fields.funding_satoshis,
80708065
channel_negotiation_type: match msg {
80718066
OpenChannelMessageRef::V1(msg) => InboundChannelFunds::PushMsat(msg.push_msat),
8072-
#[cfg(dual_funding)]
80738067
OpenChannelMessageRef::V2(_) => InboundChannelFunds::DualFunded,
80748068
},
80758069
channel_type,
@@ -8079,7 +8073,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
80798073
peer_state.inbound_channel_request_by_id.insert(channel_id, InboundChannelRequest {
80808074
open_channel_msg: match msg {
80818075
OpenChannelMessageRef::V1(msg) => OpenChannelMessage::V1(msg.clone()),
8082-
#[cfg(dual_funding)]
80838076
OpenChannelMessageRef::V2(msg) => OpenChannelMessage::V2(msg.clone()),
80848077
},
80858078
ticks_remaining: UNACCEPTED_INBOUND_CHANNEL_AGE_LIMIT_TICKS,
@@ -8115,7 +8108,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
81158108
});
81168109
(Channel::from(channel), message_send_event)
81178110
},
8118-
#[cfg(dual_funding)]
81198111
OpenChannelMessageRef::V2(msg) => {
81208112
let channel = PendingV2Channel::new_inbound(
81218113
&self.fee_estimator, &self.entropy_source, &self.signer_provider,
@@ -11475,7 +11467,6 @@ where
1147511467
// Note that we never need to persist the updated ChannelManager for an inbound
1147611468
// open_channel message - pre-funded channels are never written so there should be no
1147711469
// change to the contents.
11478-
#[cfg(dual_funding)]
1147911470
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
1148011471
let res = self.internal_open_channel(&counterparty_node_id, OpenChannelMessageRef::V2(msg));
1148111472
let persist = match &res {
@@ -11488,10 +11479,6 @@ where
1148811479
let _ = handle_error!(self, res, counterparty_node_id);
1148911480
persist
1149011481
});
11491-
#[cfg(not(dual_funding))]
11492-
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
11493-
"Dual-funded channels not supported".to_owned(),
11494-
msg.common_fields.temporary_channel_id.clone())), counterparty_node_id);
1149511482
}
1149611483

1149711484
fn handle_accept_channel(&self, counterparty_node_id: PublicKey, msg: &msgs::AcceptChannel) {
@@ -11879,7 +11866,6 @@ where
1187911866
node_id: chan.context().get_counterparty_node_id(),
1188011867
msg,
1188111868
}),
11882-
#[cfg(dual_funding)]
1188311869
ReconnectionMsg::Open(OpenChannelMessage::V2(msg)) =>
1188411870
pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
1188511871
node_id: chan.context().get_counterparty_node_id(),
@@ -11986,7 +11972,6 @@ where
1198611972
});
1198711973
return;
1198811974
},
11989-
#[cfg(dual_funding)]
1199011975
Ok(Some(OpenChannelMessage::V2(msg))) => {
1199111976
peer_state.pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
1199211977
node_id: counterparty_node_id,
@@ -12556,7 +12541,6 @@ pub fn provided_init_features(config: &UserConfig) -> InitFeatures {
1255612541
if config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx {
1255712542
features.set_anchors_zero_fee_htlc_tx_optional();
1255812543
}
12559-
#[cfg(dual_funding)]
1256012544
features.set_dual_fund_optional();
1256112545
features
1256212546
}

lightning/src/ln/dual_funding_tests.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
//! Tests that test the creation of dual-funded channels in ChannelManager.
1111
12-
#[cfg(dual_funding)]
1312
use {
1413
crate::chain::chaininterface::{ConfirmationTarget, LowerBoundedFeeEstimator},
1514
crate::events::{Event, MessageSendEvent, MessageSendEventsProvider},
@@ -29,14 +28,12 @@ use {
2928
crate::util::test_utils,
3029
};
3130

32-
#[cfg(dual_funding)]
3331
// Dual-funding: V2 Channel Establishment Tests
3432
struct V2ChannelEstablishmentTestSession {
3533
funding_input_sats: u64,
3634
initiator_input_value_satoshis: u64,
3735
}
3836

39-
#[cfg(dual_funding)]
4037
// TODO(dual_funding): Use real node and API for creating V2 channels as initiator when available,
4138
// instead of manually constructing messages.
4239
fn do_test_v2_channel_establishment(
@@ -247,7 +244,6 @@ fn do_test_v2_channel_establishment(
247244
}
248245

249246
#[test]
250-
#[cfg(dual_funding)]
251247
fn test_v2_channel_establishment() {
252248
// Only initiator contributes, no persist pending
253249
do_test_v2_channel_establishment(

lightning/src/ln/peer_handler.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ impl ChannelMessageHandler for ErroringMessageHandler {
346346
features.set_basic_mpp_optional();
347347
features.set_wumbo_optional();
348348
features.set_shutdown_any_segwit_optional();
349-
#[cfg(dual_funding)]
350349
features.set_dual_fund_optional();
351350
features.set_channel_type_optional();
352351
features.set_scid_privacy_optional();

0 commit comments

Comments
 (0)