-
Notifications
You must be signed in to change notification settings - Fork 421
Always-online node forward invoice request #4049
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ pub mod bump_transaction; | |
|
|
||
| pub use bump_transaction::BumpTransactionEvent; | ||
|
|
||
| use crate::blinded_path::message::OffersContext; | ||
| use crate::blinded_path::message::{BlindedMessagePath, OffersContext}; | ||
| use crate::blinded_path::payment::{ | ||
| Bolt12OfferContext, Bolt12RefundContext, PaymentContext, PaymentContextRef, | ||
| }; | ||
|
|
@@ -28,6 +28,7 @@ use crate::ln::channelmanager::{InterceptId, PaymentId, RecipientOnionFields}; | |
| use crate::ln::types::ChannelId; | ||
| use crate::ln::{msgs, LocalHTLCFailureReason}; | ||
| use crate::offers::invoice::Bolt12Invoice; | ||
| use crate::offers::invoice_request::InvoiceRequest; | ||
| use crate::offers::static_invoice::StaticInvoice; | ||
| use crate::onion_message::messenger::Responder; | ||
| use crate::routing::gossip::NetworkUpdate; | ||
|
|
@@ -1654,6 +1655,13 @@ pub enum Event { | |
| /// The invoice that should be persisted and later provided to payers when handling a future | ||
| /// [`Event::StaticInvoiceRequested`]. | ||
| invoice: StaticInvoice, | ||
| /// The path to where invoice requests will be forwarded. If we receive an invoice | ||
| /// request, we'll forward it to the async recipient over this path in case the | ||
| /// recipient is online to provide a new invoice. This path should be persisted and | ||
| /// later provided to [`ChannelManager::respond_to_static_invoice_request`]. | ||
| /// | ||
| /// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request | ||
| invoice_request_path: BlindedMessagePath, | ||
| /// Useful for the recipient to replace a specific invoice stored by us as the static invoice | ||
| /// server. | ||
| /// | ||
|
|
@@ -1686,12 +1694,14 @@ pub enum Event { | |
| /// | ||
| /// If we previously persisted a [`StaticInvoice`] from an [`Event::PersistStaticInvoice`] that | ||
| /// matches the below `recipient_id` and `invoice_slot`, that invoice should be retrieved now | ||
| /// and forwarded to the payer via [`ChannelManager::send_static_invoice`]. | ||
| /// and forwarded to the payer via [`ChannelManager::respond_to_static_invoice_request`]. | ||
| /// The invoice request path previously persisted from [`Event::PersistStaticInvoice`] should | ||
| /// also be provided in [`ChannelManager::respond_to_static_invoice_request`]. | ||
| /// | ||
| /// [`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient | ||
| /// [`ChannelManager::set_paths_to_static_invoice_server`]: crate::ln::channelmanager::ChannelManager::set_paths_to_static_invoice_server | ||
| /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest | ||
| /// [`ChannelManager::send_static_invoice`]: crate::ln::channelmanager::ChannelManager::send_static_invoice | ||
| /// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request | ||
| StaticInvoiceRequested { | ||
| /// An identifier for the recipient previously surfaced in | ||
| /// [`Event::PersistStaticInvoice::recipient_id`]. Useful when paired with the `invoice_slot` to | ||
|
|
@@ -1702,10 +1712,16 @@ pub enum Event { | |
| /// retrieve the [`StaticInvoice`] requested by the payer. | ||
| invoice_slot: u16, | ||
| /// The path over which the [`StaticInvoice`] will be sent to the payer, which should be | ||
| /// provided to [`ChannelManager::send_static_invoice`] along with the invoice. | ||
| /// provided to [`ChannelManager::respond_to_static_invoice_request`] along with the invoice. | ||
| /// | ||
| /// [`ChannelManager::send_static_invoice`]: crate::ln::channelmanager::ChannelManager::send_static_invoice | ||
| /// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request | ||
| reply_path: Responder, | ||
| /// The invoice request that will be forwarded to the async recipient to give the | ||
| /// recipient a chance to provide an invoice in case it is online. It should be | ||
| /// provided to [`ChannelManager::respond_to_static_invoice_request`]. | ||
| /// | ||
|
Collaborator
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. Presumably we should document here that LSPs should try to use LSPS5 to wake the client (based on the
Collaborator
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. Discussed it more with @valentinewallace really I think we need to be pushing the forwarded static invoice requests through the
Contributor
Author
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.
I was wondering why not this approach instead of the mailbox logic? It could be weird to have this flow outside of the mailbox but as you said it would allow the LSP to wake up the client before deciding to call Also, in any of the 2 approaches, although I would think most likely the introduction node of the
Collaborator
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. This would be in addition/conjunction with the mailbox logic. LSPS5 is just a way to tell the client to run by sending a notification, we'd still have to keep the pending message in the mailbox so that we can deliver it when they come online. |
||
| /// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request | ||
| invoice_request: InvoiceRequest, | ||
| }, | ||
| /// Indicates that a channel funding transaction constructed interactively is ready to be | ||
| /// signed. This event will only be triggered if at least one input was contributed. | ||
|
|
||
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.
I'm not sure if it's awkward that we have a raw
BlindedMessagePathhere but use aResponderbelow... Not blocking though.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.
Hmmm yeah can be a bit awkward. I used a
BlindedMessagePathsince that is how it's sent in theServeStaticInvoicemessage. And if passed as aResponderI think I would still need to use it as aBlindedMessagePathto build theMessageSendInstructions::WithSpecifiedReplyPath