Skip to content

Commit 2de2b63

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 939051a commit 2de2b63

File tree

5 files changed

+18
-39
lines changed

5 files changed

+18
-39
lines changed

Cargo.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ default = []
3939
#lightning-liquidity = { version = "0.2.0", features = ["std"] }
4040
#lightning-macros = { version = "0.2.0" }
4141

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

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

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

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

src/builder.rs

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

16491649
// If we act as an LSPS2 service, we allow forwarding to unannounced channels.
16501650
user_config.accept_forwards_to_priv_channels = true;
1651-
1652-
// If we act as an LSPS2 service, set the HTLC-value-in-flight to 100% of the channel value
1653-
// to ensure we can forward the initial payment.
1654-
user_config.channel_handshake_config.max_inbound_htlc_value_in_flight_percent_of_channel =
1655-
100;
16561651
}
16571652

16581653
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
@@ -1203,14 +1203,6 @@ impl Node {
12031203
let mut user_config = default_user_config(&self.config);
12041204
user_config.channel_handshake_config.announce_for_forwarding = announce_for_forwarding;
12051205
user_config.channel_config = (channel_config.unwrap_or_default()).clone().into();
1206-
// We set the max inflight to 100% for private channels.
1207-
// FIXME: LDK will default to this behavior soon, too, at which point we should drop this
1208-
// manual override.
1209-
if !announce_for_forwarding {
1210-
user_config
1211-
.channel_handshake_config
1212-
.max_inbound_htlc_value_in_flight_percent_of_channel = 100;
1213-
}
12141206

12151207
let push_msat = push_to_counterparty_msat.unwrap_or(0);
12161208
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
@@ -777,11 +777,12 @@ where
777777

778778
let mut config = self.channel_manager.get_current_config().clone();
779779

780-
// We set these LSP-specific values during Node building, here we're making sure it's actually set.
780+
// If we act as an LSPS2 service, the HTLC-value-in-flight must be 100% of the
781+
// channel value to ensure we can forward the initial payment.
781782
debug_assert_eq!(
782783
config
783784
.channel_handshake_config
784-
.max_inbound_htlc_value_in_flight_percent_of_channel,
785+
.unannounced_channel_max_inbound_htlc_value_in_flight_percentage,
785786
100
786787
);
787788
debug_assert!(config.accept_forwards_to_priv_channels);

0 commit comments

Comments
 (0)