Class PaymentParameters


  • public class PaymentParameters
    extends Object
    The recipient of a payment.
    • Method Detail

      • get_payee_pubkey

        public byte[] get_payee_pubkey()
        The node id of the payee.
      • set_payee_pubkey

        public void set_payee_pubkey​(byte[] val)
        The node id of the payee.
      • get_features

        @Nullable
        public InvoiceFeatures get_features()
        Features supported by the payee. May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice does not contain any features. [`for_keysend`]: Self::for_keysend Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
      • set_features

        public void set_features​(@Nullable
                                 InvoiceFeatures val)
        Features supported by the payee. May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice does not contain any features. [`for_keysend`]: Self::for_keysend Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
      • get_route_hints

        public Hints get_route_hints()
        Hints for routing to the payee, containing channels connecting the payee to public nodes.
      • set_route_hints

        public void set_route_hints​(Hints val)
        Hints for routing to the payee, containing channels connecting the payee to public nodes.
      • 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.
      • get_final_cltv_expiry_delta

        public int get_final_cltv_expiry_delta()
        The minimum CLTV delta at the end of the route. This value must not be zero.
      • set_final_cltv_expiry_delta

        public void set_final_cltv_expiry_delta​(int val)
        The minimum CLTV delta at the end of the route. This value must not be zero.
      • of

        public static PaymentParameters of​(byte[] payee_pubkey_arg,
                                           InvoiceFeatures features_arg,
                                           Hints route_hints_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,
                                           int final_cltv_expiry_delta_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)
        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.