Skip to content

Accept LSPS2 JIT channels before LSP discovery - #1263

Merged
tankyleo merged 1 commit into
lightningdevkit:mainfrom
tnull:2026-11-lsps2-underpay-before-discovery
Dec 4, 2026
Merged

tankyleo merged 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

@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
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

@tnull

tnull commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator Author

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

Added a fixup.

@tnull
tnull requested a review from tankyleo December 4, 2026 15:48
@tnull
tnull force-pushed the 2026-11-lsps2-underpay-before-discovery branch from 4f96de5 to 4611892 Compare December 4, 2026 15:48

@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.

LGTM good to squash

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 we never set the override on an accepted channel
ourselves, the invoice could not be paid unless the user set it via
`Node::update_channel_config`.

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 force-pushed the 2026-11-lsps2-underpay-before-discovery branch from 4611892 to 8950a27 Compare December 4, 2026 16:32
@tnull

tnull commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator Author

LGTM good to squash

Squashed without further changes.

@tankyleo
tankyleo merged commit 6e2c21e into lightningdevkit:main Dec 4, 2026
11 of 27 checks passed
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