Skip to content

Commit 1a18b88

Browse files
committed
Do not auto-select the lightning std feature from tx-sync crate
We have some downstream folks who are using LDK in wasm compiled via the normal rust wasm path. To ensure nothing breaks they want to use `no-std` on the lightning crate, disabling time calls as those panic. However, the HTTP logic in `lightning-transaction-sync` gets automatically stubbed out by the HTTP client crates when targeting wasm via `wasm_bindgen`, so it works fine despite the std restrictions. In order to make both work, `lightning-transaction-sync` can remain `std`, but needs to not automatically enable the `std` flag on the `lightning` crate, ie by setting `default-features = false`. We do so here.
1 parent 6ddf69c commit 1a18b88

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ jobs:
168168
done
169169
# check no-std compatibility across dependencies
170170
cd no-std-check
171-
cargo check --verbose --color always
171+
cargo check --verbose --color always --features lightning-transaction-sync
172172
- name: Build no-std-check on Rust ${{ matrix.toolchain }} for ARM Embedded
173173
if: "matrix.build-no-std && matrix.platform == 'ubuntu-latest'"
174174
run: |

lightning-transaction-sync/Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ esplora-blocking = ["esplora-client/blocking"]
2020
async-interface = []
2121

2222
[dependencies]
23-
lightning = { version = "0.0.113", path = "../lightning" }
24-
bitcoin = "0.29.0"
23+
lightning = { version = "0.0.113", path = "../lightning", default-features = false }
24+
bitcoin = { version = "0.29.0", default-features = false }
2525
bdk-macros = "0.6"
2626
futures = { version = "0.3", optional = true }
2727
esplora-client = { version = "0.3.0", default-features = false, optional = true }
2828

2929
[dev-dependencies]
30+
lightning = { version = "0.0.113", path = "../lightning", features = ["std"] }
3031
electrsd = { version = "0.22.0", features = ["legacy", "esplora_a33e97e1", "bitcoind_23_0"] }
3132
electrum-client = "0.12.0"
3233
once_cell = "1.16.0"

no-std-check/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ lightning = { path = "../lightning", default-features = false }
1111
lightning-invoice = { path = "../lightning-invoice", default-features = false }
1212
lightning-rapid-gossip-sync = { path = "../lightning-rapid-gossip-sync", default-features = false }
1313
lightning-background-processor = { path = "../lightning-background-processor", features = ["futures"], default-features = false }
14+
15+
# Obviously lightning-transaction-sync doesn't support no-std, but it should build
16+
# even if lightning is built with no-std.
17+
lightning-transaction-sync = { path = "../lightning-transaction-sync", optional = true }

0 commit comments

Comments
 (0)