Skip to content

Commit 7a64a76

Browse files
committed
Bump max inflight HTLC value to 100% if we're an LSPS2 client
When we're an LSPS2 client, the LSP might open the channel to us with a capacity only barely more than the initial payment size. We therefore need to be able to receive close to 100% of the channel size in a single HTLC. Here we therefore bump the default max HTLC value inflight config to 100%. We should eventually be able to set this on a per-channel basis, but for now we just bump or default for all channels.
1 parent 04137e9 commit 7a64a76

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/builder.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,11 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
685685
},
686686
};
687687

688-
// Initialize the ChannelManager
688+
// Initialize the default config values.
689+
//
690+
// Note that methods such as Node::connect_open_channel might override some of the values set
691+
// here, e.g. the ChannelHandshakeConfig, meaning these default values will mostly be relevant
692+
// for inbound channels.
689693
let mut user_config = UserConfig::default();
690694
user_config.channel_handshake_limits.force_announced_channel_preference = false;
691695

@@ -695,11 +699,19 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
695699
user_config.manually_accept_inbound_channels = true;
696700
}
697701

698-
if liquidity_source_config.is_some() {
702+
if liquidity_source_config.and_then(|lsc| lsc.lsps2_service.as_ref()).is_some() {
699703
// Generally allow claiming underpaying HTLCs as the LSP will skim off some fee. We'll
700704
// check that they don't take too much before claiming.
701705
user_config.channel_config.accept_underpaying_htlcs = true;
706+
707+
// FIXME: When we're an LSPS2 client, set maximum allowed inbound HTLC value in flight
708+
// to 100%. We should eventually be able to set this on a per-channel basis, but for
709+
// now we just bump or default for all channels.
710+
user_config.channel_handshake_config.max_inbound_htlc_value_in_flight_percent_of_channel =
711+
100;
702712
}
713+
714+
// Initialize the ChannelManager
703715
let channel_manager = {
704716
if let Ok(res) = kv_store.read(
705717
CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE,

0 commit comments

Comments
 (0)