[Java] Update auto-generated bindings to 0.0.117
[ldk-java] / src / main / java / org / ldk / structs / Retry.java
index 452044df996ca29798d74953adf0d0cdb2aadcf0..c1bbe96cb88f32cdbf2b5db755379dea186c3abc 100644 (file)
@@ -9,7 +9,7 @@ import javax.annotation.Nullable;
 
 
 /**
- * Strategies available to retry payment path failures for an [`Invoice`].
+ * Strategies available to retry payment path failures.
  */
 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
 public class Retry extends CommonBase {
@@ -33,19 +33,22 @@ public class Retry extends CommonBase {
        /**
         * Max number of attempts to retry payment.
         * 
-        * Note that this is the number of *path* failures, not full payment retries. For multi-path
-        * payments, if this is less than the total number of paths, we will never even retry all of the
-        * payment's paths.
+        * Each attempt may be multiple HTLCs along multiple paths if the router decides to split up a
+        * retry, and may retry multiple failed HTLCs at once if they failed around the same time and
+        * were retried along a route from a single call to [`Router::find_route_with_id`].
         */
        public final static class Attempts extends Retry {
-               public final long attempts;
+               public final int attempts;
                private Attempts(long ptr, bindings.LDKRetry.Attempts obj) {
                        super(null, ptr);
                        this.attempts = obj.attempts;
                }
        }
        /**
-        * Time elapsed before abandoning retries for a payment.
+        * Time elapsed before abandoning retries for a payment. At least one attempt at payment is made;
+        * see [`PaymentParameters::expiry_time`] to avoid any attempt at payment after a specific time.
+        * 
+        * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time
         */
        public final static class Timeout extends Retry {
                public final long timeout;
@@ -68,19 +71,19 @@ public class Retry extends CommonBase {
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.Retry ret_hu_conv = org.ldk.structs.Retry.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(this);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
        /**
         * Utility method to constructs a new Attempts-variant Retry
         */
-       public static Retry attempts(long a) {
+       public static Retry attempts(int a) {
                long ret = bindings.Retry_attempts(a);
                Reference.reachabilityFence(a);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.Retry ret_hu_conv = org.ldk.structs.Retry.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -92,7 +95,7 @@ public class Retry extends CommonBase {
                Reference.reachabilityFence(a);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.Retry ret_hu_conv = org.ldk.structs.Retry.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -100,7 +103,7 @@ public class Retry extends CommonBase {
         * Checks if two Retrys contain equal inner contents.
         * This ignores pointers and is_owned flags and looks at the values in fields.
         */
-       public boolean eq(Retry b) {
+       public boolean eq(org.ldk.structs.Retry b) {
                boolean ret = bindings.Retry_eq(this.ptr, b == null ? 0 : b.ptr);
                Reference.reachabilityFence(this);
                Reference.reachabilityFence(b);
@@ -112,7 +115,7 @@ public class Retry extends CommonBase {
                return this.eq((Retry)o);
        }
        /**
-        * Checks if two Retrys contain equal inner contents.
+        * Generates a non-cryptographic 64-bit hash of the Retry.
         */
        public long hash() {
                long ret = bindings.Retry_hash(this.ptr);
@@ -123,4 +126,24 @@ public class Retry extends CommonBase {
        @Override public int hashCode() {
                return (int)this.hash();
        }
+       /**
+        * Serialize the Retry object into a byte array which can be read by Retry_read
+        */
+       public byte[] write() {
+               byte[] ret = bindings.Retry_write(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
+       }
+
+       /**
+        * Read a Retry from a byte array, created by Retry_write
+        */
+       public static Result_RetryDecodeErrorZ read(byte[] ser) {
+               long ret = bindings.Retry_read(ser);
+               Reference.reachabilityFence(ser);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_RetryDecodeErrorZ ret_hu_conv = Result_RetryDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
 }