Package org.ldk.structs
Class Payer
- java.lang.Object
-
- org.ldk.structs.Payer
-
public class Payer extends Object
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. [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfacePayer.PayerInterface
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabandon_payment(byte[] payment_id)Signals that no further retries for the given payment will occur.protected voidfinalize()ChannelDetails[]first_hops()Returns the payer's channels.InFlightHtlcsinflight_htlcs()Construct an [`InFlightHtlcs`] containing information about currently used up liquidity across payments.static Payernew_impl(Payer.PayerInterface arg)byte[]node_id()Returns the payer's node id.Result_NonePaymentSendFailureZretry_payment(Route route, byte[] payment_id)Retries a failed payment path for the [`PaymentId`] using the given [`Route`].Result_NonePaymentSendFailureZsend_payment(Route route, byte[] payment_hash, byte[] payment_secret, byte[] payment_id)Sends a payment over the Lightning Network using the given [`Route`].Result_NonePaymentSendFailureZsend_spontaneous_payment(Route route, byte[] payment_preimage, byte[] payment_id)Sends a spontaneous payment over the Lightning Network using the given [`Route`].
-
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
-
new_impl
public static Payer new_impl(Payer.PayerInterface arg)
-
node_id
public byte[] node_id()
Returns the payer's node id.
-
first_hops
public ChannelDetails[] first_hops()
Returns the payer's channels.
-
send_payment
public Result_NonePaymentSendFailureZ send_payment(Route route, byte[] payment_hash, @Nullable byte[] payment_secret, byte[] payment_id)
Sends a payment over the Lightning Network using the given [`Route`]. Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
-
send_spontaneous_payment
public Result_NonePaymentSendFailureZ send_spontaneous_payment(Route route, byte[] payment_preimage, byte[] payment_id)
Sends a spontaneous payment over the Lightning Network using the given [`Route`].
-
retry_payment
public Result_NonePaymentSendFailureZ retry_payment(Route route, byte[] payment_id)
Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
-
abandon_payment
public void abandon_payment(byte[] payment_id)
Signals that no further retries for the given payment will occur.
-
inflight_htlcs
public InFlightHtlcs inflight_htlcs()
Construct an [`InFlightHtlcs`] containing information about currently used up liquidity across payments.
-
-