Skip to content

Commit 16eaa6f

Browse files
authored
Merge pull request #878 from jkczyz/2026-04-lsp-max-in-flight
Drop `max_inbound_htlc_value_in_flight_percent_of_channel `
2 parents 4e70757 + d93bb39 commit 16eaa6f

5 files changed

Lines changed: 41 additions & 38 deletions

File tree

Cargo.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ default = []
4040
#lightning-macros = { version = "0.2.0" }
4141
#lightning-dns-resolver = { version = "0.3.0" }
4242

43-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "044f3fab42e3085edecd40f0c9b369093edb7133", features = ["std"] }
44-
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "044f3fab42e3085edecd40f0c9b369093edb7133" }
45-
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "044f3fab42e3085edecd40f0c9b369093edb7133", features = ["std"] }
46-
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "044f3fab42e3085edecd40f0c9b369093edb7133" }
47-
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "044f3fab42e3085edecd40f0c9b369093edb7133", features = ["tokio"] }
48-
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "044f3fab42e3085edecd40f0c9b369093edb7133" }
49-
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "044f3fab42e3085edecd40f0c9b369093edb7133" }
50-
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "044f3fab42e3085edecd40f0c9b369093edb7133", features = ["rest-client", "rpc-client", "tokio"] }
51-
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "044f3fab42e3085edecd40f0c9b369093edb7133", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
52-
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "044f3fab42e3085edecd40f0c9b369093edb7133", features = ["std"] }
53-
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "044f3fab42e3085edecd40f0c9b369093edb7133" }
54-
lightning-dns-resolver = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "044f3fab42e3085edecd40f0c9b369093edb7133" }
43+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "369a2cf9c8ef810deea0cd2b4cf6ed0691b78144", features = ["std"] }
44+
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "369a2cf9c8ef810deea0cd2b4cf6ed0691b78144" }
45+
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "369a2cf9c8ef810deea0cd2b4cf6ed0691b78144", features = ["std"] }
46+
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "369a2cf9c8ef810deea0cd2b4cf6ed0691b78144" }
47+
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "369a2cf9c8ef810deea0cd2b4cf6ed0691b78144", features = ["tokio"] }
48+
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "369a2cf9c8ef810deea0cd2b4cf6ed0691b78144" }
49+
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "369a2cf9c8ef810deea0cd2b4cf6ed0691b78144" }
50+
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "369a2cf9c8ef810deea0cd2b4cf6ed0691b78144", features = ["rest-client", "rpc-client", "tokio"] }
51+
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "369a2cf9c8ef810deea0cd2b4cf6ed0691b78144", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
52+
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "369a2cf9c8ef810deea0cd2b4cf6ed0691b78144", features = ["std"] }
53+
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "369a2cf9c8ef810deea0cd2b4cf6ed0691b78144" }
54+
lightning-dns-resolver = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "369a2cf9c8ef810deea0cd2b4cf6ed0691b78144" }
5555

5656
bdk_chain = { version = "0.23.0", default-features = false, features = ["std"] }
5757
bdk_esplora = { version = "0.22.0", default-features = false, features = ["async-https-rustls", "tokio"]}
@@ -81,13 +81,13 @@ async-trait = { version = "0.1", default-features = false }
8181
vss-client = { package = "vss-client-ng", version = "0.5" }
8282
prost = { version = "0.11.6", default-features = false}
8383
#bitcoin-payment-instructions = { version = "0.6" }
84-
bitcoin-payment-instructions = { git = "https://github.com/jkczyz/bitcoin-payment-instructions", rev = "340c535a600f7c43bef4c9f910edac4085f2e70c" }
84+
bitcoin-payment-instructions = { git = "https://github.com/jkczyz/bitcoin-payment-instructions", rev = "679dac50cc0d81ec4d31da94b93d467e5308f16a" }
8585

8686
[target.'cfg(windows)'.dependencies]
8787
winapi = { version = "0.3", features = ["winbase"] }
8888

8989
[dev-dependencies]
90-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "044f3fab42e3085edecd40f0c9b369093edb7133", features = ["std", "_test_utils"] }
90+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "369a2cf9c8ef810deea0cd2b4cf6ed0691b78144", features = ["std", "_test_utils"] }
9191
rand = { version = "0.9.2", default-features = false, features = ["std", "thread_rng", "os_rng"] }
9292
proptest = "1.0.0"
9393
regex = "1.5.6"

src/builder.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,11 +1666,6 @@ fn build_with_store_internal(
16661666

16671667
// If we act as an LSPS2 service, we allow forwarding to unannounced channels.
16681668
user_config.accept_forwards_to_priv_channels = true;
1669-
1670-
// If we act as an LSPS2 service, set the HTLC-value-in-flight to 100% of the channel value
1671-
// to ensure we can forward the initial payment.
1672-
user_config.channel_handshake_config.max_inbound_htlc_value_in_flight_percent_of_channel =
1673-
100;
16741669
}
16751670

16761671
if let Some(role) = async_payments_role {

src/event.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ use lightning::ln::channelmanager::{PaymentId, TrustedChannelFeatures};
2626
use lightning::ln::types::ChannelId;
2727
use lightning::routing::gossip::NodeId;
2828
use lightning::sign::EntropySource;
29-
use lightning::util::config::{
30-
ChannelConfigOverrides, ChannelConfigUpdate, ChannelHandshakeConfigUpdate,
31-
};
29+
use lightning::util::config::{ChannelConfigOverrides, ChannelConfigUpdate};
3230
use lightning::util::errors::APIError;
3331
use lightning::util::persist::KVStore;
3432
use lightning::util::ser::{Readable, ReadableArgs, Writeable, Writer};
@@ -1273,20 +1271,24 @@ where
12731271
if lsp_node_id == counterparty_node_id {
12741272
// When we're an LSPS2 client, allow claiming underpaying HTLCs as the LSP will skim off some fee. We'll
12751273
// check that they don't take too much before claiming.
1276-
//
1277-
// We also set maximum allowed inbound HTLC value in flight
1278-
// to 100%. We should eventually be able to set this on a per-channel basis, but for
1279-
// now we just bump the default for all channels.
12801274
channel_override_config = Some(ChannelConfigOverrides {
1281-
handshake_overrides: Some(ChannelHandshakeConfigUpdate {
1282-
max_inbound_htlc_value_in_flight_percent_of_channel: Some(100),
1283-
..Default::default()
1284-
}),
12851275
update_overrides: Some(ChannelConfigUpdate {
12861276
accept_underpaying_htlcs: Some(true),
12871277
..Default::default()
12881278
}),
1279+
..Default::default()
12891280
});
1281+
1282+
// LSPS2 channels are unannounced; rely on LDK's default of 100%
1283+
// inbound HTLC value-in-flight so the LSP can forward the initial
1284+
// payment in full.
1285+
debug_assert_eq!(
1286+
self.channel_manager
1287+
.get_current_config()
1288+
.channel_handshake_config
1289+
.unannounced_channel_max_inbound_htlc_value_in_flight_percentage,
1290+
100
1291+
);
12901292
}
12911293
}
12921294
let res = if allow_0conf {

src/lib.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,13 +1197,16 @@ impl Node {
11971197
let mut user_config = default_user_config(&self.config);
11981198
user_config.channel_handshake_config.announce_for_forwarding = announce_for_forwarding;
11991199
user_config.channel_config = (channel_config.unwrap_or_default()).clone().into();
1200-
// We set the max inflight to 100% for private channels.
1201-
// FIXME: LDK will default to this behavior soon, too, at which point we should drop this
1202-
// manual override.
1200+
1201+
// Unannounced channels rely on LDK's default of 100% inbound HTLC value-in-flight
1202+
// to support large initial payments via LSPS2.
12031203
if !announce_for_forwarding {
1204-
user_config
1205-
.channel_handshake_config
1206-
.max_inbound_htlc_value_in_flight_percent_of_channel = 100;
1204+
debug_assert_eq!(
1205+
user_config
1206+
.channel_handshake_config
1207+
.unannounced_channel_max_inbound_htlc_value_in_flight_percentage,
1208+
100
1209+
);
12071210
}
12081211

12091212
let push_msat = push_to_counterparty_msat.unwrap_or(0);

src/liquidity.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,13 +781,16 @@ where
781781

782782
let mut config = self.channel_manager.get_current_config().clone();
783783

784-
// We set these LSP-specific values during Node building, here we're making sure it's actually set.
784+
// If we act as an LSPS2 service, the HTLC-value-in-flight must be 100% of the
785+
// channel value to ensure we can forward the initial payment. That cap only
786+
// applies to unannounced channels, so the channel must also be unannounced.
785787
debug_assert_eq!(
786788
config
787789
.channel_handshake_config
788-
.max_inbound_htlc_value_in_flight_percent_of_channel,
790+
.unannounced_channel_max_inbound_htlc_value_in_flight_percentage,
789791
100
790792
);
793+
debug_assert!(!config.channel_handshake_config.announce_for_forwarding);
791794
debug_assert!(config.accept_forwards_to_priv_channels);
792795

793796
// We set the forwarding fee to 0 for now as we're getting paid by the channel fee.

0 commit comments

Comments
 (0)