Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/0fc-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ jobs:
echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
- name: Test with 0FC enabled
run: |
RUSTFLAGS="--cfg no_download --cfg cycle_tests --cfg tokio_unstable --cfg zero_fee_commitment_tests" cargo test -- --test-threads=1 --no-capture
RUSTFLAGS="--cfg cycle_tests --cfg tokio_unstable --cfg zero_fee_commitment_tests" cargo test -- --test-threads=1 --no-capture
4 changes: 2 additions & 2 deletions .github/workflows/hrn-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ jobs:
echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
- name: Run HRN Integration Tests
run: |
RUSTFLAGS="--cfg no_download --cfg hrn_tests $RUSTFLAGS" cargo test --test integration_tests_hrn
RUSTFLAGS="--cfg no_download --cfg hrn_tests $RUSTFLAGS" cargo test --test integration_tests_hrn --no-default-features --features uniffi-default
RUSTFLAGS="--cfg hrn_tests $RUSTFLAGS" cargo test --test integration_tests_hrn
RUSTFLAGS="--cfg hrn_tests $RUSTFLAGS" cargo test --test integration_tests_hrn --no-default-features --features uniffi-default
2 changes: 1 addition & 1 deletion .github/workflows/postgres-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ jobs:
env:
TEST_POSTGRES_URL: "host=localhost user=postgres password=postgres"
run: |
RUSTFLAGS="--cfg no_download --cfg cycle_tests" cargo test --features storage-postgres --test integration_tests_postgres
RUSTFLAGS="--cfg cycle_tests" cargo test --features storage-postgres --test integration_tests_postgres
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ jobs:
- name: Test on Rust ${{ matrix.toolchain }}
if: "matrix.platform != 'windows-latest'"
run: |
RUSTFLAGS="--cfg no_download --cfg cycle_tests --cfg tokio_unstable" cargo test
RUSTFLAGS="--cfg cycle_tests --cfg tokio_unstable" cargo test
- name: Test with UniFFI support on Rust ${{ matrix.toolchain }}
if: "matrix.platform != 'windows-latest' && matrix.build-uniffi"
run: |
RUSTFLAGS="--cfg no_download --cfg cycle_tests" cargo test --no-default-features --features uniffi-default
RUSTFLAGS="--cfg cycle_tests" cargo test --no-default-features --features uniffi-default

linting:
name: Linting
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/vss-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,30 @@ jobs:
repository: lightningdevkit/vss-server
path: vss-server

- name: Enable caching for bitcoind

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code duplicated below, but not sure if there's a reasonable extraction. Needs updating in two places when core is updated now.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it intentionally copying the approach in rust.yml.

id: cache-bitcoind
uses: actions/cache@v4
with:
path: bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
key: bitcoind-31.1-${{ runner.os }}-${{ runner.arch }}
- name: Enable caching for electrs
id: cache-electrs
uses: actions/cache@v4
with:
path: bin/electrs-${{ runner.os }}-${{ runner.arch }}
key: electrs-${{ runner.os }}-${{ runner.arch }}
- name: Download bitcoind/electrs
if: "steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true'"
run: |
source ./ldk-node/scripts/download_bitcoind_electrs.sh
mkdir -p bin
mv "$BITCOIND_EXE" bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }}
- name: Set bitcoind/electrs environment variables
run: |
echo "BITCOIND_EXE=$( pwd )/bin/bitcoind-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"

- name: Build and Deploy VSS Server
run: |
cd vss-server
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/vss-no-auth-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,30 @@ jobs:
repository: lightningdevkit/vss-server
path: vss-server

- name: Enable caching for bitcoind
id: cache-bitcoind
uses: actions/cache@v4
with:
path: bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
key: bitcoind-31.1-${{ runner.os }}-${{ runner.arch }}
- name: Enable caching for electrs
id: cache-electrs
uses: actions/cache@v4
with:
path: bin/electrs-${{ runner.os }}-${{ runner.arch }}
key: electrs-${{ runner.os }}-${{ runner.arch }}
- name: Download bitcoind/electrs
if: "steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true'"
run: |
source ./ldk-node/scripts/download_bitcoind_electrs.sh
mkdir -p bin
mv "$BITCOIND_EXE" bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }}
- name: Set bitcoind/electrs environment variables
run: |
echo "BITCOIND_EXE=$( pwd )/bin/bitcoind-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"

- name: Build and Deploy VSS Server
run: |
cd vss-server
Expand Down
6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,8 @@ criterion = { version = "0.7.0", features = ["async_tokio"] }
ldk-node-062 = { package = "ldk-node", version = "=0.6.2" }
ldk-node-070 = { package = "ldk-node", version = "=0.7.0" }

[target.'cfg(not(no_download))'.dev-dependencies]
electrsd = { version = "0.36.1", default-features = false, features = ["legacy", "esplora_a33e97e1", "corepc-node_29_0"] }

[target.'cfg(no_download)'.dev-dependencies]
# Test binaries are provided via scripts/download_bitcoind_electrs.sh.
# Keep automatic downloads disabled to avoid the yanked zip dependency.
electrsd = { version = "0.36.1", default-features = false, features = ["legacy"] }
corepc-node = { version = "0.10.1", default-features = false, features = ["29_0"] }

Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,20 @@ LDK Node itself is written in [Rust][rust] and may therefore be natively added a
## MSRV
The Minimum Supported Rust Version (MSRV) is currently 1.85.0.

## Running Tests

Rust integration tests and benchmarks require Bitcoin Core and Esplora-enabled `electrs` binaries.
On Linux and macOS, run the following from the repository root in Bash:

```bash
source ./scripts/download_bitcoind_electrs.sh
RUSTFLAGS="--cfg tokio_unstable" cargo test
```

The script requires `curl`, `unzip`, `tar`, and `shasum`. It verifies the downloads and exports
`BITCOIND_EXE` and `ELECTRS_EXE` for the current shell. Alternatively, set these variables to
compatible binaries you already have. Cargo's automatic binary downloads are disabled.

[api_docs]: https://docs.rs/ldk-node/*/ldk_node/
[api_docs_node]: https://docs.rs/ldk-node/*/ldk_node/struct.Node.html
[api_docs_builder]: https://docs.rs/ldk-node/*/ldk_node/struct.Builder.html
Expand Down
10 changes: 3 additions & 7 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,19 +345,15 @@ macro_rules! expect_payment_successful_event {
pub(crate) use expect_payment_successful_event;

pub(crate) fn setup_bitcoind_and_electrsd() -> (BitcoinD, ElectrsD) {
let bitcoind_exe =
env::var("BITCOIND_EXE").ok().or_else(|| corepc_node::downloaded_exe_path().ok()).expect(
"you need to provide an env var BITCOIND_EXE or specify a bitcoind version feature",
);
let bitcoind_exe = env::var("BITCOIND_EXE")
.expect("set BITCOIND_EXE or source ./scripts/download_bitcoind_electrs.sh before testing");
let mut bitcoind_conf = corepc_node::Conf::default();
bitcoind_conf.network = "regtest";
bitcoind_conf.args.push("-rest");
let bitcoind = BitcoinD::with_conf(bitcoind_exe, &bitcoind_conf).unwrap();

let electrs_exe = env::var("ELECTRS_EXE")
.ok()
.or_else(electrsd::downloaded_exe_path)
.expect("you need to provide env var ELECTRS_EXE or specify an electrsd version feature");
.expect("set ELECTRS_EXE or source ./scripts/download_bitcoind_electrs.sh before testing");
let mut electrsd_conf = electrsd::Conf::default();
electrsd_conf.http_enabled = true;
electrsd_conf.network = "regtest";
Expand Down
10 changes: 2 additions & 8 deletions tests/integration_tests_rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3123,21 +3123,15 @@ async fn run_rbf_splice_channel_test(confirm_original: bool) {
// Use a custom bitcoind config with a lower incrementalrelayfee so that the +25 sat/kwu
// (0.1 sat/vB) RBF feerate bump satisfies BIP125's absolute fee increase requirement.
let bitcoind_exe = std::env::var("BITCOIND_EXE")
.ok()
.or_else(|| corepc_node::downloaded_exe_path().ok())
.expect(
"you need to provide an env var BITCOIND_EXE or specify a bitcoind version feature",
);
.expect("set BITCOIND_EXE or source ./scripts/download_bitcoind_electrs.sh before testing");
let mut bitcoind_conf = corepc_node::Conf::default();
bitcoind_conf.network = "regtest";
bitcoind_conf.args.push("-rest");
bitcoind_conf.args.push("-incrementalrelayfee=0.00000100");
let bitcoind = BitcoinD::with_conf(bitcoind_exe, &bitcoind_conf).unwrap();

let electrs_exe = std::env::var("ELECTRS_EXE")
.ok()
.or_else(electrsd::downloaded_exe_path)
.expect("you need to provide env var ELECTRS_EXE or specify an electrsd version feature");
.expect("set ELECTRS_EXE or source ./scripts/download_bitcoind_electrs.sh before testing");
let mut electrsd_conf = electrsd::Conf::default();
electrsd_conf.http_enabled = true;
electrsd_conf.network = "regtest";
Expand Down
Loading