Skip to content

Commit 7c36eaf

Browse files
committed
Support building a cdylib and skip libbitcoinconsensus in wasm32
This, combined with rust-bitcoin/rust-secp256k1#208 should get us building in wasm again, hopefully without any future complications due to WASM's lack of standard stdlibc.
1 parent 7ec16e5 commit 7c36eaf

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lightning/Cargo.toml

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Does most of the hard work, without implying a specific runtime, requiring clien
1010
Still missing tons of error-handling. See GitHub issues for suggested projects if you want to contribute. Don't have to bother telling you not to use this for anything serious, because you'd have to build a client around it to even try.
1111
"""
1212

13+
[lib]
14+
crate-type = ["cdylib", "rlib"]
15+
1316
[features]
1417
# Supports tracking channels with a non-bitcoin chain hashes. Currently enables all kinds of fun DoS attacks.
1518
non_bitcoin_chain_hash_routing = []
@@ -26,7 +29,9 @@ bitcoin = "0.21"
2629
bitcoin_hashes = "0.7"
2730
secp256k1 = "0.15"
2831

29-
[dev-dependencies.bitcoin]
32+
# Building libbitcoinconsensus in wasm32 requires a stdlibc, which is...complicated
33+
# Instead, just skip the script verification runs in wasm test runs.
34+
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies.bitcoin]
3035
version = "0.21"
3136
features = ["bitcoinconsensus"]
3237

lightning/src/ln/functional_test_utils.rs

+1
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ pub fn create_announced_chan_between_nodes_with_value<'a, 'b, 'c, 'd>(nodes: &'a
467467

468468
macro_rules! check_spends {
469469
($tx: expr, $($spends_txn: expr),*) => {
470+
#[cfg(not(target_arch = "wasm32"))]
470471
{
471472
$tx.verify(|out_point| {
472473
$(

0 commit comments

Comments
 (0)