From 249f6bcd98fd0ea978ad5a25dd541be06fd695ab Mon Sep 17 00:00:00 2001 From: benthecarman Date: Wed, 11 Nov 2026 13:38:24 -0600 Subject: [PATCH] Bump LDK to v0.3.0-rc4 Pin every LDK crate to the tip of the 0.3 branch, i.e., the v0.3-rc4 tag plus the fix for the Esplora build of lightning-transaction-sync that broke with the output watch backport. LSPS2 OpenChannel events now carry the client to_self_delay limit agreed upon in the selected opening fee parameters, which the service must enforce itself. We now cap the channel's their_to_self_delay handshake limit accordingly, falling back to our configured limit for events persisted before the field existed. LDK's ChannelConfig gained inbound and outbound splice minimum-depth knobs. We don't expose them yet and fill in LDK's defaults when converting our ChannelConfig. bitcoin-payment-instructions is moved to a fork commit pinned to the same LDK revision so both resolve to a single copy of LDK. Developed with assistance from Claude Code. --- Cargo.toml | 30 +++++++++++++++--------------- src/config.rs | 1 + src/liquidity/service/lsps2.rs | 10 ++++++++++ 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f880b91162..77142ca255 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -86,18 +86,18 @@ uniffi-default = [ #lightning-macros = { version = "0.2.0" } #lightning-dns-resolver = { version = "0.3.0" } -lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", features = ["std"] } -lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5" } -lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", features = ["std"] } -lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5" } -lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", features = ["tokio"], optional = true } -lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5" } -lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5" } -lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", features = ["rest-client", "rpc-client", "tokio"], optional = true } -lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", optional = true } -lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", features = ["std"] } -lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5" } -lightning-dns-resolver = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", optional = true } +lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "ade399078c4826649174eb9053b8a3d1a19be047", features = ["std"] } +lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "ade399078c4826649174eb9053b8a3d1a19be047" } +lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "ade399078c4826649174eb9053b8a3d1a19be047", features = ["std"] } +lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "ade399078c4826649174eb9053b8a3d1a19be047" } +lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "ade399078c4826649174eb9053b8a3d1a19be047", features = ["tokio"], optional = true } +lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "ade399078c4826649174eb9053b8a3d1a19be047" } +lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "ade399078c4826649174eb9053b8a3d1a19be047" } +lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "ade399078c4826649174eb9053b8a3d1a19be047", features = ["rest-client", "rpc-client", "tokio"], optional = true } +lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "ade399078c4826649174eb9053b8a3d1a19be047", optional = true } +lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "ade399078c4826649174eb9053b8a3d1a19be047", features = ["std"] } +lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "ade399078c4826649174eb9053b8a3d1a19be047" } +lightning-dns-resolver = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "ade399078c4826649174eb9053b8a3d1a19be047", optional = true } bdk_chain = { version = "0.23.3", default-features = false, features = ["std"] } bdk_esplora = { version = "0.22.2", default-features = false, features = ["async-https-rustls", "tokio"], optional = true } @@ -132,14 +132,14 @@ postgres-native-tls = { version = "0.5", default-features = false, features = [" vss-client = { package = "vss-client-ng", version = "0.6", optional = true } prost = { version = "0.11.6", default-features = false, optional = true} #bitcoin-payment-instructions = { version = "0.6" } -bitcoin-payment-instructions = { git = "https://github.com/benthecarman/bitcoin-payment-instructions", rev = "3dbe11bdf8916639df42476501fb40f87b253e84", optional = true } +bitcoin-payment-instructions = { git = "https://github.com/benthecarman/bitcoin-payment-instructions", rev = "4e98947d9589f93b55c382e6d4393b8a6f18d600", optional = true } [target.'cfg(windows)'.dependencies] winapi = { version = "0.3", features = ["winbase"] } [dev-dependencies] -lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", features = ["std", "_test_utils"] } -lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d7a980641c6325ddda5072a0f470ef8392676cf5", features = ["tokio"] } +lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "ade399078c4826649174eb9053b8a3d1a19be047", features = ["std", "_test_utils"] } +lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "ade399078c4826649174eb9053b8a3d1a19be047", features = ["tokio"] } rand = { version = "0.9.2", default-features = false, features = ["std", "thread_rng", "os_rng"] } proptest = "1.0.0" regex = "1.5.6" diff --git a/src/config.rs b/src/config.rs index d524eac58e..17377fcc5b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -846,6 +846,7 @@ impl From for LdkChannelConfig { max_dust_htlc_exposure: value.max_dust_htlc_exposure.into(), force_close_avoidance_max_fee_satoshis: value.force_close_avoidance_max_fee_satoshis, accept_underpaying_htlcs: value.accept_underpaying_htlcs, + ..LdkChannelConfig::default() } } } diff --git a/src/liquidity/service/lsps2.rs b/src/liquidity/service/lsps2.rs index 7f49428d29..1b90430cc8 100644 --- a/src/liquidity/service/lsps2.rs +++ b/src/liquidity/service/lsps2.rs @@ -406,6 +406,7 @@ where opening_fee_msat: _, user_channel_id, intercept_scid: _, + max_client_to_self_delay, } => { if self.liquidity_manager.lsps2_service_handler().is_none() { log_error!(self.logger, "Failed to handle LSPS2ServiceEvent as LSPS2 liquidity service was not configured.",); @@ -492,6 +493,15 @@ where config.channel_config.forwarding_fee_base_msat = 0; config.channel_config.forwarding_fee_proportional_millionths = 0; + // Ensure the client's `to_self_delay` doesn't exceed the limit agreed upon in the + // selected opening fee parameters. Events persisted before the limit was carried + // in the event fall back to our currently configured limit. + let max_client_to_self_delay = + max_client_to_self_delay.unwrap_or(service_config.max_client_to_self_delay); + let their_to_self_delay = &mut config.channel_handshake_limits.their_to_self_delay; + *their_to_self_delay = + (*their_to_self_delay as u32).min(max_client_to_self_delay) as u16; + let result = if service_config.disable_client_reserve { self.channel_manager.create_channel_to_trusted_peer_0reserve( their_network_key,