Skip to content

lsps-plugin: add cln-lsps-policy plugin for LSPS2 fee policy management#9349

Open
Andezion wants to merge 1 commit into
ElementsProject:masterfrom
Andezion:lsps-policy-rpc-master
Open

lsps-plugin: add cln-lsps-policy plugin for LSPS2 fee policy management#9349
Andezion wants to merge 1 commit into
ElementsProject:masterfrom
Andezion:lsps-policy-rpc-master

Conversation

@Andezion

Copy link
Copy Markdown
Collaborator

Summary

cln-lsps-service calls out to two internal RPC methods to make LSPS2 policy
decisions - lsps2-policy-getpolicy and lsps2-policy-getchannelcapacity -
but no plugin in the repo registers them, so the service can't run standalone

This adds a new cln-lsps-policy binary that implements both:

  • lsps2-policy-getpolicy - returns the LSP's fee parameter menu
    (Lsps2PolicyGetInfoResponse), built from configurable CLN options.
  • lsps2-policy-getchannelcapacity - returns the channel capacity to open
    for a given JIT-channel buy request (Lsps2PolicyGetChannelCapacityResponse)

All policy knods are exposed as plugin options with sensible defaults, so an
LSP operator can tune fees/limits without touching code:

Option Default
lsps2-policy-min-fee-msat 1000
lsps2-policy-proportional-ppm 0
lsps2-policy-valid-until-hours 1
lsps2-policy-min-lifetime 144
lsps2-policy-max-client-to-self-delay 2016
lsps2-policy-min-payment-size-msat 1000
lsps2-policy-max-payment-size-msat 10_000_000_000
lsps2-policy-channel-capacity-msat 10_000_000_000

Values are validated at startup (non-negative, max > min, ppm in
[0, 1_000_000]) so misconfiguration fails fast instead of silently
producing bad fee params

Test plan

  • cargo build - all three binaries (cln-lsps-client,
    cln-lsps-service, cln-lsps-policy) compile cleanly
  • cargo test - 84 passed, 0 failed (no regressions in existing
    lsps-plugin test suite)
  • Manual end-to-end test: run cln-lsps-service + cln-lsps-policy
    together against a client and confirm lsps2.get_info /
    lsps2.buy succeed

Important

26.06 FREEZE April 30th: Non-bugfix PRs not ready by this date will wait for 26.09.

RC1 is scheduled on May 14th

The final release is scheduled for June 1st.

Checklist

Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked:

  • The changelog has been updated in the relevant commit(s) according to the guidelines.
  • Tests have been added or modified to reflect the changes.
  • Documentation has been reviewed and updated as needed.
  • Related issues have been listed and linked, including any that this PR closes.
  • Important All PRs must consider how to reverse any persistent changes for tools/lightning-downgrade

Changelog-None

@Andezion
Andezion requested a review from nepet July 23, 2026 21:41
@Andezion Andezion self-assigned this Jul 23, 2026
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.

1 participant