Skip to content

Support hold invoices when receiving via JIT channels - #297

Open
f3r10 wants to merge 1 commit into
lightningdevkit:mainfrom
f3r10:jit-hold-invoices
Open

f3r10 wants to merge 1 commit into
lightningdevkit:mainfrom
f3r10:jit-hold-invoices

Conversation

@f3r10

@f3r10 f3r10 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #286.

We already had hold invoices (Bolt11ReceiveForHash + claim/fail) and JIT receive (Bolt11ReceiveViaJitChannel / Bolt11ReceiveVariableAmountViaJitChannel), but not both at once. A node with no inbound channel couldn't create a JIT invoice for a known payment hash and decide later whether to claim.

This adds two RPCs that wrap the existing ldk-node methods (already on the pinned rev, no dependency bump):

  • Bolt11ReceiveViaJitChannelForHash
  • Bolt11ReceiveVariableAmountViaJitChannelForHash

They're separate RPCs, same split as Bolt11Receive / Bolt11ReceiveForHash, rather than an optional payment_hash on the existing JIT requests. The two JIT modes take different fee-limit fields, so one combined message would make illegal combinations representable.

Requests match the existing JIT ones plus payment_hash. Responses are just invoice. The payment is not auto-claimed; use Bolt11ClaimForId / Bolt11FailForId as with other hold invoices. manually_handle_unknown_bolt11_payments was already set.

Also wired through the client, CLI, and MCP, and updated the hodl / JIT docs. PaymentClaimable comments now name all three hold-invoice RPCs.

E2E: an ldk-server node with no channels, configured with the LSP as a liquidity source, creates a JIT hold invoice, gets paid through the LSP, then claims or fails. The existing JIT e2e used a raw ldk-node as the client; these tests use ldk-server in that role via a TestConfigBuilder lsps_client knob.

@ldk-reviews-bot

ldk-reviews-bot commented Sep 24, 2026 •

Copy link
Copy Markdown

I've assigned @benthecarman 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.

Wrap ldk-node receive_via_jit_channel_for_hash and
receive_variable_amount_via_jit_channel_for_hash as two new RPCs.
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.

Support hold invoices when receiving via JIT channels

2 participants