Skip to content

Commit 05a0c32

Browse files
committed
Add Eclair interop test for zero-fee-commitments
Co-Authored-By: HAL 9000
1 parent 0f909c7 commit 05a0c32

4 files changed

Lines changed: 35 additions & 4 deletions

File tree

.github/workflows/eclair-integration.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,18 @@ concurrency:
88

99
jobs:
1010
check-eclair:
11+
name: check-eclair (${{ matrix.name }})
1112
timeout-minutes: 60
1213
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
include:
17+
- name: standard
18+
eclair_extra_java_opts: ""
19+
rustflags: "--cfg eclair_test"
20+
- name: zero-fee-commitments
21+
eclair_extra_java_opts: "-Declair.features.zero_fee_commitments=optional"
22+
rustflags: "--cfg eclair_test --cfg zero_fee_commitment_tests"
1323
steps:
1424
- name: Checkout repository
1525
uses: actions/checkout@v4
@@ -37,6 +47,8 @@ jobs:
3747
docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass createwallet ldk_node_test
3848
3949
- name: Start Eclair
50+
env:
51+
ECLAIR_EXTRA_JAVA_OPTS: ${{ matrix.eclair_extra_java_opts }}
4052
run: docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml up -d eclair
4153

4254
- name: Wait for Eclair to be ready
@@ -54,4 +66,5 @@ jobs:
5466
exit 1
5567
5668
- name: Run Eclair integration tests
57-
run: RUSTFLAGS="--cfg eclair_test" cargo test --test integration_tests_eclair -- --show-output --test-threads=1
69+
run: |
70+
RUSTFLAGS="${{ matrix.rustflags }}" cargo test --test integration_tests_eclair -- --show-output --test-threads=1

tests/common/scenarios/channel.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use std::time::Duration;
99

1010
use electrsd::corepc_node::Client as BitcoindClient;
1111
use electrsd::electrum_client::ElectrumApi;
12+
#[cfg(all(eclair_test, zero_fee_commitment_tests))]
13+
use ldk_node::ReserveType;
1214
use ldk_node::{Event, Node};
1315

1416
use super::super::external_node::ExternalNode;
@@ -41,6 +43,21 @@ pub(crate) async fn open_channel_to_external<E: ElectrumApi>(
4143
.map(|ch| ch.channel_id.clone())
4244
.unwrap_or_else(|| panic!("Could not find channel on external node {}", peer.name()));
4345

46+
#[cfg(all(eclair_test, zero_fee_commitment_tests))]
47+
{
48+
let channel = node
49+
.list_channels()
50+
.into_iter()
51+
.find(|channel| channel.user_channel_id == user_channel_id)
52+
.expect("opened channel should be listed");
53+
let channel_type = channel.channel_type.as_ref().expect("channel type should be set");
54+
assert_eq!(channel.counterparty.node_id, ext_node_id);
55+
assert!(channel.counterparty.features.supports_anchor_zero_fee_commitments());
56+
assert!(channel_type.requires_anchor_zero_fee_commitments());
57+
assert_eq!(channel.feerate_sat_per_1000_weight, 0);
58+
assert_eq!(channel.reserve_type, Some(ReserveType::Adaptive));
59+
}
60+
4461
(user_channel_id, ext_channel_id)
4562
}
4663

tests/common/scenarios/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ pub(crate) async fn wait_for_htlcs_settled(
8787
panic!("HTLCs did not settle on {} channel {} within 15s", peer.name(), ext_channel_id);
8888
}
8989

90-
/// Build a fresh LDK node configured for interop tests. Uses electrum at the
90+
/// Build a fresh LDK node configured for interop tests. Uses esplora at the
9191
/// docker-compose default port and bumps sync timeouts for combo stress.
9292
pub(crate) fn setup_ldk_node() -> Node {
9393
let config = crate::common::random_config();
9494
let mut builder = ldk_node::Builder::from_config(config.node_config);
95-
let mut sync_config = ldk_node::config::ElectrumSyncConfig::default();
95+
let mut sync_config = ldk_node::config::EsploraSyncConfig::default();
9696
sync_config.timeouts_config.onchain_wallet_sync_timeout_secs = 180;
9797
sync_config.timeouts_config.lightning_wallet_sync_timeout_secs = 120;
98-
builder.set_chain_source_electrum("tcp://127.0.0.1:50001".to_string(), Some(sync_config));
98+
builder.set_chain_source_esplora("http://127.0.0.1:3002".to_string(), Some(sync_config));
9999
let node = builder.build(config.node_entropy).unwrap();
100100
node.start().unwrap();
101101
node

tests/docker/docker-compose-eclair.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,5 @@ services:
7777
-Declair.bitcoind.zmqtx=tcp://127.0.0.1:28333
7878
-Declair.features.keysend=optional
7979
-Declair.on-chain-fees.confirmation-priority.funding=slow
80+
${ECLAIR_EXTRA_JAVA_OPTS:-}
8081
-Declair.printToConsole

0 commit comments

Comments
 (0)