Skip to content

Commit e09fd86

Browse files
committed
Drop max_inbound_htlc_value_in_flight_percent_of_channel
The max_inbound_htlc_value_in_flight_percent_of_channel config setting was used when acting as an LSPS2 service in order to forward the initial payment. However, upstream divided the config setting into two for announced and unannounced channels, the latter defaulting to 100%.
1 parent 1f99308 commit e09fd86

5 files changed

Lines changed: 19 additions & 40 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
@@ -1657,11 +1657,6 @@ fn build_with_store_internal(
16571657

16581658
// If we act as an LSPS2 service, we allow forwarding to unannounced channels.
16591659
user_config.accept_forwards_to_priv_channels = true;
1660-
1661-
// If we act as an LSPS2 service, set the HTLC-value-in-flight to 100% of the channel value
1662-
// to ensure we can forward the initial payment.
1663-
user_config.channel_handshake_config.max_inbound_htlc_value_in_flight_percent_of_channel =
1664-
100;
16651660
}
16661661

16671662
if let Some(role) = async_payments_role {

src/event.rs

Lines changed: 2 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,19 +1271,12 @@ 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
});
12901281
}
12911282
}

src/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,14 +1195,6 @@ impl Node {
11951195
let mut user_config = default_user_config(&self.config);
11961196
user_config.channel_handshake_config.announce_for_forwarding = announce_for_forwarding;
11971197
user_config.channel_config = (channel_config.unwrap_or_default()).clone().into();
1198-
// We set the max inflight to 100% for private channels.
1199-
// FIXME: LDK will default to this behavior soon, too, at which point we should drop this
1200-
// manual override.
1201-
if !announce_for_forwarding {
1202-
user_config
1203-
.channel_handshake_config
1204-
.max_inbound_htlc_value_in_flight_percent_of_channel = 100;
1205-
}
12061198

12071199
let push_msat = push_to_counterparty_msat.unwrap_or(0);
12081200
let user_channel_id: u128 = u128::from_ne_bytes(

src/liquidity.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,11 +781,12 @@ 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.
785786
debug_assert_eq!(
786787
config
787788
.channel_handshake_config
788-
.max_inbound_htlc_value_in_flight_percent_of_channel,
789+
.unannounced_channel_max_inbound_htlc_value_in_flight_percentage,
789790
100
790791
);
791792
debug_assert!(config.accept_forwards_to_priv_channels);

0 commit comments

Comments
 (0)