Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1429,6 +1429,17 @@ impl Node {
user_config.channel_handshake_config.announce_for_forwarding = announce_for_forwarding;
user_config.channel_config = (channel_config.unwrap_or_default()).clone().into();

// An LSPS2 service must be able to receive every part of an initial
// JIT payment before it can open the channel to the client. The
// announced-channel default (25%) can prevent that on an otherwise
// sufficiently funded inbound channel, locking the received HTLCs
// until expiry. Raise the inbound limit only when serving LSPS2.
if announce_for_forwarding && self.liquidity_source.lsps2_service().is_enabled() {
user_config
.channel_handshake_config
.announced_channel_max_inbound_htlc_value_in_flight_percentage = 100;
}

// Unannounced channels rely on LDK's default of 100% inbound HTLC value-in-flight
// to support large initial payments via LSPS2.
if !announce_for_forwarding {
Expand Down
5 changes: 5 additions & 0 deletions src/liquidity/service/lsps2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ impl<L: Deref> LSPS2ServiceLiquiditySource<L>
where
L::Target: LdkLogger,
{
/// Whether this node serves LSPS2 JIT payments.
pub(crate) fn is_enabled(&self) -> bool {
self.lsps2_service.is_some()
}

pub(crate) fn set_peer_manager(&self, peer_manager: Weak<PeerManager>) {
*self.peer_manager.write().expect("lock") = Some(peer_manager);
}
Expand Down
Loading