pub trait Payer {
    fn node_id(&self) -> PublicKey;
    fn first_hops(&self) -> Vec<ChannelDetails> ;
    fn send_payment(
        &self,
        route: &Route,
        payment_hash: PaymentHash,
        payment_secret: &Option<PaymentSecret>,
        payment_id: PaymentId
    ) -> Result<(), PaymentSendFailure>; fn send_spontaneous_payment(
        &self,
        route: &Route,
        payment_preimage: PaymentPreimage,
        payment_id: PaymentId
    ) -> Result<(), PaymentSendFailure>; fn retry_payment(
        &self,
        route: &Route,
        payment_id: PaymentId
    ) -> Result<(), PaymentSendFailure>; fn abandon_payment(&self, payment_id: PaymentId); fn inflight_htlcs(&self) -> InFlightHtlcs; }
Expand description

A trait defining behavior of an Invoice payer.

While the behavior of InvoicePayer provides idempotency of duplicate send_*payment calls with the same PaymentHash, it is up to the Payer to provide idempotency across restarts.

ChannelManager provides idempotency for duplicate payments with the same PaymentId.

In order to trivially ensure idempotency for payments, the default Payer implementation reuses the PaymentHash bytes as the PaymentId. Custom implementations wishing to provide payment idempotency with a different idempotency key (i.e. PaymentId) should map the Invoice or spontaneous payment target pubkey to their own idempotency key.

Required Methods§

Returns the payer’s node id.

Returns the payer’s channels.

Sends a payment over the Lightning Network using the given Route.

Sends a spontaneous payment over the Lightning Network using the given Route.

Retries a failed payment path for the PaymentId using the given Route.

Signals that no further retries for the given payment will occur.

Construct an InFlightHtlcs containing information about currently used up liquidity across payments.

Implementations on Foreign Types§

Implementors§