X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FPaymentParameters.java;h=4be6c0247032f28a5d63f527c88533329101665f;hb=ffdd56c967087cba7548599934585b8a9a3102e2;hp=4cc0fbdf65994cdd59e03dd2b7286394b7fa8c91;hpb=3e33cfde4213dafe90eb976eb67224e2451da855;p=ldk-java diff --git a/src/main/java/org/ldk/structs/PaymentParameters.java b/src/main/java/org/ldk/structs/PaymentParameters.java index 4cc0fbdf..4be6c024 100644 --- a/src/main/java/org/ldk/structs/PaymentParameters.java +++ b/src/main/java/org/ldk/structs/PaymentParameters.java @@ -170,17 +170,42 @@ public class PaymentParameters extends CommonBase { Reference.reachabilityFence(val); } + /** + * A list of indices corresponding to blinded paths in [`Payee::Blinded::route_hints`] 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 blinded paths. + * + * Returns a copy of the field. + */ + public long[] get_previously_failed_blinded_path_idxs() { + long[] ret = bindings.PaymentParameters_get_previously_failed_blinded_path_idxs(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * A list of indices corresponding to blinded paths in [`Payee::Blinded::route_hints`] 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 blinded paths. + */ + public void set_previously_failed_blinded_path_idxs(long[] val) { + bindings.PaymentParameters_set_previously_failed_blinded_path_idxs(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + /** * Constructs a new PaymentParameters given each field */ - public static PaymentParameters of(org.ldk.structs.Payee payee_arg, org.ldk.structs.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) { - long ret = bindings.PaymentParameters_new(payee_arg.ptr, expiry_time_arg.ptr, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg); + public static PaymentParameters of(org.ldk.structs.Payee payee_arg, org.ldk.structs.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, long[] previously_failed_blinded_path_idxs_arg) { + long ret = bindings.PaymentParameters_new(payee_arg.ptr, expiry_time_arg.ptr, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg, previously_failed_blinded_path_idxs_arg); Reference.reachabilityFence(payee_arg); Reference.reachabilityFence(expiry_time_arg); Reference.reachabilityFence(max_total_cltv_expiry_delta_arg); Reference.reachabilityFence(max_path_count_arg); Reference.reachabilityFence(max_channel_saturation_power_of_half_arg); Reference.reachabilityFence(previously_failed_channels_arg); + Reference.reachabilityFence(previously_failed_blinded_path_idxs_arg); if (ret >= 0 && ret <= 4096) { return null; } 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(ret_hu_conv); }; @@ -225,7 +250,7 @@ public class PaymentParameters extends CommonBase { * Two objects with NULL inner values will be considered "equal" here. */ public boolean eq(org.ldk.structs.PaymentParameters b) { - boolean ret = bindings.PaymentParameters_eq(this.ptr, b == null ? 0 : b.ptr); + boolean ret = bindings.PaymentParameters_eq(this.ptr, b.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(b); if (this != null) { this.ptrs_to.add(b); }; @@ -303,7 +328,7 @@ public class PaymentParameters extends CommonBase { * [`PaymentParameters::expiry_time`]. */ public static PaymentParameters from_bolt12_invoice(org.ldk.structs.Bolt12Invoice invoice) { - long ret = bindings.PaymentParameters_from_bolt12_invoice(invoice == null ? 0 : invoice.ptr); + long ret = bindings.PaymentParameters_from_bolt12_invoice(invoice.ptr); Reference.reachabilityFence(invoice); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.PaymentParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentParameters(null, ret); } @@ -312,4 +337,16 @@ public class PaymentParameters extends CommonBase { return ret_hu_conv; } + /** + * Creates parameters for paying to a blinded payee from the provided blinded route hints. + */ + public static PaymentParameters blinded(TwoTuple_BlindedPayInfoBlindedPathZ[] blinded_route_hints) { + long ret = bindings.PaymentParameters_blinded(blinded_route_hints != null ? Arrays.stream(blinded_route_hints).mapToLong(blinded_route_hints_conv_37 -> blinded_route_hints_conv_37.ptr).toArray() : null); + Reference.reachabilityFence(blinded_route_hints); + if (ret >= 0 && ret <= 4096) { return null; } + 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(ret_hu_conv); }; + return ret_hu_conv; + } + }