Skip to content

Add receive_for_hash_with_min_final_cltv_expiry_delta - #1137

Open
joschisan wants to merge 1 commit into
lightningdevkit:mainfrom
joschisan:receive-for-hash-min-final-cltv
Open

joschisan wants to merge 1 commit into
lightningdevkit:mainfrom
joschisan:receive-for-hash-min-final-cltv

Conversation

@joschisan

Copy link
Copy Markdown

receive_for_hash always requests LDK's minimum final CLTV expiry delta. A node that registers an invoice for a hash and only obtains the preimage from elsewhere, for example a gateway that has to complete a payment on another system before it can claim, has no way to ask the payer for more time before the HTLC is failed back.

This adds Bolt11Payment::receive_for_hash_with_min_final_cltv_expiry_delta, which passes the delta through to Bolt11InvoiceParameters::min_final_cltv_expiry_delta. As documented there, the delta must be at least MIN_FINAL_CLTV_EXPIRY_DELTA, and the invoice requests three blocks more to allow for blocks confirmed while the payment is routed. All other receive methods pass None and behave as before.

The channel full-cycle test covers it: it receives a payment with a raised delta, checks the invoice's min_final_cltv_expiry_delta, and claims it manually.

I am using this in prod already for a custom fedimint gateway.

receive_for_hash always requested LDK's minimum final CLTV expiry delta,
leaving a user that has to obtain the preimage from elsewhere no way to
ask the payer for more time before the HTLC is failed back.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@ldk-reviews-bot

ldk-reviews-bot commented Oct 8, 2026 •

Copy link
Copy Markdown

I've assigned @tnull 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-reviews-bot
ldk-reviews-bot requested a review from tnull October 8, 2026 14:55
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.

2 participants