Skip to content

Release LSPS2 intercepted HTLCs on open failure#4677

Merged
wpaulino merged 1 commit into
lightningdevkit:mainfrom
tnull:2026-06-10-lsps2-channel-open-failed
Jun 10, 2026
Merged

Release LSPS2 intercepted HTLCs on open failure#4677
wpaulino merged 1 commit into
lightningdevkit:mainfrom
tnull:2026-06-10-lsps2-channel-open-failed

Conversation

@tnull

@tnull tnull commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

When a JIT channel open fails, release queued intercepted HTLCs through the intercept API so they are not held until expiry. Keep resetting the LSPS2 state if an intercept has already been released.

Co-Authored-By: HAL 9000

This finding was discovered by Project Loupe

When a JIT channel open fails, release queued intercepted HTLCs through the intercept API so they are not held until expiry. Keep resetting the LSPS2 state if an intercept has already been released.

Co-Authored-By: HAL 9000

This finding was discovered by Project Loupe
@ldk-reviews-bot

ldk-reviews-bot commented Jun 10, 2026

Copy link
Copy Markdown

I've assigned @wpaulino 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-claude-review-bot

Copy link
Copy Markdown
Collaborator

No issues found.

The change correctly fixes a real bug: fail_htlc_backwards_with_reason(payment_hash, ...) operates on claimable payments and is a no-op for intercepted HTLCs (which live in pending_intercepted_htlcs), so previously the queued HTLCs were never released and stayed held until expiry. Replacing it with fail_intercepted_htlc(htlc.intercept_id) is the correct API and is consistent with the existing pattern at service.rs:1050.

Verified:

  • InterceptedHTLC.intercept_id exists and is the right identifier.
  • Swallowing the result with let _ = is intentional and safe — in PendingChannelOpen state the only expected error is "not found" (already released), matching the PR description.
  • The removed FailureCode import has no remaining uses in the file.
  • No new lock-ordering/deadlock risk (peer_state → channel_manager ordering unchanged from the old code).
  • The new test genuinely registers an intercept via the real payment flow and asserts it is released after channel_open_failed.

@ldk-reviews-bot ldk-reviews-bot requested a review from wpaulino June 10, 2026 14:43
@ldk-reviews-bot

Copy link
Copy Markdown

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

@wpaulino wpaulino merged commit dd32fe7 into lightningdevkit:main Jun 10, 2026
1 check passed
@tnull tnull self-assigned this Jun 11, 2026
@tnull tnull moved this from Done to Goal: Merge in Weekly Goals Jun 11, 2026
@TheBlueMatt

Copy link
Copy Markdown
Collaborator

Backported in #4683.

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

Projects

Status: Goal: Merge

Development

Successfully merging this pull request may close these issues.

5 participants