Skip to content

Commit b848bf6

Browse files
committed
Add full_cycle test using the new Electrum chain source
.. as we do with `BitcoindRpc`, we now test `Electrum` support by running the `full_cycle` test in CI.
1 parent 21f60d7 commit b848bf6

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

tests/common/mod.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub(crate) mod logging;
1212

1313
use logging::TestLogWriter;
1414

15-
use ldk_node::config::{Config, EsploraSyncConfig};
15+
use ldk_node::config::{Config, ElectrumSyncConfig, EsploraSyncConfig};
1616
use ldk_node::io::sqlite_store::SqliteStore;
1717
use ldk_node::payment::{PaymentDirection, PaymentKind, PaymentStatus};
1818
use ldk_node::{
@@ -255,6 +255,7 @@ type TestNode = Node;
255255
#[derive(Clone)]
256256
pub(crate) enum TestChainSource<'a> {
257257
Esplora(&'a ElectrsD),
258+
Electrum(&'a ElectrsD),
258259
BitcoindRpc(&'a BitcoinD),
259260
}
260261

@@ -311,6 +312,11 @@ pub(crate) fn setup_node(
311312
let sync_config = EsploraSyncConfig { background_sync_config: None };
312313
builder.set_chain_source_esplora(esplora_url.clone(), Some(sync_config));
313314
},
315+
TestChainSource::Electrum(electrsd) => {
316+
let electrum_url = format!("tcp://{}", electrsd.electrum_url);
317+
let sync_config = ElectrumSyncConfig { background_sync_config: None };
318+
builder.set_chain_source_electrum(electrum_url.clone(), Some(sync_config));
319+
},
314320
TestChainSource::BitcoindRpc(bitcoind) => {
315321
let rpc_host = bitcoind.params.rpc_socket.ip().to_string();
316322
let rpc_port = bitcoind.params.rpc_socket.port();

tests/integration_tests_rust.rs

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ fn channel_full_cycle() {
4545
do_channel_full_cycle(node_a, node_b, &bitcoind.client, &electrsd.client, false, true, false);
4646
}
4747

48+
#[test]
49+
fn channel_full_cycle_electrum() {
50+
let (bitcoind, electrsd) = setup_bitcoind_and_electrsd();
51+
let chain_source = TestChainSource::Electrum(&electrsd);
52+
let (node_a, node_b) = setup_two_nodes(&chain_source, false, true, false);
53+
do_channel_full_cycle(node_a, node_b, &bitcoind.client, &electrsd.client, false, true, false);
54+
}
55+
4856
#[test]
4957
fn channel_full_cycle_bitcoind() {
5058
let (bitcoind, electrsd) = setup_bitcoind_and_electrsd();

0 commit comments

Comments
 (0)