-
Notifications
You must be signed in to change notification settings - Fork 56
Update ldk-node dependency & expose bolt12 proofs #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
benthecarman
wants to merge
3
commits into
lightningdevkit:main
Choose a base branch
from
benthecarman:update-ldk-node
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,8 +113,8 @@ These RPCs support a manual claim/fail workflow for held payments. See | |
| | RPC | Description | | ||
| |------------------------|--------------------------------------------------------------------| | ||
| | `Bolt11ReceiveForHash` | Create an invoice for a given payment hash (manual claim required) | | ||
| | `Bolt11ClaimForHash` | Claim a held payment by providing the preimage | | ||
| | `Bolt11FailForHash` | Reject a held payment | | ||
| | `Bolt11ClaimForId` | Claim a held payment by its payment ID and preimage | | ||
| | `Bolt11FailForId` | Reject a held payment by its payment ID | | ||
|
|
||
| ### BOLT11 JIT Channels (LSPS2) | ||
|
|
||
|
|
@@ -128,12 +128,13 @@ when the invoice is paid. | |
|
|
||
| ### BOLT12 Offers and Refunds | ||
|
|
||
| | RPC | Description | | ||
| |-----------------------|-------------------------------------------------------------------------| | ||
| | `Bolt12Receive` | Create a BOLT12 offer (fixed or variable amount) | | ||
| | `Bolt12Send` | Pay a BOLT12 offer (with optional quantity, payer note, routing config) | | ||
| | `Bolt12SendRefund` | Create a BOLT12 refund that this node will pay | | ||
| | `Bolt12ReceiveRefund` | Request an incoming payment for a BOLT12 refund | | ||
| | RPC | Description | | ||
| |--------------------------|-------------------------------------------------------------------------| | ||
| | `Bolt12Receive` | Create a BOLT12 offer (fixed or variable amount) | | ||
| | `Bolt12Send` | Pay a BOLT12 offer (with optional quantity, payer note, routing config) | | ||
| | `Bolt12SendRefund` | Create a BOLT12 refund that this node will pay | | ||
| | `Bolt12ReceiveRefund` | Request an incoming payment for a BOLT12 refund | | ||
| | `Bolt12CreatePayerProof` | Create a BOLT 12 payer proof from a successful payment | | ||
|
|
||
| ### Spontaneous and Unified Send | ||
|
|
||
|
|
@@ -229,27 +230,45 @@ GET /metrics | |
| Returns Prometheus-format text. Requires `[metrics] enabled = true` in the config. Supports | ||
| optional Basic Auth. See [Configuration](configuration.md#metrics) for setup. | ||
|
|
||
| ## BOLT 12 Payer-Proof Lifecycle | ||
|
|
||
| Subscribe with `SubscribeEvents` before you send a BOLT 12 payment. Events are not replayed. | ||
|
|
||
| When `PaymentSuccessful` arrives, retain its `payment_id`, `payment_preimage`, and | ||
| `bolt12_invoice`. Pass these values to `Bolt12CreatePayerProof`. The request can also select the | ||
| optional invoice fields that the proof discloses. | ||
|
|
||
| The `bolt12_invoice` field is absent for static-invoice payments. These asynchronous payments | ||
| cannot produce payer proofs. | ||
|
|
||
| ## Hodl Invoice Lifecycle | ||
|
|
||
| Hodl invoices allow you to inspect and conditionally accept incoming payments: | ||
|
|
||
| 1. **Create the invoice:** Call `Bolt11ReceiveForHash` with a payment hash you control. | ||
| 2. **Wait for payment:** Subscribe to events via `SubscribeEvents` and watch for a | ||
| `PaymentClaimable` event matching your payment hash. | ||
| 3. **Decide:** | ||
| - **Accept:** Call `Bolt11ClaimForHash` with the preimage corresponding to the payment hash. | ||
| - **Reject:** Call `Bolt11FailForHash` with the payment hash. | ||
| 1. **Subscribe:** Call `SubscribeEvents` before you create or share the invoice. Events are not | ||
| replayed. | ||
| 2. **Create the invoice:** Generate a new payment hash. Call `Bolt11ReceiveForHash` with this hash. | ||
| Never reuse a payment hash. Reuse is unsafe and can cause loss of funds. | ||
| 3. **Handle each payment:** Save the payment ID from each `PaymentClaimable` event. A payer can pay | ||
| the same invoice more than once. Each payment has a separate event and payment ID. | ||
| 4. **Decide before `claim_deadline`:** | ||
| - **Accept an expected payment:** Call `Bolt11ClaimForId` with its payment ID and preimage. | ||
| - **Reject an unexpected payment:** Call `Bolt11FailForId` with its payment ID. Reject duplicate | ||
| and late payments instead of ignoring or claiming them. | ||
|
|
||
| The payment is held in a pending state until you explicitly claim or fail it. **You must | ||
| always call one of these.** If you do neither, the HTLC will eventually time out, which | ||
| can cause a force-closure of the channel. | ||
| always handle each event.** If you do not, the HTLC will eventually time out. This can cause a | ||
| force-closure of the channel. | ||
|
Comment on lines
259
to
+261
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Somewhat related to the above discussion, also landed on this update here: -The payment is held in a pending state until you explicitly claim or fail it. **You must
-always handle each event.** If you do not, the HTLC will eventually time out. This can cause a
-force-closure of the channel.
+The payment is held in a pending state until you claim it, fail it, or its `claim_deadline` is
+reached. `PaymentClaimable` notifications are best-effort and are not replayed. If you miss the
+event or do not act before the deadline, LDK Node automatically fails the HTLC backward and the
+payment can no longer be claimed. Keep the subscriber healthy and resolve reported persistence
+errors before accepting further payments. |
||
|
|
||
| ## Pagination | ||
|
|
||
| `ListPayments` and `ListForwardedPayments` support cursor-based pagination: | ||
|
|
||
| 1. Make the first request with your desired `number_of_payments` page size. | ||
| 1. Make the first request without a `page_token`. The server controls the page size. | ||
| 2. If the response includes a `next_page_token`, pass it as `page_token` in the next request. | ||
| 3. When `next_page_token` is absent, you have reached the end of the results. | ||
|
|
||
| Results are ordered by creation time (most recent first). | ||
| The page token is one opaque string. Do not parse or modify it. Results are ordered by creation | ||
| time (most recent first). | ||
|
|
||
| The CLI `--number-of-payments` option combines multiple pages. It does not set the gRPC page size. | ||
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.