-
Notifications
You must be signed in to change notification settings - Fork 366
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
Support paying static invoices #3140
Support paying static invoices #3140
Commits on Sep 12, 2024
-
Tweak debug_assert message for parsed onion messages.
More specific.
Configuration menu - View commit details
-
Copy full SHA for 732ee14 - Browse repository at this point
Copy the full SHA 732ee14View commit details -
Add MessageContext for async payments.
This context will be used in reply paths for outbound held_htlc_available messages, so we can authenticate the corresponding release_held_htlc messages.
Configuration menu - View commit details
-
Copy full SHA for a3216ac - Browse repository at this point
Copy the full SHA a3216acView commit details -
Pass context into held_htlc_available message handling.
Useful for using the payment_id within to look up the corresponding outbound async payment so we know we can safely release the HTLCs to the now-onlinen recipient.
Configuration menu - View commit details
-
Copy full SHA for e162278 - Browse repository at this point
Copy the full SHA e162278View commit details -
Store AsyncPaymentsMessages for later sending
Upcoming commits will support sending and receiving held_htlc_available and release_held_htlc messages. These messages need to be enqueued so that they can be released in ChannelManager's implementation of AsyncPaymentsMessageHandler to OnionMessenger for sending.
Configuration menu - View commit details
-
Copy full SHA for 3d5d64a - Browse repository at this point
Copy the full SHA 3d5d64aView commit details
Commits on Sep 13, 2024
-
Support checking that a static invoice matches an outbound invreq.
Useful for ensuring that an inbound static invoice matches one of our outbound invreqs, otherwise it is an unexpected invoice and should be ignored and not paid.
Configuration menu - View commit details
-
Copy full SHA for cff6e34 - Browse repository at this point
Copy the full SHA cff6e34View commit details -
Configuration menu - View commit details
-
Copy full SHA for ad63a70 - Browse repository at this point
Copy the full SHA ad63a70View commit details -
Store async payment data in PendingOutboundPayment.
Adds a pending outbound payment variant for async payments, which indicates that we have received a static invoice to pay and have generated a keysend preimage for the eventual payment. When the recipient comes back online, we'll transition from this new state to Retryable and actually forward the HTLCs.
Configuration menu - View commit details
-
Copy full SHA for c3ed4a2 - Browse repository at this point
Copy the full SHA c3ed4a2View commit details -
Pass full message context into ChanMan blinded path util.
Allows us to repurpose this util to create blinded paths in an async payments message context while maintaining support for the offers context.
Configuration menu - View commit details
-
Copy full SHA for 7fb16ea - Browse repository at this point
Copy the full SHA 7fb16eaView commit details -
Configuration menu - View commit details
-
Copy full SHA for c976e4c - Browse repository at this point
Copy the full SHA c976e4cView commit details -
Support initiating an async payment to a static invoice.
Supported when the sender is an always-online node. Here we send the initial held_htlc_available onion message upon receipt of a static invoice, next we'll need to actually send HTLCs upon getting a response to said OM.
Configuration menu - View commit details
-
Copy full SHA for b6f4479 - Browse repository at this point
Copy the full SHA b6f4479View commit details -
Configuration menu - View commit details
-
Copy full SHA for 28269a7 - Browse repository at this point
Copy the full SHA 28269a7View commit details -
Configuration menu - View commit details
-
Copy full SHA for e4d7681 - Browse repository at this point
Copy the full SHA e4d7681View commit details -
Set max path len on receipt of static invoice.
Because we may receive a static invoice to pay days before the recipient actually comes back online to receive the payment, it's good to do as many checks as we can up-front. Here we ensure that the blinded paths provided in the invoice won't cause us to exceed the maximum onion packet size.
Configuration menu - View commit details
-
Copy full SHA for 8569830 - Browse repository at this point
Copy the full SHA 8569830View commit details -
Split off send_payment_for_bolt12_invoice_internal util.
This new util will be able to send to both static and non-static BOLT 12 invoices.
Configuration menu - View commit details
-
Copy full SHA for 69356e7 - Browse repository at this point
Copy the full SHA 69356e7View commit details -
Support sending async payments as an always-online sender.
Async receive is not yet supported. Here we process inbound release_htlc onion messages, check that they actually correspond to one of our outbound payments, and actually forward the HTLCs. Valid release_htlc receipt indicates that the recipient has now come online to receive.
Configuration menu - View commit details
-
Copy full SHA for 0297a1e - Browse repository at this point
Copy the full SHA 0297a1eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 985e6ac - Browse repository at this point
Copy the full SHA 985e6acView commit details -
Support abandoning pending outbound async payments.
Async payments may have very high expires because we may be waiting for days for the recipient to come online, so it's important that users be able to abandon these payments early if needed.
Configuration menu - View commit details
-
Copy full SHA for 6d415b1 - Browse repository at this point
Copy the full SHA 6d415b1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7dd1787 - Browse repository at this point
Copy the full SHA 7dd1787View commit details -
Don't trigger manager persistence on unexpected release_htlc message.
If someone sends us an unexpected or duplicate release_held_htlc onion message, we should simply ignore it and not persist the entire ChannelManager in response.
Configuration menu - View commit details
-
Copy full SHA for c4f3e25 - Browse repository at this point
Copy the full SHA c4f3e25View commit details -
Rename Payment{Hash,Id} hmac creation/verification methods for offers.
We want to specify that these methods are only to be used in an outbound offers payment context, because we'll be adding similar methods for the outbound async payments context in upcoming commits.
Configuration menu - View commit details
-
Copy full SHA for 5a7f523 - Browse repository at this point
Copy the full SHA 5a7f523View commit details -
Verify inbound ReleaseHeldHtlc messages via hmac.
See AsyncPaymentsContext::hmac, but this prevents the recipient from deanonymizing us. Without this, if they are able to guess the correct payment id, then they could create a blinded path to us and confirm our identity. We also move the PAYMENT_HASH_HMAC_INPUT const to use &[7; 16], which is safe because this const was added since the last release. This ordering reads more smoothly.
Configuration menu - View commit details
-
Copy full SHA for 615eefb - Browse repository at this point
Copy the full SHA 615eefbView commit details -
Add new Bolt12PaymentError for failed blinded path creation.
Currently used when initiating an async payment via held_htlc_available OM. This OM needs a reply path back to us, so use this error for our invoice_error OM if we fail to create said reply path.
Configuration menu - View commit details
-
Copy full SHA for 26d1582 - Browse repository at this point
Copy the full SHA 26d1582View commit details -
Document PendingOutboundPayment::{Static}InvoiceReceived semantics.
While these variants may sound similar, they are very different. One is so temporary it's never even persisted to disk, the other is a state we will stay in for hours or days. See added docs for more info.
Configuration menu - View commit details
-
Copy full SHA for 4bcf53e - Browse repository at this point
Copy the full SHA 4bcf53eView commit details -
Remove payment_release_secret from async payments messages.
This field isn't necessary because we already authenticate the messages via the blinded reply paths payment_id, nonce and HMAC.
Configuration menu - View commit details
-
Copy full SHA for 6e27aec - Browse repository at this point
Copy the full SHA 6e27aecView commit details