Class PaymentParameters


  • public class PaymentParameters
    extends Object
    Information used to route a payment.
    • Method Detail

      • get_payee

        public Payee get_payee()
        Information about the payee, such as their features and route hints for their channels.
      • set_payee

        public void set_payee​(Payee val)
        Information about the payee, such as their features and route hints for their channels.
      • get_expiry_time

        public Option_u64Z get_expiry_time()
        Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
      • set_expiry_time

        public void set_expiry_time​(Option_u64Z val)
        Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
      • get_max_total_cltv_expiry_delta

        public int get_max_total_cltv_expiry_delta()
        The maximum total CLTV delta we accept for the route. Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
      • set_max_total_cltv_expiry_delta

        public void set_max_total_cltv_expiry_delta​(int val)
        The maximum total CLTV delta we accept for the route. Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
      • get_max_path_count

        public byte get_max_path_count()
        The maximum number of paths that may be used by (MPP) payments. Defaults to [`DEFAULT_MAX_PATH_COUNT`].
      • set_max_path_count

        public void set_max_path_count​(byte val)
        The maximum number of paths that may be used by (MPP) payments. Defaults to [`DEFAULT_MAX_PATH_COUNT`].
      • get_max_channel_saturation_power_of_half

        public byte get_max_channel_saturation_power_of_half()
        Selects the maximum share of a channel's total capacity which will be sent over a channel, as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas a lower value prefers to send larger MPP parts, potentially saturating channels and increasing failure probability for those paths. Note that this restriction will be relaxed during pathfinding after paths which meet this restriction have been found. While paths which meet this criteria will be searched for, it is ultimately up to the scorer to select them over other paths. A value of 0 will allow payments up to and including a channel's total announced usable capacity, a value of one will only use up to half its capacity, two 1/4, etc. Default value: 2
      • set_max_channel_saturation_power_of_half

        public void set_max_channel_saturation_power_of_half​(byte val)
        Selects the maximum share of a channel's total capacity which will be sent over a channel, as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas a lower value prefers to send larger MPP parts, potentially saturating channels and increasing failure probability for those paths. Note that this restriction will be relaxed during pathfinding after paths which meet this restriction have been found. While paths which meet this criteria will be searched for, it is ultimately up to the scorer to select them over other paths. A value of 0 will allow payments up to and including a channel's total announced usable capacity, a value of one will only use up to half its capacity, two 1/4, etc. Default value: 2
      • get_previously_failed_channels

        public long[] get_previously_failed_channels()
        A list of SCIDs which this payment was previously attempted over and which caused the payment to fail. Future attempts for the same payment shouldn't be relayed through any of these SCIDs. Returns a copy of the field.
      • set_previously_failed_channels

        public void set_previously_failed_channels​(long[] val)
        A list of SCIDs which this payment was previously attempted over and which caused the payment to fail. Future attempts for the same payment shouldn't be relayed through any of these SCIDs.
      • of

        public static PaymentParameters of​(Payee payee_arg,
                                           Option_u64Z expiry_time_arg,
                                           int max_total_cltv_expiry_delta_arg,
                                           byte max_path_count_arg,
                                           byte max_channel_saturation_power_of_half_arg,
                                           long[] previously_failed_channels_arg)
        Constructs a new PaymentParameters given each field
      • hash

        public long hash()
        Generates a non-cryptographic 64-bit hash of the PaymentParameters.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • eq

        public boolean eq​(PaymentParameters b)
        Checks if two PaymentParameterss contain equal inner contents. This ignores pointers and is_owned flags and looks at the values in fields. Two objects with NULL inner values will be considered "equal" here.
      • write

        public byte[] write()
        Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
      • from_node_id

        public static PaymentParameters from_node_id​(byte[] payee_pubkey,
                                                     int final_cltv_expiry_delta)
        Creates a payee with the node id of the given `pubkey`. The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has provided.
      • for_keysend

        public static PaymentParameters for_keysend​(byte[] payee_pubkey,
                                                    int final_cltv_expiry_delta,
                                                    boolean allow_mpp)
        Creates a payee with the node id of the given `pubkey` to use for keysend payments. The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has provided. Note that MPP keysend is not widely supported yet. The `allow_mpp` lets you choose whether your router will be allowed to find a multi-part route for this payment. If you set `allow_mpp` to true, you should ensure a payment secret is set on send, likely via [`RecipientOnionFields::secret_only`]. [`RecipientOnionFields::secret_only`]: crate::ln::channelmanager::RecipientOnionFields::secret_only
      • from_bolt12_invoice

        public static PaymentParameters from_bolt12_invoice​(Bolt12Invoice invoice)
        Creates parameters for paying to a blinded payee from the provided invoice. Sets [`Payee::Blinded::route_hints`], [`Payee::Blinded::features`], and [`PaymentParameters::expiry_time`].