Skip to content

Commit b8eb376

Browse files
committed
Merge branch 'refs/heads/main' into monitor-upd-persister
# Conflicts: # src/io/test_utils.rs
2 parents 5a65e04 + ddd1768 commit b8eb376

39 files changed

+5548
-1099
lines changed

.github/workflows/kotlin.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ jobs:
3939
- name: Generate Kotlin JVM
4040
run: ./scripts/uniffi_bindgen_generate_kotlin.sh
4141

42+
- name: Install `bindgen-cli`
43+
run: cargo install --force bindgen-cli
44+
4245
- name: Generate Kotlin Android
4346
run: ./scripts/uniffi_bindgen_generate_kotlin_android.sh
4447

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CI Checks - LND Integration Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
check-lnd:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout repository
10+
uses: actions/checkout@v4
11+
12+
- name: Check and install CMake if needed
13+
# lnd_grpc_rust (via prost-build v0.10.4) requires CMake >= 3.5 but is incompatible with CMake >= 4.0.
14+
# This step checks if CMake is missing, below 3.5, or 4.0 or higher, and installs CMake 3.31.6 if needed,
15+
# ensuring compatibility with prost-build in ubuntu-latest.
16+
run: |
17+
if ! command -v cmake &> /dev/null ||
18+
[ "$(cmake --version | head -n1 | cut -d' ' -f3)" \< "3.5" ] ||
19+
[ "$(cmake --version | head -n1 | cut -d' ' -f3)" \> "4.0" ]; then
20+
sudo apt-get update
21+
sudo apt-get remove -y cmake
22+
wget https://github.com/Kitware/CMake/releases/download/v3.31.6/cmake-3.31.6-Linux-x86_64.sh
23+
echo "518c76bd18cc4ca5faab891db69b1289dc1bf134f394f0983a19576711b95210 cmake-3.31.6-Linux-x86_64.sh" | sha256sum -c - || {
24+
echo "Error: The checksum of the downloaded file does not match the expected value!"
25+
exit 1
26+
}
27+
chmod +x cmake-3.31.6-Linux-x86_64.sh
28+
sudo ./cmake-3.31.6-Linux-x86_64.sh --prefix=/usr/local --skip-license
29+
fi
30+
31+
- name: Create temporary directory for LND data
32+
id: create-temp-dir
33+
run: echo "LND_DATA_DIR=$(mktemp -d)" >> $GITHUB_ENV
34+
35+
- name: Start bitcoind, electrs, and LND
36+
run: docker compose -f docker-compose-lnd.yml up -d
37+
env:
38+
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}
39+
40+
- name: Set permissions for LND data directory
41+
# In PR 4622 (https://github.com/lightningnetwork/lnd/pull/4622),
42+
# LND sets file permissions to 0700, preventing test code from accessing them.
43+
# This step ensures the test suite has the necessary permissions.
44+
run: sudo chmod -R 755 $LND_DATA_DIR
45+
env:
46+
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}
47+
48+
- name: Run LND integration tests
49+
run: LND_CERT_PATH=$LND_DATA_DIR/tls.cert LND_MACAROON_PATH=$LND_DATA_DIR/data/chain/bitcoin/regtest/admin.macaroon
50+
RUSTFLAGS="--cfg lnd_test" cargo test --test integration_tests_lnd -- --exact --show-output
51+
env:
52+
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}

.github/workflows/rust.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
if: matrix.msrv
4747
run: |
4848
cargo update -p home --precise "0.5.9" --verbose # home v0.5.11 requires rustc 1.81 or newer
49+
cargo update -p idna_adapter --precise "1.1.0" --verbose # idna_adapter 1.2 switched to ICU4X, requiring 1.81 and newer
4950
- name: Set RUSTFLAGS to deny warnings
5051
if: "matrix.toolchain == 'stable'"
5152
run: echo "RUSTFLAGS=-D warnings" >> "$GITHUB_ENV"

CHANGELOG.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,60 @@
1+
# 0.5.0 - Apr. 29, 2025
2+
Besides numerous API improvements and bugfixes this fifth minor release notably adds support for sourcing chain and fee rate data from an Electrum backend, requesting channels via the [bLIP-51 / LSPS1](https://github.com/lightning/blips/blob/master/blip-0051.md) protocol, as well as experimental support for operating as a [bLIP-52 / LSPS2](https://github.com/lightning/blips/blob/master/blip-0052.md) service.
3+
4+
## Feature and API updates
5+
- The `PaymentSuccessful` event now exposes a `payment_preimage` field (#392).
6+
- The node now emits `PaymentForwarded` events for forwarded payments (#404).
7+
- The ability to send custom TLVs as part of spontaneous payments has been added (#411).
8+
- The ability to override the used fee rates for on-chain sending has been added (#434).
9+
- The ability to set a description hash when creating a BOLT11 invoice has been added (#438).
10+
- The ability to export pathfinding scores has been added (#458).
11+
- The ability to request inbound channels from an LSP via the bLIP-51 / LSPS1 protocol has been added (#418).
12+
- The `ChannelDetails` returned by `Node::list_channels` now exposes fields for the channel's SCIDs (#444).
13+
- Lightning peer-to-peer gossip data is now being verified when syncing from a Bitcoin Core RPC backend (#428).
14+
- The logging sub-system was reworked to allow logging to backends using the Rust [`log`](https://crates.io/crates/log) facade, as well as via a custom logger trait (#407, #450, #454).
15+
- On-chain transactions are now added to the internal payment store and exposed via `Node::list_payments` (#432).
16+
- Inbound announced channels are now rejected if not all requirements for operating as a forwarding node (set listening addresses and node alias) have been met (#467).
17+
- Initial support for operating as an bLIP-52 / LSPS2 service has been added (#420).
18+
- **Note**: bLIP-52 / LSPS2 support is considered 'alpha'/'experimental' and should *not* yet be used in production.
19+
- The `Builder::set_entropy_seed_bytes` method now takes an array rather than a `Vec` (#493).
20+
- The builder will now return a `NetworkMismatch` error in case of network switching (#485).
21+
- The `Bolt11Jit` payment variant now exposes a field telling how much fee the LSP withheld (#497).
22+
- The ability to disable syncing Lightning and on-chain wallets in the background has been added. If it is disabled, the user is responsible for running `Node::sync_wallets` manually (#508).
23+
- The ability to configure the node's announcement addresses independently from the listening addresses has been added (#484).
24+
- The ability to choose whether to honor the Anchor reserves when calling `send_all_to_address` has been added (#345).
25+
- The ability to sync the node via an Electrum backend has been added (#486).
26+
27+
## Bug Fixes and Improvements
28+
- When syncing from Bitcoin Core RPC, syncing mempool entries has been made more efficient (#410, #465).
29+
- We now ensure the our configured fallback rates are used when the configured chain source would return huge bogus values during fee estimation (#430).
30+
- We now re-enabled trying to bump Anchor channel transactions for trusted counterparties in the `ContentiousClaimable` case to reduce the risk of losing funds in certain edge cases (#461).
31+
- An issue that would potentially have us panic on retrying the chain listening initialization when syncing from Bitcoin Core RPC has been fixed (#471).
32+
- The `Node::remove_payment` now also removes the respective entry from the in-memory state, not only from the persisted payment store (#514).
33+
34+
## Compatibility Notes
35+
- The filesystem logger was simplified and its default path changed to `ldk_node.log` in the configured storage directory (#394).
36+
- The BDK dependency has been bumped to `bdk_wallet` v1.0 (#426).
37+
- The LDK dependency has been bumped to `lightning` v0.1 (#426).
38+
- The `rusqlite` dependency has been bumped to v0.31 (#403).
39+
- The minimum supported Rust version (MSRV) has been bumped to v1.75 (#429).
40+
41+
In total, this release features 53 files changed, 6147 insertions, 1193 deletions, in 191 commits from 14 authors in alphabetical order:
42+
43+
- alexanderwiederin
44+
- Andrei
45+
- Artur Gontijo
46+
- Ayla Greystone
47+
- Elias Rohrer
48+
- elnosh
49+
- Enigbe Ochekliye
50+
- Evan Feenstra
51+
- G8XSU
52+
- Joost Jager
53+
- maan2003
54+
- moisesPompilio
55+
- Rob N
56+
- Vincenzo Palazzo
57+
158
# 0.4.3 - Jan. 23, 2025
259

360
This patch release fixes the broken Rust build resulting from `cargo` treating the recent v0.1.0 release of `lightning-liquidity` as API-compatible with the previous v0.1.0-alpha.6 release (even though it's not).

Cargo.toml

100644100755
Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ldk-node"
3-
version = "0.5.0+git"
3+
version = "0.6.0+git"
44
authors = ["Elias Rohrer <[email protected]>"]
55
homepage = "https://lightningdevkit.org/"
66
license = "MIT OR Apache-2.0"
@@ -36,7 +36,7 @@ lightning-persister = { version = "0.1.0" }
3636
lightning-background-processor = { version = "0.1.0", features = ["futures"] }
3737
lightning-rapid-gossip-sync = { version = "0.1.0" }
3838
lightning-block-sync = { version = "0.1.0", features = ["rpc-client", "tokio"] }
39-
lightning-transaction-sync = { version = "0.1.0", features = ["esplora-async-https", "time"] }
39+
lightning-transaction-sync = { version = "0.1.0", features = ["esplora-async-https", "time", "electrum"] }
4040
lightning-liquidity = { version = "0.1.0", features = ["std"] }
4141

4242
#lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main", features = ["std"] }
@@ -47,7 +47,7 @@ lightning-liquidity = { version = "0.1.0", features = ["std"] }
4747
#lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main", features = ["futures"] }
4848
#lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }
4949
#lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main", features = ["rpc-client", "tokio"] }
50-
#lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main", features = ["esplora-async-https", "time"] }
50+
#lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main", features = ["esplora-async-https", "electrum", "time"] }
5151
#lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }
5252

5353
#lightning = { path = "../rust-lightning/lightning", features = ["std"] }
@@ -58,11 +58,12 @@ lightning-liquidity = { version = "0.1.0", features = ["std"] }
5858
#lightning-background-processor = { path = "../rust-lightning/lightning-background-processor", features = ["futures"] }
5959
#lightning-rapid-gossip-sync = { path = "../rust-lightning/lightning-rapid-gossip-sync" }
6060
#lightning-block-sync = { path = "../rust-lightning/lightning-block-sync", features = ["rpc-client", "tokio"] }
61-
#lightning-transaction-sync = { path = "../rust-lightning/lightning-transaction-sync", features = ["esplora-async-https", "time"] }
61+
#lightning-transaction-sync = { path = "../rust-lightning/lightning-transaction-sync", features = ["esplora-async-https", "electrum", "time"] }
6262
#lightning-liquidity = { path = "../rust-lightning/lightning-liquidity", features = ["std"] }
6363

6464
bdk_chain = { version = "0.21.1", default-features = false, features = ["std"] }
6565
bdk_esplora = { version = "0.20.1", default-features = false, features = ["async-https-rustls", "tokio"]}
66+
bdk_electrum = { version = "0.20.1", default-features = false, features = ["use-rustls"]}
6667
bdk_wallet = { version = "1.0.0", default-features = false, features = ["std", "keys-bip39"]}
6768

6869
reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls"] }
@@ -76,6 +77,7 @@ rand = "0.8.5"
7677
chrono = { version = "0.4", default-features = false, features = ["clock"] }
7778
tokio = { version = "1.37", default-features = false, features = [ "rt-multi-thread", "time", "sync", "macros" ] }
7879
esplora-client = { version = "0.11", default-features = false, features = ["tokio", "async-https-rustls"] }
80+
electrum-client = { version = "0.22.0", default-features = true }
7981
libc = "0.2"
8082
uniffi = { version = "0.27.3", features = ["build"], optional = true }
8183
serde = { version = "1.0.210", default-features = false, features = ["std", "derive"] }
@@ -92,20 +94,23 @@ winapi = { version = "0.3", features = ["winbase"] }
9294
lightning = { version = "0.1.0", features = ["std", "_test_utils"] }
9395
#lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["std", "_test_utils"] }
9496
#lightning = { path = "../rust-lightning/lightning", features = ["std", "_test_utils"] }
95-
electrum-client = { version = "0.21.0", default-features = true }
96-
bitcoincore-rpc = { version = "0.19.0", default-features = false }
9797
proptest = "1.0.0"
9898
regex = "1.5.6"
9999

100100
[target.'cfg(not(no_download))'.dev-dependencies]
101-
electrsd = { version = "0.29.0", features = ["legacy", "esplora_a33e97e1", "bitcoind_25_0"] }
101+
electrsd = { version = "0.33.0", default-features = false, features = ["legacy", "esplora_a33e97e1", "corepc-node_27_2"] }
102102

103103
[target.'cfg(no_download)'.dev-dependencies]
104-
electrsd = { version = "0.29.0", features = ["legacy"] }
104+
electrsd = { version = "0.33.0", default-features = false, features = ["legacy"] }
105+
corepc-node = { version = "0.7.0", default-features = false, features = ["27_2"] }
105106

106107
[target.'cfg(cln_test)'.dev-dependencies]
107108
clightningrpc = { version = "0.3.0-beta.8", default-features = false }
108109

110+
[target.'cfg(lnd_test)'.dev-dependencies]
111+
lnd_grpc_rust = { version = "2.10.0", default-features = false }
112+
tokio = { version = "1.37", features = ["fs"] }
113+
109114
[build-dependencies]
110115
uniffi = { version = "0.27.3", features = ["build"], optional = true }
111116

@@ -123,4 +128,5 @@ check-cfg = [
123128
"cfg(ldk_bench)",
124129
"cfg(tokio_unstable)",
125130
"cfg(cln_test)",
131+
"cfg(lnd_test)",
126132
]

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import PackageDescription
55

6-
let tag = "v0.4.2"
7-
let checksum = "95ea5307eb3a99203e39cfa21d962bfe3e879e62429e8c7cdf5292cae5dc35cc"
6+
let tag = "v0.5.0"
7+
let checksum = "fd9eb84a478402af8f790519a463b6e1bf6ab3987f5951cd8375afb9d39e7a4b"
88
let url = "https://github.com/lightningdevkit/ldk-node/releases/download/\(tag)/LDKNodeFFI.xcframework.zip"
99

1010
let package = Package(

README.md

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

5757
- On-chain data is handled by the integrated [BDK][bdk] wallet.
58-
- Chain data may currently be sourced from the Bitcoin Core RPC interface or an [Esplora][esplora] server, while support for Electrum will follow soon.
58+
- Chain data may currently be sourced from the Bitcoin Core RPC interface, or from an [Electrum][electrum] or [Esplora][esplora] server.
5959
- 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.
6060
- 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.
6161
- 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.
@@ -72,6 +72,7 @@ The Minimum Supported Rust Version (MSRV) is currently 1.75.0.
7272
[rust_crate]: https://crates.io/
7373
[ldk]: https://lightningdevkit.org/
7474
[bdk]: https://bitcoindevkit.org/
75+
[electrum]: https://github.com/spesmilo/electrum-protocol
7576
[esplora]: https://github.com/Blockstream/esplora
7677
[sqlite]: https://sqlite.org/
7778
[rust]: https://www.rust-lang.org/

bindings/kotlin/ldk-node-android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ org.gradle.jvmargs=-Xmx1536m
22
android.useAndroidX=true
33
android.enableJetifier=true
44
kotlin.code.style=official
5-
libraryVersion=0.4.2
5+
libraryVersion=0.5.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536m
22
kotlin.code.style=official
3-
libraryVersion=0.4.2
3+
libraryVersion=0.5.0

bindings/ldk_node.udl

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ dictionary Config {
77
string storage_dir_path;
88
Network network;
99
sequence<SocketAddress>? listening_addresses;
10+
sequence<SocketAddress>? announcement_addresses;
1011
NodeAlias? node_alias;
1112
sequence<PublicKey> trusted_peers_0conf;
1213
u64 probing_liquidity_limit_multiplier;
@@ -19,12 +20,32 @@ dictionary AnchorChannelsConfig {
1920
u64 per_channel_reserve_sats;
2021
};
2122

22-
dictionary EsploraSyncConfig {
23+
dictionary BackgroundSyncConfig {
2324
u64 onchain_wallet_sync_interval_secs;
2425
u64 lightning_wallet_sync_interval_secs;
2526
u64 fee_rate_cache_update_interval_secs;
2627
};
2728

29+
dictionary EsploraSyncConfig {
30+
BackgroundSyncConfig? background_sync_config;
31+
};
32+
33+
dictionary ElectrumSyncConfig {
34+
BackgroundSyncConfig? background_sync_config;
35+
};
36+
37+
dictionary LSPS2ServiceConfig {
38+
string? require_token;
39+
boolean advertise_service;
40+
u32 channel_opening_fee_ppm;
41+
u32 channel_over_provisioning_ppm;
42+
u64 min_channel_opening_fee_msat;
43+
u32 min_channel_lifetime;
44+
u32 max_client_to_self_delay;
45+
u64 min_payment_size_msat;
46+
u64 max_payment_size_msat;
47+
};
48+
2849
enum LogLevel {
2950
"Gossip",
3051
"Trace",
@@ -55,19 +76,22 @@ interface Builder {
5576
void set_entropy_seed_bytes(sequence<u8> seed_bytes);
5677
void set_entropy_bip39_mnemonic(Mnemonic mnemonic, string? passphrase);
5778
void set_chain_source_esplora(string server_url, EsploraSyncConfig? config);
79+
void set_chain_source_electrum(string server_url, ElectrumSyncConfig? config);
5880
void set_chain_source_bitcoind_rpc(string rpc_host, u16 rpc_port, string rpc_user, string rpc_password);
5981
void set_gossip_source_p2p();
6082
void set_gossip_source_rgs(string rgs_server_url);
6183
void set_liquidity_source_lsps1(PublicKey node_id, SocketAddress address, string? token);
6284
void set_liquidity_source_lsps2(PublicKey node_id, SocketAddress address, string? token);
6385
void set_storage_dir_path(string storage_dir_path);
6486
void set_filesystem_logger(string? log_file_path, LogLevel? max_log_level);
65-
void set_log_facade_logger(LogLevel? max_log_level);
87+
void set_log_facade_logger();
6688
void set_custom_logger(LogWriter log_writer);
6789
void set_network(Network network);
6890
[Throws=BuildError]
6991
void set_listening_addresses(sequence<SocketAddress> listening_addresses);
7092
[Throws=BuildError]
93+
void set_announcement_addresses(sequence<SocketAddress> announcement_addresses);
94+
[Throws=BuildError]
7195
void set_node_alias(string node_alias);
7296
[Throws=BuildError]
7397
Node build();
@@ -92,9 +116,11 @@ interface Node {
92116
Event wait_next_event();
93117
[Async]
94118
Event next_event_async();
119+
[Throws=NodeError]
95120
void event_handled();
96121
PublicKey node_id();
97122
sequence<SocketAddress>? listening_addresses();
123+
sequence<SocketAddress>? announcement_addresses();
98124
NodeAlias? node_alias();
99125
Bolt11Payment bolt11_payment();
100126
Bolt12Payment bolt12_payment();
@@ -302,13 +328,15 @@ enum BuildError {
302328
"InvalidSystemTime",
303329
"InvalidChannelMonitor",
304330
"InvalidListeningAddresses",
331+
"InvalidAnnouncementAddresses",
305332
"InvalidNodeAlias",
306333
"ReadFailed",
307334
"WriteFailed",
308335
"StoragePathAccessFailed",
309336
"KVStoreSetupFailed",
310337
"WalletSetupFailed",
311338
"LoggerSetupFailed",
339+
"NetworkMismatch",
312340
};
313341

314342
[Trait]
@@ -373,7 +401,7 @@ interface ClosureReason {
373401
interface PaymentKind {
374402
Onchain(Txid txid, ConfirmationStatus status);
375403
Bolt11(PaymentHash hash, PaymentPreimage? preimage, PaymentSecret? secret);
376-
Bolt11Jit(PaymentHash hash, PaymentPreimage? preimage, PaymentSecret? secret, LSPFeeLimits lsp_fee_limits);
404+
Bolt11Jit(PaymentHash hash, PaymentPreimage? preimage, PaymentSecret? secret, u64? counterparty_skimmed_fee_msat, LSPFeeLimits lsp_fee_limits);
377405
Bolt12Offer(PaymentHash? hash, PaymentPreimage? preimage, PaymentSecret? secret, OfferId offer_id, UntrustedString? payer_note, u64? quantity);
378406
Bolt12Refund(PaymentHash? hash, PaymentPreimage? preimage, PaymentSecret? secret, UntrustedString? payer_note, u64? quantity);
379407
Spontaneous(PaymentHash hash, PaymentPreimage? preimage);
@@ -412,6 +440,7 @@ dictionary PaymentDetails {
412440
PaymentId id;
413441
PaymentKind kind;
414442
u64? amount_msat;
443+
u64? fee_paid_msat;
415444
PaymentDirection direction;
416445
PaymentStatus status;
417446
u64 latest_update_timestamp;

0 commit comments

Comments
 (0)