Track inbound payments by PaymentId#948
Draft
tnull wants to merge 3 commits into
Draft
Conversation
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
|
👋 Hi! This PR is now in draft status. |
51dba72 to
ff3345d
Compare
Create inbound BOLT11 records from claimable and claimed events. Stop pre-creating those records when invoices are generated. Generate outbound BOLT11 IDs from KeysManager entropy. Do not derive them from the payment hash. Duplicate invoice detection is restored in the next commit. Co-Authored-By: HAL 9000
Manual BOLT11 invoices need a pending entry before HTLC arrival. That lets duplicate registrations be rejected while keeping randomized payment IDs. Store the pending entries with their invoice expiry and resolve BOLT11 claimable events by scanning those entries. Co-Authored-By: HAL 9000
ff3345d to
544e100
Compare
tnull
commented
Jun 24, 2026
|
|
||
| let payment_hash = invoice.payment_hash(); | ||
| let payment_id = PaymentId(invoice.payment_hash().0); | ||
| if let Some(payment) = self.payment_store.get(&payment_id) { |
Collaborator
Author
There was a problem hiding this comment.
Dropped this for now, bit on the fence on whether it's worth maintaining a secondary index for this is worth it.
Collaborator
Author
There was a problem hiding this comment.
(Although will probably be necessary for the next commit, too)
This was referenced Jun 25, 2026
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.
Closes #298.
This finally switches our inbound payments over to be fully tracked by payment id, and decouples payment IDs from payment hashes.