Skip to content

Accept LSPS2 JIT channels before LSP discovery - #1263

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

tnull wants to merge 3 commits 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.

Comment thread tests/integration_tests_rust.rs Resolved
Comment thread src/event.rs Resolved
tnull added 2 commits December 2, 2026 10:48
The test only relied on timing to have the payment reach the client
before a discovery retry succeeded. Had the retry won on a slow
runner, the test would have passed without exercising the fix.

We now check, right after the client accepted the channel, that it
still doesn't know of any LSP supporting LSPS2, so such a run fails
rather than passing vacuously.

Co-Authored-By: HAL 9000
The comment claimed the override cannot be set once the channel is
accepted. However, users can still enable it for an existing channel
via `Node::update_channel_config`, we just never do so ourselves.

We reword the comment accordingly. When squashing, the base commit
message needs the same correction: replace "as the override cannot
be set later" with "as we never set the override on an accepted
channel ourselves".

Co-Authored-By: HAL 9000
@tnull
tnull requested a review from tankyleo December 2, 2026 14:14

@f3r10 f3r10 left a comment

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.

Tested ACK 4f96de5. Good catch about this one

@tankyleo tankyleo left a comment

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.

Feel free to squash, we should also remove the items below to get RUSTFLAGS="-D warnings" cargo build to pass:

LiquiditySource::discovery_done_rx
LiquiditySource::get_lsp_config

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.

5 participants