Skip to content
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

Add static invoice creation utils to ChannelManager #3408

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Commits on Nov 14, 2024

  1. Configuration menu
    Copy the full SHA
    847b43b View commit details
    Browse the repository at this point in the history
  2. Don't take() outbound invoice requests on retry

    Prior to this patch, we would take() the invoice request stored for
    AwaitingInvoice outbound payments when retrying sending the invoice request
    onion message. This doesn't work for async payments because we need to keep the
    invoice request stored for inclusion in the payment onion. Therefore, clone it
    instead of take()ing it.
    valentinewallace committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    5c0b804 View commit details
    Browse the repository at this point in the history
  3. Fix failure to abandon async payments on invalid static invoice

    Prior to this fix, we would attempt to mark outbound async payments as
    abandoned but silently fail because they were in state AwaitingInvoice, which
    the mark_abandoned utility doesn't currently work for. These payments would
    eventually be removed by the remove_stale_payments method, but there would be a
    delay in generating the PaymentFailed event.
    
    Move to manually removing the outbound payment entry.
    valentinewallace committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    95c3fdd View commit details
    Browse the repository at this point in the history
  4. Make create_blinded_payment_paths methods amount optional.

    Useful for creating payment paths for static invoices which are typically
    amount-less.
    valentinewallace committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    4fc32f9 View commit details
    Browse the repository at this point in the history
  5. Factor invoice expiry into blinded path max_cltv_expiry

    Will be useful for static invoices' blinded paths, which may have long
    expiries. Rather than having a default max_cltv_expiry, we now base it
    on the invoice expiry.
    valentinewallace committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    22398b1 View commit details
    Browse the repository at this point in the history
  6. Add PaymentContext for async payments

    This context is stored in the blinded payment paths we put in static invoices
    and is useful to authenticate payments over these paths to the recipient.
    
    We can't reuse Bolt12OfferContext for this because we don't have access to the
    invoice request fields at static invoice creation time.
    valentinewallace committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    55b7d65 View commit details
    Browse the repository at this point in the history
  7. Add onion message AsyncPaymentsContext for inbound payments

    This context is included in static invoice's blinded message paths, provided
    back to us in HeldHtlcAvailable onion messages for blinded path authentication.
    In future work, we will check if this context is valid and respond with a
    ReleaseHeldHtlc message to release the upstream payment if so.
    
    We also add creation methods for the hmac used for authenticating the blinded path
    using the static invoice's corresponding offer id.
    valentinewallace committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    1e1250f View commit details
    Browse the repository at this point in the history
  8. Add utils to create static invoices and their corresponding offers

    We can't use our regular offer creation util for receiving async payments
    because the recipient can't be relied on to be online to service
    invoice_requests.
    
    Therefore, add a new offer creation util that is parameterized by blinded
    message paths to another node on the network that *is* always-online and can
    serve static invoices on behalf of the often-offline recipient.
    
    Also add a utility for creating static invoices corresponding to these offers.
    See new utils' docs and BOLTs PR 1149 for more info.
    valentinewallace committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    51d3a12 View commit details
    Browse the repository at this point in the history
  9. Test failures on paying static invoices

    Since adding support for creating static invoices from ChannelManager, it's
    easier to test these failure cases that went untested when we added support for
    paying static invoices.
    valentinewallace committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    8feb3cb View commit details
    Browse the repository at this point in the history