Skip to content

Commit 5f0aa28

Browse files
committed
Add CBF integration tests and documentation
1 parent 2366984 commit 5f0aa28

File tree

4 files changed

+359
-5
lines changed

4 files changed

+359
-5
lines changed

.github/workflows/rust.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ jobs:
8484
- name: Test on Rust ${{ matrix.toolchain }}
8585
if: "matrix.platform != 'windows-latest'"
8686
run: |
87-
RUSTFLAGS="--cfg no_download --cfg cycle_tests" cargo test
87+
RUSTFLAGS="--cfg no_download --cfg cycle_tests" cargo test -- --skip cbf
88+
- name: Test CBF on Rust ${{ matrix.toolchain }}
89+
if: "matrix.platform != 'windows-latest'"
90+
run: |
91+
RUSTFLAGS="--cfg no_download --cfg cycle_tests" cargo test cbf -- --test-threads=1
8892
- name: Test with UniFFI support on Rust ${{ matrix.toolchain }}
8993
if: "matrix.platform != 'windows-latest' && matrix.build-uniffi"
9094
run: |

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn main() {
6161
LDK Node currently comes with a decidedly opinionated set of design choices:
6262

6363
- On-chain data is handled by the integrated [BDK][bdk] wallet.
64-
- Chain data may currently be sourced from the Bitcoin Core RPC interface, or from an [Electrum][electrum] or [Esplora][esplora] server.
64+
- Chain data may currently be sourced from the Bitcoin Core RPC interface, from an [Electrum][electrum] or [Esplora][esplora] server, or via [compact block filters (BIP 157)][bip157].
6565
- Wallet and channel state may be persisted to an [SQLite][sqlite] database, to file system, or to a custom back-end to be implemented by the user.
6666
- Gossip data may be sourced via Lightning's peer-to-peer network or the [Rapid Gossip Sync](https://docs.rs/lightning-rapid-gossip-sync/*/lightning_rapid_gossip_sync/) protocol.
6767
- Entropy for the Lightning and on-chain wallets may be sourced from raw bytes or a [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) mnemonic. In addition, LDK Node offers the means to generate and persist the entropy bytes to disk.
@@ -80,6 +80,7 @@ The Minimum Supported Rust Version (MSRV) is currently 1.85.0.
8080
[bdk]: https://bitcoindevkit.org/
8181
[electrum]: https://github.com/spesmilo/electrum-protocol
8282
[esplora]: https://github.com/Blockstream/esplora
83+
[bip157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
8384
[sqlite]: https://sqlite.org/
8485
[rust]: https://www.rust-lang.org/
8586
[swift]: https://www.swift.org/

tests/common/mod.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,16 @@ pub(crate) fn setup_bitcoind_and_electrsd() -> (BitcoinD, ElectrsD) {
246246
pub(crate) fn random_chain_source<'a>(
247247
bitcoind: &'a BitcoinD, electrsd: &'a ElectrsD,
248248
) -> TestChainSource<'a> {
249-
let r = rand::random_range(0..3);
249+
// Allow forcing a specific backend via LDK_TEST_CHAIN_SOURCE env var.
250+
// Valid values: "esplora", "electrum", "bitcoind-rpc", "bitcoind-rest", "cbf"
251+
let r = match std::env::var("LDK_TEST_CHAIN_SOURCE").ok().as_deref() {
252+
Some("esplora") => 0,
253+
Some("electrum") => 1,
254+
Some("bitcoind-rpc") => 2,
255+
Some("bitcoind-rest") => 3,
256+
Some("cbf") => 4,
257+
_ => rand::random_range(0..5),
258+
};
250259
match r {
251260
0 => {
252261
println!("Randomly setting up Esplora chain syncing...");
@@ -264,6 +273,10 @@ pub(crate) fn random_chain_source<'a>(
264273
println!("Randomly setting up Bitcoind REST chain syncing...");
265274
TestChainSource::BitcoindRestSync(bitcoind)
266275
},
276+
4 => {
277+
println!("Randomly setting up CBF compact block filter syncing...");
278+
TestChainSource::Cbf(bitcoind)
279+
},
267280
_ => unreachable!(),
268281
}
269282
}

0 commit comments

Comments
 (0)