-
Notifications
You must be signed in to change notification settings - Fork 418
Remove invoice_id
from static invoice server protocol
#4009
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
valentinewallace
wants to merge
7
commits into
lightningdevkit:main
Choose a base branch
from
valentinewallace:2025-08-simplify-static-inv-server
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.
+158
−162
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f0551f7
Follow-ups from removing async_payments cfg flag
valentinewallace 93644d2
Include invoice_slot in OfferPathsRequest message
valentinewallace 14b6ff6
Cache pending offer in specific invoice slot
valentinewallace dbe3514
Track invoice_slot in ServeStaticInvoice context
valentinewallace 2abd889
Remove now-unused ServeStaticInv::inv_slot from OM
valentinewallace 59b9163
Replace StaticInvoiceReq::invoice_id with ::inv_slot
valentinewallace d3c9a03
Remove now-unused ServeStaticInvoice::invoice_id
valentinewallace 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
There are no files selected for viewing
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 |
---|---|---|
|
@@ -353,7 +353,7 @@ pub enum OffersContext { | |
StaticInvoiceRequested { | ||
/// An identifier for the async recipient for whom we as a static invoice server are serving | ||
/// [`StaticInvoice`]s. Used paired with the | ||
/// [`OffersContext::StaticInvoiceRequested::invoice_id`] when looking up a corresponding | ||
/// [`OffersContext::StaticInvoiceRequested::invoice_slot`] when looking up a corresponding | ||
/// [`StaticInvoice`] to return to the payer if the recipient is offline. This id was previously | ||
/// provided via [`AsyncPaymentsContext::ServeStaticInvoice::recipient_id`]. | ||
/// | ||
|
@@ -364,15 +364,15 @@ pub enum OffersContext { | |
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest | ||
recipient_id: Vec<u8>, | ||
|
||
/// A random unique identifier for a specific [`StaticInvoice`] that the recipient previously | ||
/// The slot number for a specific [`StaticInvoice`] that the recipient previously | ||
/// requested be served on their behalf. Useful when paired with the | ||
/// [`OffersContext::StaticInvoiceRequested::recipient_id`] to pull that specific invoice from | ||
/// the database when payers send an [`InvoiceRequest`]. This id was previously | ||
/// provided via [`AsyncPaymentsContext::ServeStaticInvoice::invoice_id`]. | ||
/// provided via [`AsyncPaymentsContext::ServeStaticInvoice::invoice_slot`]. | ||
/// | ||
/// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice | ||
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest | ||
invoice_id: u128, | ||
invoice_slot: u16, | ||
|
||
/// The time as duration since the Unix epoch at which this path expires and messages sent over | ||
/// it should be ignored. | ||
|
@@ -448,6 +448,14 @@ pub enum AsyncPaymentsContext { | |
/// [`OfferPathsRequest`]: crate::onion_message::async_payments::OfferPathsRequest | ||
/// [`OfferPaths`]: crate::onion_message::async_payments::OfferPaths | ||
OfferPaths { | ||
/// The "slot" in the static invoice server's database that the invoice corresponding to these | ||
/// offer paths should go into, originally set by us in [`OfferPathsRequest::invoice_slot`]. This | ||
/// value allows us as the recipient to replace a specific invoice that is stored by the server, | ||
/// which is useful for limiting the number of invoices stored by the server while also keeping | ||
/// all the invoices persisted with the server fresh. | ||
/// | ||
/// [`OfferPathsRequest::invoice_slot`]: crate::onion_message::async_payments::OfferPathsRequest::invoice_slot | ||
invoice_slot: u16, | ||
/// The time as duration since the Unix epoch at which this path expires and messages sent over | ||
/// it should be ignored. | ||
/// | ||
|
@@ -466,7 +474,7 @@ pub enum AsyncPaymentsContext { | |
/// An identifier for the async recipient that is requesting that a [`StaticInvoice`] be served | ||
/// on their behalf. | ||
/// | ||
/// Useful when surfaced alongside the below `invoice_id` when payers send an | ||
/// Useful when surfaced alongside the below `invoice_slot` when payers send an | ||
/// [`InvoiceRequest`], to pull the specific static invoice from the database. | ||
/// | ||
/// Also useful to rate limit the invoices being persisted on behalf of a particular recipient. | ||
|
@@ -477,15 +485,15 @@ pub enum AsyncPaymentsContext { | |
/// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice | ||
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest | ||
recipient_id: Vec<u8>, | ||
/// A random identifier for the specific [`StaticInvoice`] that the recipient is requesting be | ||
/// The slot number for the specific [`StaticInvoice`] that the recipient is requesting be | ||
/// served on their behalf. Useful when surfaced alongside the above `recipient_id` when payers | ||
/// send an [`InvoiceRequest`], to pull the specific static invoice from the database. This id | ||
/// will be provided back to us as the static invoice server via | ||
/// [`OffersContext::StaticInvoiceRequested::invoice_id`]. | ||
/// [`OffersContext::StaticInvoiceRequested::invoice_slot`]. | ||
/// | ||
/// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice | ||
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest | ||
invoice_id: u128, | ||
invoice_slot: u16, | ||
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. For reviewability, it would be nice to remove |
||
/// The time as duration since the Unix epoch at which this path expires and messages sent over | ||
/// it should be ignored. | ||
/// | ||
|
@@ -559,7 +567,7 @@ impl_writeable_tlv_based_enum!(OffersContext, | |
}, | ||
(3, StaticInvoiceRequested) => { | ||
(0, recipient_id, required), | ||
(2, invoice_id, required), | ||
(2, invoice_slot, required), | ||
(4, path_absolute_expiry, required), | ||
}, | ||
); | ||
|
@@ -573,6 +581,7 @@ impl_writeable_tlv_based_enum!(AsyncPaymentsContext, | |
}, | ||
(2, OfferPaths) => { | ||
(0, path_absolute_expiry, required), | ||
(2, invoice_slot, required), | ||
}, | ||
(3, StaticInvoicePersisted) => { | ||
(0, offer_id, required), | ||
|
@@ -584,7 +593,7 @@ impl_writeable_tlv_based_enum!(AsyncPaymentsContext, | |
}, | ||
(5, ServeStaticInvoice) => { | ||
(0, recipient_id, required), | ||
(2, invoice_id, required), | ||
(2, invoice_slot, required), | ||
(4, path_absolute_expiry, required), | ||
}, | ||
); | ||
|
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
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for putting it in here is to avoid local state?