Skip to content

Accept LSPS2 JIT channels before LSP discovery - #1263

Open
tnull wants to merge 1 commit into
lightningdevkit:mainfrom
tnull:2026-11-lsps2-underpay-before-discovery
Open

tnull wants to merge 1 commit into
lightningdevkit:mainfrom
tnull:2026-11-lsps2-underpay-before-discovery

Conversation

@tnull

@tnull tnull commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

We only allowed underpaying HTLCs on an inbound channel if protocol discovery had found the counterparty to support LSPS2. Discovery results are kept in memory, so after a restart during which the LSP could not be reached, a JIT channel opened for an earlier invoice was accepted without the override. The fee-skimmed payment was then rejected, and as the override cannot be set later, the invoice could never be paid.

We now set the override for any configured LSP, as we already do when deciding whether to trust it for 0conf. The skimmed fee is still checked against the limit from the payment metadata before claiming.

Co-Authored-By: HAL 9000

We only allowed underpaying HTLCs on an inbound channel if protocol
discovery had found the counterparty to support LSPS2. Discovery
results are kept in memory, so after a restart during which the LSP
could not be reached, a JIT channel opened for an earlier invoice was
accepted without the override. The fee-skimmed payment was then
rejected, and as the override cannot be set later, the invoice could
never be paid.

We now set the override for any configured LSP, as we already do when
deciding whether to trust it for 0conf. The skimmed fee is still
checked against the limit from the payment metadata before claiming.

Co-Authored-By: HAL 9000
@tnull tnull added this to the 0.8 milestone Nov 25, 2026
@tnull
tnull requested a review from tankyleo November 25, 2026 13:23
@ldk-reviews-bot

ldk-reviews-bot commented Nov 25, 2026 •

Copy link
Copy Markdown

👋 Thanks for assigning @tankyleo 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.

}

#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn lsps2_client_receives_jit_payment_before_discovering_lsp() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This test relies on a fixed 6s sleep and on the payment reaching the client before the second discovery retry (about 15s after start). On a slow runner, the retry could succeed first and the test would pass without exercising this change. Could you confirm it fails on the parent commit, or make it deterministic, e.g. assert the LSP is still undiscovered when the channel is accepted?

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.

3 participants