Skip to content

Support hold invoices when receiving via JIT channels - #297

Merged
benthecarman merged 1 commit into
lightningdevkit:mainfrom
f3r10:jit-hold-invoices
Sep 29, 2026
Merged

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

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

@f3r10
f3r10 force-pushed the jit-hold-invoices branch 2 times, most recently from 6933896 to b22f567 Compare September 25, 2026 14:03

@benthecarman benthecarman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

needs rebase, otherwise looks good

Comment thread ldk-server-mcp/tests/integration.rs Outdated
#[test]
fn test_bolt11_receive_via_jit_channel_for_hash_unreachable() {
assert_unreachable_tool(
"bolt11_receive_variable_amount_via_jit_channel_for_hash",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

should be bolt11_receive_via_jit_channel_for_hash?

Wrap ldk-node receive_via_jit_channel_for_hash and
receive_variable_amount_via_jit_channel_for_hash as two new RPCs.
@benthecarman
benthecarman merged commit 08316de into lightningdevkit:main Sep 29, 2026
11 of 12 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.

Support hold invoices when receiving via JIT channels

3 participants