Skip to content

Commit 99f5126

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 96879c1 commit 99f5126

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
@@ -1178,7 +1178,6 @@ enum ChannelPhase<SP: Deref> where SP::Target: SignerProvider {
11781178
Undefined,
11791179
UnfundedOutboundV1(OutboundV1Channel<SP>),
11801180
UnfundedInboundV1(InboundV1Channel<SP>),
1181-
#[allow(dead_code)] // TODO(dual_funding): Remove once creating V2 channels is enabled.
11821181
UnfundedV2(PendingV2Channel<SP>),
11831182
Funded(FundedChannel<SP>),
11841183
}
@@ -1395,7 +1394,6 @@ impl<SP: Deref> Channel<SP> where
13951394
debug_assert!(false);
13961395
ReconnectionMsg::None
13971396
},
1398-
#[cfg(dual_funding)]
13991397
ChannelPhase::UnfundedV2(chan) => {
14001398
if chan.context.is_outbound() {
14011399
ReconnectionMsg::Open(OpenChannelMessage::V2(
@@ -1409,8 +1407,6 @@ impl<SP: Deref> Channel<SP> where
14091407
ReconnectionMsg::None
14101408
}
14111409
},
1412-
#[cfg(not(dual_funding))]
1413-
ChannelPhase::UnfundedV2(_) => ReconnectionMsg::None,
14141410
}
14151411
}
14161412

@@ -1430,7 +1426,6 @@ impl<SP: Deref> Channel<SP> where
14301426
.map(|msg| Some(OpenChannelMessage::V1(msg)))
14311427
},
14321428
ChannelPhase::UnfundedInboundV1(_) => Ok(None),
1433-
#[cfg(dual_funding)]
14341429
ChannelPhase::UnfundedV2(chan) => {
14351430
if chan.context.is_outbound() {
14361431
chan.maybe_handle_error_without_close(chain_hash, fee_estimator)
@@ -1439,11 +1434,6 @@ impl<SP: Deref> Channel<SP> where
14391434
Ok(None)
14401435
}
14411436
},
1442-
#[cfg(not(dual_funding))]
1443-
ChannelPhase::UnfundedV2(_) => {
1444-
debug_assert!(false);
1445-
Ok(None)
1446-
},
14471437
}
14481438
}
14491439

@@ -4537,7 +4527,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
45374527
})
45384528
}
45394529

4540-
#[cfg(all(test, dual_funding))]
4530+
#[cfg(all(test))]
45414531
pub fn get_initial_counterparty_commitment_signature_for_test<L: Deref>(
45424532
&mut self, funding: &FundingScope, logger: &L, channel_transaction_parameters: ChannelTransactionParameters,
45434533
counterparty_cur_commitment_point_override: PublicKey,
@@ -9590,7 +9580,6 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
95909580
/// If we receive an error message, it may only be a rejection of the channel type we tried,
95919581
/// not of our ability to open any channel at all. Thus, on error, we should first call this
95929582
/// and see if we get a new `OpenChannelV2` message, otherwise the channel is failed.
9593-
#[cfg(dual_funding)]
95949583
pub(crate) fn maybe_handle_error_without_close<F: Deref>(
95959584
&mut self, chain_hash: ChainHash, fee_estimator: &LowerBoundedFeeEstimator<F>
95969585
) -> Result<msgs::OpenChannelV2, ()>
@@ -9601,7 +9590,6 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
96019590
Ok(self.get_open_channel_v2(chain_hash))
96029591
}
96039592

9604-
#[cfg(dual_funding)]
96059593
pub fn get_open_channel_v2(&self, chain_hash: ChainHash) -> msgs::OpenChannelV2 {
96069594
if !self.context.is_outbound() {
96079595
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

@@ -7843,7 +7840,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
78437840
(*temporary_channel_id, Channel::from(channel), message_send_event)
78447841
})
78457842
},
7846-
#[cfg(dual_funding)]
78477843
OpenChannelMessage::V2(open_channel_msg) => {
78487844
PendingV2Channel::new_inbound(
78497845
&self.fee_estimator, &self.entropy_source, &self.signer_provider,
@@ -8006,7 +8002,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
80068002
fn internal_open_channel(&self, counterparty_node_id: &PublicKey, msg: OpenChannelMessageRef<'_>) -> Result<(), MsgHandleErrInternal> {
80078003
let common_fields = match msg {
80088004
OpenChannelMessageRef::V1(msg) => &msg.common_fields,
8009-
#[cfg(dual_funding)]
80108005
OpenChannelMessageRef::V2(msg) => &msg.common_fields,
80118006
};
80128007

@@ -8084,7 +8079,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
80848079
funding_satoshis: common_fields.funding_satoshis,
80858080
channel_negotiation_type: match msg {
80868081
OpenChannelMessageRef::V1(msg) => InboundChannelFunds::PushMsat(msg.push_msat),
8087-
#[cfg(dual_funding)]
80888082
OpenChannelMessageRef::V2(_) => InboundChannelFunds::DualFunded,
80898083
},
80908084
channel_type,
@@ -8094,7 +8088,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
80948088
peer_state.inbound_channel_request_by_id.insert(channel_id, InboundChannelRequest {
80958089
open_channel_msg: match msg {
80968090
OpenChannelMessageRef::V1(msg) => OpenChannelMessage::V1(msg.clone()),
8097-
#[cfg(dual_funding)]
80988091
OpenChannelMessageRef::V2(msg) => OpenChannelMessage::V2(msg.clone()),
80998092
},
81008093
ticks_remaining: UNACCEPTED_INBOUND_CHANNEL_AGE_LIMIT_TICKS,
@@ -8130,7 +8123,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
81308123
});
81318124
(Channel::from(channel), message_send_event)
81328125
},
8133-
#[cfg(dual_funding)]
81348126
OpenChannelMessageRef::V2(msg) => {
81358127
let channel = PendingV2Channel::new_inbound(
81368128
&self.fee_estimator, &self.entropy_source, &self.signer_provider,
@@ -11656,7 +11648,6 @@ where
1165611648
// Note that we never need to persist the updated ChannelManager for an inbound
1165711649
// open_channel message - pre-funded channels are never written so there should be no
1165811650
// change to the contents.
11659-
#[cfg(dual_funding)]
1166011651
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
1166111652
let res = self.internal_open_channel(&counterparty_node_id, OpenChannelMessageRef::V2(msg));
1166211653
let persist = match &res {
@@ -11669,10 +11660,6 @@ where
1166911660
let _ = handle_error!(self, res, counterparty_node_id);
1167011661
persist
1167111662
});
11672-
#[cfg(not(dual_funding))]
11673-
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
11674-
"Dual-funded channels not supported".to_owned(),
11675-
msg.common_fields.temporary_channel_id.clone())), counterparty_node_id);
1167611663
}
1167711664

1167811665
fn handle_accept_channel(&self, counterparty_node_id: PublicKey, msg: &msgs::AcceptChannel) {
@@ -12071,7 +12058,6 @@ where
1207112058
node_id: chan.context().get_counterparty_node_id(),
1207212059
msg,
1207312060
}),
12074-
#[cfg(dual_funding)]
1207512061
ReconnectionMsg::Open(OpenChannelMessage::V2(msg)) =>
1207612062
pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
1207712063
node_id: chan.context().get_counterparty_node_id(),
@@ -12178,7 +12164,6 @@ where
1217812164
});
1217912165
return;
1218012166
},
12181-
#[cfg(dual_funding)]
1218212167
Ok(Some(OpenChannelMessage::V2(msg))) => {
1218312168
peer_state.pending_msg_events.push(events::MessageSendEvent::SendOpenChannelV2 {
1218412169
node_id: counterparty_node_id,
@@ -12748,7 +12733,6 @@ pub fn provided_init_features(config: &UserConfig) -> InitFeatures {
1274812733
if config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx {
1274912734
features.set_anchors_zero_fee_htlc_tx_optional();
1275012735
}
12751-
#[cfg(dual_funding)]
1275212736
features.set_dual_fund_optional();
1275312737
// Only signal quiescence support in tests for now, as we don't yet support any
1275412738
// 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)