Add cancel_invoice to Bolt11Payment#846
Open
benthecarman wants to merge 1 commit intolightningdevkit:mainfrom
Open
Add cancel_invoice to Bolt11Payment#846benthecarman wants to merge 1 commit intolightningdevkit:mainfrom
benthecarman wants to merge 1 commit intolightningdevkit:mainfrom
Conversation
|
I've assigned @tnull as a reviewer! |
211f84b to
f04c76a
Compare
Allow canceling a previously created BOLT11 invoice by payment hash. Enterprise integrators need this when they short-circuit an invoice with an internal database transfer or when an alternative payment method is used (e.g., on-chain payment via unified URI). cancel_invoice validates the payment is inbound and unclaimed, then delegates to fail_for_hash for the shared logic of marking the payment as failed and failing back any pending HTLCs. The PaymentClaimable event handler rejects HTLCs for cancelled invoices only when the preimage is known (auto-claim payments), preserving retry behavior for manual-claim (_for_hash) payments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
f04c76a to
6a9e155
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow cancelling a previously created BOLT11 invoice by payment hash. Enterprise integrators need this when they short-circuit an invoice with an internal database transfer or when an alternative payment method is used (e.g., on-chain payment via unified URI).
The
PaymentClaimableevent handler rejects HTLCs for cancelled invoices only when the preimage is known (auto-claim payments), preserving retry behavior for manual-claim (_for_hash) payments.fail_for_hashalready did the logic we needed socancel_invoicejust does a little bit extra pre-validation and then calls it. Could make the argument to just usefail_for_hash, update its docs, and the if statement to reject payments mark as failed in thePaymentClaimable. The only functionality change would be that if someone retries to do a payment after afail_for_hash, we don't let the user evaluate again.