Skip to content

Allow setting a ChannelConfig for LSPS2 JIT channels#985

Open
IgnacioPorte wants to merge 1 commit into
lightningdevkit:mainfrom
IgnacioPorte:2026-07-lsps2-jit-channel-config
Open

Allow setting a ChannelConfig for LSPS2 JIT channels#985
IgnacioPorte wants to merge 1 commit into
lightningdevkit:mainfrom
IgnacioPorte:2026-07-lsps2-jit-channel-config

Conversation

@IgnacioPorte

Copy link
Copy Markdown

Hey this PR closes #961.

Context

When acting as an LSPS2 service, the LSP always reuse the node-wide configuration
for the JIT channels it opens towards clients, hard coding their forwarding fees
to zero. An LSP may however want different parameters on client channels than
on its public channels, e.g., different forwarding fees or a different
cltv_expiry_delta.

Changes

Adds an optional channel_config field to LSPS2ServiceConfig:

  • If set, the given ChannelConfig is applied as-is to newly-opened JIT
    channels. In particular, configured forwarding fees are charged in addition
    to the channel opening fee.
  • If unset (None), behavior is unchanged: we reuse the node-wide config but
    override the forwarding fees to zero, as we're already compensated via the
    channel opening fee.

Compatibility

This is a breaking change, existing LSPS2ServiceConfig initializers need to
provide the new field. I assumed this is acceptable based on the struct's
history.

Testing

Extended lsps2_client_service_integration to pass a custom config and assert
the opened JIT channel carries it.


This PR was developed with the assistance of AI tooling (Claude Code).

When acting as an LSPS2 service, we'd previously always reuse the
node-wide configuration for the JIT channels we open towards clients,
while hard-coding their forwarding fees to zero.

Here, we add an optional channel_config field to LSPS2ServiceConfig
that allows configuring the JIT channels separately from regular
channels. If unset, we retain the previous behavior, i.e., zero
forwarding fees, as we're compensated via the channel opening fee.

This resolves the TODO to revisit the hard-coded zero-fee decision.

This change was developed with the assistance of AI tooling (Claude Code).
@ldk-reviews-bot

ldk-reviews-bot commented Jul 14, 2026

Copy link
Copy Markdown

I've assigned @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@ldk-reviews-bot ldk-reviews-bot requested a review from tnull July 14, 2026 22:35

@tnull tnull left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this. While I think it makes sense to let the LSP configure certain values, ChannelConfig also has a few fields that don't make sense / we don't want to override (notably forwarding fees, but also stuff like accept_underpaying_htlcs). So it's not the right type for this API. If anything we need to create an LSP-specific channel config variant.

/// If set, the given config is used without modification. Note that this means any
/// forwarding fees configured here are charged in addition to the channel opening fee.
///
/// If set to `None`, we'll reuse the node-wide config, but override the forwarding fees

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's odd to reuse the object, but then honor only a few fields of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow configuring channel parameters based on whether the channel is an LSP client channel

3 participants