/**
- * Parameters needed to find a [`Route`] for paying a [`Payee`].
+ * Parameters needed to find a [`Route`].
*
- * Passed to [`find_route`] and also provided in [`Event::PaymentPathFailed`] for retrying a failed
- * payment path.
+ * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in
+ * [`Event::PaymentPathFailed`].
*
- * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+ * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
*/
@SuppressWarnings("unchecked") // We correctly assign various generic arrays
public class RouteParameters extends CommonBase {
}
/**
- * The recipient of the failed payment path.
+ * The parameters of the failed payment path.
*/
- public Payee get_payee() {
- long ret = bindings.RouteParameters_get_payee(this.ptr);
+ public PaymentParameters get_payment_params() {
+ long ret = bindings.RouteParameters_get_payment_params(this.ptr);
Reference.reachabilityFence(this);
if (ret >= 0 && ret <= 4096) { return null; }
- Payee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Payee(null, ret); }
- ret_hu_conv.ptrs_to.add(this);
+ org.ldk.structs.PaymentParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentParameters(null, ret); }
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
return ret_hu_conv;
}
/**
- * The recipient of the failed payment path.
+ * The parameters of the failed payment path.
*/
- public void set_payee(Payee val) {
- bindings.RouteParameters_set_payee(this.ptr, val == null ? 0 : val.ptr & ~1);
+ public void set_payment_params(org.ldk.structs.PaymentParameters val) {
+ bindings.RouteParameters_set_payment_params(this.ptr, val == null ? 0 : val.ptr);
Reference.reachabilityFence(this);
Reference.reachabilityFence(val);
+ if (this != null) { this.ptrs_to.add(val); };
}
/**
Reference.reachabilityFence(val);
}
- /**
- * The CLTV on the final hop of the failed payment path.
- */
- public int get_final_cltv_expiry_delta() {
- int ret = bindings.RouteParameters_get_final_cltv_expiry_delta(this.ptr);
- Reference.reachabilityFence(this);
- return ret;
- }
-
- /**
- * The CLTV on the final hop of the failed payment path.
- */
- public void set_final_cltv_expiry_delta(int val) {
- bindings.RouteParameters_set_final_cltv_expiry_delta(this.ptr, val);
- Reference.reachabilityFence(this);
- Reference.reachabilityFence(val);
- }
-
/**
* Constructs a new RouteParameters given each field
*/
- public static RouteParameters of(Payee payee_arg, long final_value_msat_arg, int final_cltv_expiry_delta_arg) {
- long ret = bindings.RouteParameters_new(payee_arg == null ? 0 : payee_arg.ptr & ~1, final_value_msat_arg, final_cltv_expiry_delta_arg);
- Reference.reachabilityFence(payee_arg);
+ public static RouteParameters of(org.ldk.structs.PaymentParameters payment_params_arg, long final_value_msat_arg) {
+ long ret = bindings.RouteParameters_new(payment_params_arg == null ? 0 : payment_params_arg.ptr, final_value_msat_arg);
+ Reference.reachabilityFence(payment_params_arg);
Reference.reachabilityFence(final_value_msat_arg);
- Reference.reachabilityFence(final_cltv_expiry_delta_arg);
if (ret >= 0 && ret <= 4096) { return null; }
- RouteParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RouteParameters(null, ret); }
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ org.ldk.structs.RouteParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteParameters(null, ret); }
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payment_params_arg); };
return ret_hu_conv;
}
long ret = bindings.RouteParameters_clone(this.ptr);
Reference.reachabilityFence(this);
if (ret >= 0 && ret <= 4096) { return null; }
- RouteParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RouteParameters(null, ret); }
- ret_hu_conv.ptrs_to.add(this);
+ org.ldk.structs.RouteParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteParameters(null, ret); }
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
return ret_hu_conv;
}
+ /**
+ * Checks if two RouteParameterss 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.
+ */
+ public boolean eq(org.ldk.structs.RouteParameters b) {
+ boolean ret = bindings.RouteParameters_eq(this.ptr, b == null ? 0 : b.ptr);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(b);
+ if (this != null) { this.ptrs_to.add(b); };
+ return ret;
+ }
+
+ @Override public boolean equals(Object o) {
+ if (!(o instanceof RouteParameters)) return false;
+ return this.eq((RouteParameters)o);
+ }
/**
* Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
*/