Enum AsyncPaymentsContext

Source
pub enum AsyncPaymentsContext {
    OfferPathsRequest {
        recipient_id: Vec<u8>,
        path_absolute_expiry: Option<Duration>,
    },
    OfferPaths {
        invoice_slot: u16,
        path_absolute_expiry: Duration,
    },
    ServeStaticInvoice {
        recipient_id: Vec<u8>,
        invoice_slot: u16,
        path_absolute_expiry: Duration,
    },
    StaticInvoicePersisted {
        offer_id: OfferId,
        invoice_created_at: Duration,
    },
    OutboundPayment {
        payment_id: PaymentId,
    },
    InboundPayment {
        path_absolute_expiry: Duration,
    },
    ReleaseHeldHtlc {
        intercept_id: InterceptId,
        prev_outbound_scid_alias: u64,
        htlc_id: u64,
    },
}
Expand description

Contains data specific to an AsyncPaymentsMessage.

Variants§

§

OfferPathsRequest

Context used by a BlindedMessagePath provided out-of-band to an async recipient, where the context is provided back to the static invoice server in corresponding OfferPathsRequests.

Fields

§recipient_id: Vec<u8>

An identifier for the async recipient that is requesting blinded paths to include in their Offer::paths. This ID will be surfaced when the async recipient eventually sends a corresponding ServeStaticInvoice message, and can be used to rate limit the recipient.

§path_absolute_expiry: Option<Duration>

An optional field indicating the time as duration since the Unix epoch at which this path expires and messages sent over it should be ignored.

Useful to timeout async recipients that are no longer supported as clients.

§

OfferPaths

Context used by a reply path to an OfferPathsRequest, provided back to us as an async recipient in corresponding OfferPaths messages from the static invoice server.

Fields

§invoice_slot: u16

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.

§path_absolute_expiry: Duration

The time as duration since the Unix epoch at which this path expires and messages sent over it should be ignored.

This avoids the situation where the OfferPaths message is very delayed and thus outdated.

§

ServeStaticInvoice

Context used by a reply path to an OfferPaths message, provided back to us as the static invoice server in corresponding ServeStaticInvoice messages.

Fields

§recipient_id: Vec<u8>

An identifier for the async recipient that is requesting that a StaticInvoice be served on their behalf.

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.

This id will be provided back to us as the static invoice server via OffersContext::StaticInvoiceRequested::recipient_id.

§invoice_slot: u16

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_slot.

§path_absolute_expiry: Duration

The time as duration since the Unix epoch at which this path expires and messages sent over it should be ignored.

Useful to timeout async recipients that are no longer supported as clients.

§

StaticInvoicePersisted

Context used by a reply path to a ServeStaticInvoice message, provided back to us in corresponding StaticInvoicePersisted messages.

Fields

§offer_id: OfferId

The id of the offer in the cache corresponding to the StaticInvoice that has been persisted. This invoice is now ready to be provided by the static invoice server in response to InvoiceRequests, so the corresponding offer can be marked as ready to receive payments.

§invoice_created_at: Duration

The time as duration since the Unix epoch at which the invoice corresponding to this path was created. Useful to know when an invoice needs replacement.

§

OutboundPayment

Context contained within the reply BlindedMessagePath we put in outbound HeldHtlcAvailable messages, provided back to us in corresponding ReleaseHeldHtlc messages if we are an always-online sender paying an async recipient.

Fields

§payment_id: PaymentId

ID used when payment to the originating Offer was initiated. Useful for us to identify which of our pending outbound payments should be released to its often-offline payee.

§

InboundPayment

Context contained within the BlindedMessagePaths we put in static invoices, provided back to us in corresponding HeldHtlcAvailable messages.

Fields

§path_absolute_expiry: Duration

The time as duration since the Unix epoch at which this path expires and messages sent over it should be ignored. Without this, anyone with the path corresponding to this context is able to trivially ask if we’re online forever.

§

ReleaseHeldHtlc

Context contained within the reply BlindedMessagePath put in outbound HeldHtlcAvailable messages, provided back to the async sender’s always-online counterparty in corresponding ReleaseHeldHtlc messages.

Fields

§intercept_id: InterceptId

An identifier for the HTLC that should be released by us as the sender’s always-online channel counterparty to the often-offline recipient.

§prev_outbound_scid_alias: u64

The short channel id alias corresponding to the to-be-released inbound HTLC, to help locate the HTLC internally if the ReleaseHeldHtlc races our node decoding the held HTLC’s onion.

We use the outbound scid alias because it is stable even if the channel splices, unlike regular short channel ids.

§htlc_id: u64

The id of the to-be-released HTLC, to help locate the HTLC internally if the ReleaseHeldHtlc races our node decoding the held HTLC’s onion.

Trait Implementations§

Source§

impl Clone for AsyncPaymentsContext

Source§

fn clone(&self) -> AsyncPaymentsContext

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AsyncPaymentsContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Readable for AsyncPaymentsContext

Source§

fn read<R: Read>(reader: &mut R) -> Result<Self, DecodeError>

Reads a Self in from the given Read.
Source§

impl Writeable for AsyncPaymentsContext

Source§

fn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error>

Writes self out to the given Writer.
Source§

fn encode(&self) -> Vec<u8>

Writes self out to a Vec<u8>.
Source§

fn serialized_length(&self) -> usize

Gets the length of this object after it has been serialized. This can be overridden to optimize cases where we prepend an object with its length.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LengthReadable for T
where T: Readable,

Source§

fn read_from_fixed_length_buffer<R>(reader: &mut R) -> Result<T, DecodeError>

Reads a Self in from the given LengthLimitedRead.
Source§

impl<T> MaybeReadable for T
where T: Readable,

Source§

fn read<R>(reader: &mut R) -> Result<Option<T>, DecodeError>
where R: Read,

Reads a Self in from the given Read.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V