Skip to content

Commit 3aae89e

Browse files
committed
refactor(test): DRY up interop tests and un-ignore CLN tests
- Move test_receive_keysend into interop_tests! macro, removing per-file duplicates across CLN, LND, and Eclair - Un-ignore test_cln_splice_in (will fail until rust-lightning bump past #4472, tracked in lightningdevkit#857) - Remove unused supports_splice() from ExternalNode trait
1 parent 96517d1 commit 3aae89e

7 files changed

Lines changed: 27 additions & 81 deletions

File tree

tests/common/cln.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -270,16 +270,6 @@ impl ExternalNode for TestClnNode {
270270
Ok(channels)
271271
}
272272

273-
// CLN v25 with --experimental-splicing advertises BOLT-spec bit 62
274-
// (OPT_SPLICE), so feature negotiation with LDK succeeds. However,
275-
// rust-lightning panics during tx_signatures exchange due to a
276-
// debug_assert (fixed in rust-lightning#4472, not yet in pinned rev).
277-
// Flip to true after ldk-node bumps rust-lightning past that fix.
278-
// Tracking: ldk-node#857
279-
fn supports_splice(&self) -> bool {
280-
false
281-
}
282-
283273
async fn splice_in(&self, channel_id: &str, amount_sat: u64) -> Result<(), TestFailure> {
284274
// Step 1: splice_init with positive relative_amount
285275
let ch_id = channel_id.to_string();

tests/common/eclair.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,6 @@ impl ExternalNode for TestEclairNode {
280280
Ok(channels)
281281
}
282282

283-
// Eclair uses custom prototype feature bit 154 for splice, not the
284-
// BOLT-specified bit 62/63 that LDK uses. Splice interop is not possible
285-
// until Eclair migrates to the standard feature bits.
286-
// Ref: https://github.com/ACINQ/eclair/blob/master/eclair-core/src/main/scala/fr/acinq/eclair/Features.scala
287-
fn supports_splice(&self) -> bool {
288-
false
289-
}
290-
291283
async fn splice_in(&self, channel_id: &str, amount_sat: u64) -> Result<(), TestFailure> {
292284
let amount_str = amount_sat.to_string();
293285
self.post("/splicein", &[("channelId", channel_id), ("amountIn", &amount_str)]).await?;

tests/common/external_node.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,6 @@ pub(crate) trait ExternalNode: Send + Sync {
145145
Err(self.make_error(format!("did not reach height {} after 60s", min_height)))
146146
}
147147

148-
/// Whether this implementation supports channel splicing with LDK.
149-
///
150-
/// Feature bit status:
151-
/// - LDK uses BOLT-finalized bit 62/63 ([BOLT 9](https://github.com/lightning/bolts/blob/master/09-features.md))
152-
/// - CLN v25 `--experimental-splicing` advertises both standard bit 62 and
153-
/// experimental bit 162 ([features.h](https://github.com/ElementsProject/lightning/blob/v25.12/common/features.h)) -- interop works
154-
/// - Eclair v0.14 uses custom prototype bit 154 ([Features.scala](https://github.com/ACINQ/eclair/blob/master/eclair-core/src/main/scala/fr/acinq/eclair/Features.scala)) -- not compatible
155-
/// - LND does not implement splice
156-
fn supports_splice(&self) -> bool {
157-
false
158-
}
159-
160148
/// Splice additional funds into an existing channel.
161149
///
162150
/// Not all implementations support splicing. The default returns `NotSupported`.

tests/common/scenarios/mod.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,28 @@ macro_rules! interop_tests {
179179
.await;
180180
node.stop().unwrap();
181181
}
182+
183+
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
184+
async fn test_receive_keysend() {
185+
let (bitcoind, electrs, ext) = $setup_clients().await;
186+
let node = setup_ldk_node();
187+
common::scenarios::setup_interop_test(&node, &ext, &bitcoind, &electrs).await;
188+
let (user_ch, _ext_ch) = common::scenarios::channel::open_channel_to_external(
189+
&node,
190+
&ext,
191+
&bitcoind,
192+
&electrs,
193+
1_000_000,
194+
Some(500_000_000),
195+
)
196+
.await;
197+
common::scenarios::payment::receive_keysend_payment(&node, &ext, 5_000_000).await;
198+
common::scenarios::channel::cooperative_close_by_ldk(
199+
&node, &ext, &bitcoind, &electrs, &user_ch,
200+
)
201+
.await;
202+
node.stop().unwrap();
203+
}
182204
};
183205
}
184206

tests/integration_tests_cln.rs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use common::cln::TestClnNode;
1515
use common::external_node::ExternalNode;
1616
use common::scenarios::channel::{cooperative_close_by_ldk, open_channel_to_external};
1717
use common::scenarios::interop_tests;
18-
use common::scenarios::payment::receive_keysend_payment;
1918
use common::scenarios::setup_interop_test;
2019
use electrsd::corepc_client::client_sync::Auth;
2120
use electrsd::corepc_node::Client as BitcoindClient;
@@ -37,8 +36,12 @@ interop_tests!(setup_clients);
3736

3837
/// Test splice-in: LDK adds funds to an existing LDK↔CLN channel.
3938
/// Requires CLN --experimental-splicing (advertises OPT_SPLICE bit 62).
39+
///
40+
/// Known issue: rust-lightning panics during tx_signatures exchange
41+
/// (channel.rs debug_assert). Fix merged in rust-lightning#4472 but not yet
42+
/// in the pinned rev. Will pass once ldk-node bumps rust-lightning.
43+
/// Tracking: ldk-node#857
4044
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
41-
#[ignore = "rust-lightning panics during tx_signatures exchange (channel.rs debug_assert), fix merged in rust-lightning#4472 but not yet in pinned rev, see ldk-node#857"]
4245
async fn test_cln_splice_in() {
4346
let (bitcoind, electrs, cln) = setup_clients().await;
4447
let node = setup_ldk_node();
@@ -66,20 +69,3 @@ async fn test_cln_splice_in() {
6669
cooperative_close_by_ldk(&node, &cln, &bitcoind, &electrs, &user_ch).await;
6770
node.stop().unwrap();
6871
}
69-
70-
/// CLN keysend plugin sets min_final_cltv_expiry=22, but LDK requires at least
71-
/// 42 (HTLC_FAIL_BACK_BUFFER(39) + 3). CLN's keysend RPC has no parameter to
72-
/// override this value. See: plugins/keysend.c in CLN source.
73-
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
74-
#[ignore = "CLN keysend final_cltv=22 < LDK minimum 42 -- needs CLN upstream fix"]
75-
async fn test_cln_receive_keysend() {
76-
let (bitcoind, electrs, cln) = setup_clients().await;
77-
let node = setup_ldk_node();
78-
setup_interop_test(&node, &cln, &bitcoind, &electrs).await;
79-
let (user_ch, _ext_ch) =
80-
open_channel_to_external(&node, &cln, &bitcoind, &electrs, 1_000_000, Some(500_000_000))
81-
.await;
82-
receive_keysend_payment(&node, &cln, 5_000_000).await;
83-
cooperative_close_by_ldk(&node, &cln, &bitcoind, &electrs, &user_ch).await;
84-
node.stop().unwrap();
85-
}

tests/integration_tests_eclair.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ mod common;
1111

1212
use base64::prelude::{Engine as _, BASE64_STANDARD};
1313
use common::eclair::TestEclairNode;
14-
use common::external_node::ExternalNode;
15-
use common::scenarios::channel::{cooperative_close_by_ldk, open_channel_to_external};
1614
use common::scenarios::interop_tests;
17-
use common::scenarios::payment::receive_keysend_payment;
1815
use common::scenarios::setup_interop_test;
1916
use electrsd::corepc_client::client_sync::Auth;
2017
use electrsd::corepc_node::Client as BitcoindClient;
@@ -50,16 +47,3 @@ async fn setup_clients() -> (BitcoindClient, ElectrumClient, TestEclairNode) {
5047
}
5148

5249
interop_tests!(setup_clients);
53-
54-
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
55-
async fn test_eclair_receive_keysend() {
56-
let (bitcoind, electrs, eclair) = setup_clients().await;
57-
let node = setup_ldk_node();
58-
setup_interop_test(&node, &eclair, &bitcoind, &electrs).await;
59-
let (user_ch, _ext_ch) =
60-
open_channel_to_external(&node, &eclair, &bitcoind, &electrs, 1_000_000, Some(500_000_000))
61-
.await;
62-
receive_keysend_payment(&node, &eclair, 5_000_000).await;
63-
cooperative_close_by_ldk(&node, &eclair, &bitcoind, &electrs, &user_ch).await;
64-
node.stop().unwrap();
65-
}

tests/integration_tests_lnd.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@
99

1010
mod common;
1111

12-
use common::external_node::ExternalNode;
1312
use common::lnd::TestLndNode;
14-
use common::scenarios::channel::{cooperative_close_by_ldk, open_channel_to_external};
1513
use common::scenarios::interop_tests;
16-
use common::scenarios::payment::receive_keysend_payment;
1714
use common::scenarios::setup_interop_test;
1815
use electrsd::corepc_client::client_sync::Auth;
1916
use electrsd::corepc_node::Client as BitcoindClient;
@@ -32,16 +29,3 @@ async fn setup_clients() -> (BitcoindClient, ElectrumClient, TestLndNode) {
3229
}
3330

3431
interop_tests!(setup_clients);
35-
36-
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
37-
async fn test_lnd_receive_keysend() {
38-
let (bitcoind, electrs, lnd) = setup_clients().await;
39-
let node = setup_ldk_node();
40-
setup_interop_test(&node, &lnd, &bitcoind, &electrs).await;
41-
let (user_ch, _ext_ch) =
42-
open_channel_to_external(&node, &lnd, &bitcoind, &electrs, 1_000_000, Some(500_000_000))
43-
.await;
44-
receive_keysend_payment(&node, &lnd, 5_000_000).await;
45-
cooperative_close_by_ldk(&node, &lnd, &bitcoind, &electrs, &user_ch).await;
46-
node.stop().unwrap();
47-
}

0 commit comments

Comments
 (0)