Skip to content

Track inbound payments by PaymentId#948

Open
tnull wants to merge 4 commits into
lightningdevkit:mainfrom
tnull:2026-06-payment-id-prefactors
Open

Track inbound payments by PaymentId#948
tnull wants to merge 4 commits into
lightningdevkit:mainfrom
tnull:2026-06-payment-id-prefactors

Conversation

@tnull

@tnull tnull commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Closes #298.

This finally switches our inbound payments over to be fully tracked by payment id, and decouples payment IDs from payment hashes.

@ldk-reviews-bot

ldk-reviews-bot commented Jun 24, 2026

Copy link
Copy Markdown

🎉 This PR is now ready for review!
Please choose at least one reviewer by assigning them on the right bar.
If no reviewers are assigned within 10 minutes, I'll automatically assign one.
Once the first reviewer has submitted a review, a second will be assigned if required.

@tnull tnull force-pushed the 2026-06-payment-id-prefactors branch from 51dba72 to ff3345d Compare June 24, 2026 15:21
@tnull tnull marked this pull request as draft June 24, 2026 15:22
@tnull tnull force-pushed the 2026-06-payment-id-prefactors branch from ff3345d to 544e100 Compare June 24, 2026 15:23
Comment thread src/payment/bolt11.rs
The switch to tracking payments by ID happened with LDK Node v0.3.0,
which is >1.5 years old by now. We can be pretty certain that nobody is
upgrading from an older version to the upcoming v0.8.

Here we hence make the `payment_id` fields in `Event` required which is
a nice API simplification that will also be utilized in the next commit.

Co-Authored-By: HAL 9000
@tnull tnull force-pushed the 2026-06-payment-id-prefactors branch from 544e100 to 4c3f2e4 Compare July 2, 2026 13:45
@tnull tnull marked this pull request as ready for review July 2, 2026 13:46
@ldk-reviews-bot ldk-reviews-bot requested a review from tankyleo July 2, 2026 13:47
@tnull tnull removed the request for review from tankyleo July 2, 2026 13:50
@tnull tnull marked this pull request as draft July 2, 2026 13:50
tnull added 3 commits July 2, 2026 16:00
Pending manual invoice records need persisted expiry times so stale
reservations can be pruned before checking for duplicate payment
hashes.

Pending BOLT11 reservations also need indexed lookup by payment
hash so duplicate checks can avoid scanning the full pending store.

Co-Authored-By: HAL 9000
Manual BOLT11 invoices need a pending entry before HTLC arrival.
That lets duplicate registrations be rejected without scanning
finalized payments.

Keep the legacy hash-derived payment ID in this step; the next
commit switches BOLT11 payments to randomized IDs.

Co-Authored-By: HAL 9000
Create inbound BOLT11 records from claimable and claimed events.
Stop pre-creating automatic BOLT11 records when invoices are
generated.

Generate outbound BOLT11 IDs from KeysManager entropy instead of
deriving them from the payment hash.

Co-Authored-By: HAL 9000
@tnull tnull force-pushed the 2026-06-payment-id-prefactors branch from 4c3f2e4 to 4a24ee7 Compare July 2, 2026 14:08
@tnull tnull requested a review from tankyleo July 2, 2026 14:09
@tnull tnull marked this pull request as ready for review July 2, 2026 14:09
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.

Track inbound payments by also unique payment IDs

2 participants