Skip to content

Commit ac060f9

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 7fc2cf4 commit ac060f9

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
@@ -1182,7 +1182,6 @@ enum ChannelPhase<SP: Deref> where SP::Target: SignerProvider {
11821182
Undefined,
11831183
UnfundedOutboundV1(OutboundV1Channel<SP>),
11841184
UnfundedInboundV1(InboundV1Channel<SP>),
1185-
#[allow(dead_code)] // TODO(dual_funding): Remove once creating V2 channels is enabled.
11861185
UnfundedV2(PendingV2Channel<SP>),
11871186
Funded(FundedChannel<SP>),
11881187
}
@@ -1399,7 +1398,6 @@ impl<SP: Deref> Channel<SP> where
13991398
debug_assert!(false);
14001399
ReconnectionMsg::None
14011400
},
1402-
#[cfg(dual_funding)]
14031401
ChannelPhase::UnfundedV2(chan) => {
14041402
if chan.context.is_outbound() {
14051403
ReconnectionMsg::Open(OpenChannelMessage::V2(
@@ -1413,8 +1411,6 @@ impl<SP: Deref> Channel<SP> where
14131411
ReconnectionMsg::None
14141412
}
14151413
},
1416-
#[cfg(not(dual_funding))]
1417-
ChannelPhase::UnfundedV2(_) => ReconnectionMsg::None,
14181414
}
14191415
}
14201416

@@ -1434,7 +1430,6 @@ impl<SP: Deref> Channel<SP> where
14341430
.map(|msg| Some(OpenChannelMessage::V1(msg)))
14351431
},
14361432
ChannelPhase::UnfundedInboundV1(_) => Ok(None),
1437-
#[cfg(dual_funding)]
14381433
ChannelPhase::UnfundedV2(chan) => {
14391434
if chan.context.is_outbound() {
14401435
chan.maybe_handle_error_without_close(chain_hash, fee_estimator)
@@ -1443,11 +1438,6 @@ impl<SP: Deref> Channel<SP> where
14431438
Ok(None)
14441439
}
14451440
},
1446-
#[cfg(not(dual_funding))]
1447-
ChannelPhase::UnfundedV2(_) => {
1448-
debug_assert!(false);
1449-
Ok(None)
1450-
},
14511441
}
14521442
}
14531443

@@ -4530,7 +4520,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
45304520
})
45314521
}
45324522

4533-
#[cfg(all(test, dual_funding))]
4523+
#[cfg(all(test))]
45344524
pub fn get_initial_counterparty_commitment_signature_for_test<L: Deref>(
45354525
&mut self, funding: &FundingScope, logger: &L, channel_transaction_parameters: ChannelTransactionParameters,
45364526
counterparty_cur_commitment_point_override: PublicKey,
@@ -9571,7 +9561,6 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
95719561
/// If we receive an error message, it may only be a rejection of the channel type we tried,
95729562
/// not of our ability to open any channel at all. Thus, on error, we should first call this
95739563
/// and see if we get a new `OpenChannelV2` message, otherwise the channel is failed.
9574-
#[cfg(dual_funding)]
95759564
pub(crate) fn maybe_handle_error_without_close<F: Deref>(
95769565
&mut self, chain_hash: ChainHash, fee_estimator: &LowerBoundedFeeEstimator<F>
95779566
) -> Result<msgs::OpenChannelV2, ()>
@@ -9582,7 +9571,6 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
95829571
Ok(self.get_open_channel_v2(chain_hash))
95839572
}
95849573

9585-
#[cfg(dual_funding)]
95869574
pub fn get_open_channel_v2(&self, chain_hash: ChainHash) -> msgs::OpenChannelV2 {
95879575
if !self.context.is_outbound() {
95889576
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};
@@ -1450,13 +1449,11 @@ impl <SP: Deref> PeerState<SP> where SP::Target: SignerProvider {
14501449
#[derive(Clone)]
14511450
pub(super) enum OpenChannelMessage {
14521451
V1(msgs::OpenChannel),
1453-
#[cfg(dual_funding)]
14541452
V2(msgs::OpenChannelV2),
14551453
}
14561454

14571455
pub(super) enum OpenChannelMessageRef<'a> {
14581456
V1(&'a msgs::OpenChannel),
1459-
#[cfg(dual_funding)]
14601457
V2(&'a msgs::OpenChannelV2),
14611458
}
14621459

@@ -7846,7 +7843,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
78467843
(*temporary_channel_id, Channel::from(channel), message_send_event)
78477844
})
78487845
},
7849-
#[cfg(dual_funding)]
78507846
OpenChannelMessage::V2(open_channel_msg) => {
78517847
PendingV2Channel::new_inbound(
78527848
&self.fee_estimator, &self.entropy_source, &self.signer_provider,
@@ -8009,7 +8005,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
80098005
fn internal_open_channel(&self, counterparty_node_id: &PublicKey, msg: OpenChannelMessageRef<'_>) -> Result<(), MsgHandleErrInternal> {
80108006
let common_fields = match msg {
80118007
OpenChannelMessageRef::V1(msg) => &msg.common_fields,
8012-
#[cfg(dual_funding)]
80138008
OpenChannelMessageRef::V2(msg) => &msg.common_fields,
80148009
};
80158010

@@ -8087,7 +8082,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
80878082
funding_satoshis: common_fields.funding_satoshis,
80888083
channel_negotiation_type: match msg {
80898084
OpenChannelMessageRef::V1(msg) => InboundChannelFunds::PushMsat(msg.push_msat),
8090-
#[cfg(dual_funding)]
80918085
OpenChannelMessageRef::V2(_) => InboundChannelFunds::DualFunded,
80928086
},
80938087
channel_type,
@@ -8097,7 +8091,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
80978091
peer_state.inbound_channel_request_by_id.insert(channel_id, InboundChannelRequest {
80988092
open_channel_msg: match msg {
80998093
OpenChannelMessageRef::V1(msg) => OpenChannelMessage::V1(msg.clone()),
8100-
#[cfg(dual_funding)]
81018094
OpenChannelMessageRef::V2(msg) => OpenChannelMessage::V2(msg.clone()),
81028095
},
81038096
ticks_remaining: UNACCEPTED_INBOUND_CHANNEL_AGE_LIMIT_TICKS,
@@ -8133,7 +8126,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
81338126
});
81348127
(Channel::from(channel), message_send_event)
81358128
},
8136-
#[cfg(dual_funding)]
81378129
OpenChannelMessageRef::V2(msg) => {
81388130
let channel = PendingV2Channel::new_inbound(
81398131
&self.fee_estimator, &self.entropy_source, &self.signer_provider,
@@ -11659,7 +11651,6 @@ where
1165911651
// Note that we never need to persist the updated ChannelManager for an inbound
1166011652
// open_channel message - pre-funded channels are never written so there should be no
1166111653
// change to the contents.
11662-
#[cfg(dual_funding)]
1166311654
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
1166411655
let res = self.internal_open_channel(&counterparty_node_id, OpenChannelMessageRef::V2(msg));
1166511656
let persist = match &res {
@@ -11672,10 +11663,6 @@ where
1167211663
let _ = handle_error!(self, res, counterparty_node_id);
1167311664
persist
1167411665
});
11675-
#[cfg(not(dual_funding))]
11676-
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
11677-
"Dual-funded channels not supported".to_owned(),
11678-
msg.common_fields.temporary_channel_id.clone())), counterparty_node_id);
1167911666
}
1168011667

1168111668
fn handle_accept_channel(&self, counterparty_node_id: PublicKey, msg: &msgs::AcceptChannel) {
@@ -12074,7 +12061,6 @@ where
1207412061
node_id: chan.context().get_counterparty_node_id(),
1207512062
msg,
1207612063
}),
12077-
#[cfg(dual_funding)]
1207812064
ReconnectionMsg::Open(OpenChannelMessage::V2(msg)) =>
1207912065
pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
1208012066
node_id: chan.context().get_counterparty_node_id(),
@@ -12181,7 +12167,6 @@ where
1218112167
});
1218212168
return;
1218312169
},
12184-
#[cfg(dual_funding)]
1218512170
Ok(Some(OpenChannelMessage::V2(msg))) => {
1218612171
peer_state.pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
1218712172
node_id: counterparty_node_id,
@@ -12751,7 +12736,6 @@ pub fn provided_init_features(config: &UserConfig) -> InitFeatures {
1275112736
if config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx {
1275212737
features.set_anchors_zero_fee_htlc_tx_optional();
1275312738
}
12754-
#[cfg(dual_funding)]
1275512739
features.set_dual_fund_optional();
1275612740
// Only signal quiescence support in tests for now, as we don't yet support any
1275712741
// quiescent-dependent protocols (e.g., splicing).

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(
@@ -248,7 +245,6 @@ fn do_test_v2_channel_establishment(
248245
}
249246

250247
#[test]
251-
#[cfg(dual_funding)]
252248
fn test_v2_channel_establishment() {
253249
// Only initiator contributes, no persist pending
254250
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)