[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / ChannelPublicKeys.java
index 84a1d7e8ebe7eeff890506d8fcb433848b005be2..28a7706c754ae9827b302640d6a6ff1e0308cf47 100644 (file)
@@ -4,6 +4,7 @@ import org.ldk.impl.bindings;
 import org.ldk.enums.*;
 import org.ldk.util.*;
 import java.util.Arrays;
+import java.lang.ref.Reference;
 import javax.annotation.Nullable;
 
 
@@ -25,6 +26,7 @@ public class ChannelPublicKeys extends CommonBase {
         */
        public byte[] get_funding_pubkey() {
                byte[] ret = bindings.ChannelPublicKeys_get_funding_pubkey(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -33,7 +35,9 @@ public class ChannelPublicKeys extends CommonBase {
         * on-chain channel lock-in 2-of-2 multisig output.
         */
        public void set_funding_pubkey(byte[] val) {
-               bindings.ChannelPublicKeys_set_funding_pubkey(this.ptr, val);
+               bindings.ChannelPublicKeys_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(val);
        }
 
        /**
@@ -42,9 +46,13 @@ public class ChannelPublicKeys extends CommonBase {
         * counterparty to create a secret which the counterparty can reveal to revoke previous
         * states.
         */
-       public byte[] get_revocation_basepoint() {
-               byte[] ret = bindings.ChannelPublicKeys_get_revocation_basepoint(this.ptr);
-               return ret;
+       public RevocationBasepoint get_revocation_basepoint() {
+               long ret = bindings.ChannelPublicKeys_get_revocation_basepoint(this.ptr);
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.RevocationBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RevocationBasepoint(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
+               return ret_hu_conv;
        }
 
        /**
@@ -53,8 +61,11 @@ public class ChannelPublicKeys extends CommonBase {
         * counterparty to create a secret which the counterparty can reveal to revoke previous
         * states.
         */
-       public void set_revocation_basepoint(byte[] val) {
-               bindings.ChannelPublicKeys_set_revocation_basepoint(this.ptr, val);
+       public void set_revocation_basepoint(org.ldk.structs.RevocationBasepoint val) {
+               bindings.ChannelPublicKeys_set_revocation_basepoint(this.ptr, val == null ? 0 : val.ptr);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(val);
+               if (this != null) { this.ptrs_to.add(val); };
        }
 
        /**
@@ -64,6 +75,7 @@ public class ChannelPublicKeys extends CommonBase {
         */
        public byte[] get_payment_point() {
                byte[] ret = bindings.ChannelPublicKeys_get_payment_point(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -73,7 +85,9 @@ public class ChannelPublicKeys extends CommonBase {
         * static across every commitment transaction.
         */
        public void set_payment_point(byte[] val) {
-               bindings.ChannelPublicKeys_set_payment_point(this.ptr, val);
+               bindings.ChannelPublicKeys_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(val);
        }
 
        /**
@@ -81,9 +95,13 @@ public class ChannelPublicKeys extends CommonBase {
         * public key which receives non-HTLC-encumbered funds which are only available for spending
         * after some delay (or can be claimed via the revocation path).
         */
-       public byte[] get_delayed_payment_basepoint() {
-               byte[] ret = bindings.ChannelPublicKeys_get_delayed_payment_basepoint(this.ptr);
-               return ret;
+       public DelayedPaymentBasepoint get_delayed_payment_basepoint() {
+               long ret = bindings.ChannelPublicKeys_get_delayed_payment_basepoint(this.ptr);
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.DelayedPaymentBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DelayedPaymentBasepoint(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
+               return ret_hu_conv;
        }
 
        /**
@@ -91,54 +109,109 @@ public class ChannelPublicKeys extends CommonBase {
         * public key which receives non-HTLC-encumbered funds which are only available for spending
         * after some delay (or can be claimed via the revocation path).
         */
-       public void set_delayed_payment_basepoint(byte[] val) {
-               bindings.ChannelPublicKeys_set_delayed_payment_basepoint(this.ptr, val);
+       public void set_delayed_payment_basepoint(org.ldk.structs.DelayedPaymentBasepoint val) {
+               bindings.ChannelPublicKeys_set_delayed_payment_basepoint(this.ptr, val == null ? 0 : val.ptr);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(val);
+               if (this != null) { this.ptrs_to.add(val); };
        }
 
        /**
         * The base point which is used (with derive_public_key) to derive a per-commitment public key
         * which is used to encumber HTLC-in-flight outputs.
         */
-       public byte[] get_htlc_basepoint() {
-               byte[] ret = bindings.ChannelPublicKeys_get_htlc_basepoint(this.ptr);
-               return ret;
+       public HtlcBasepoint get_htlc_basepoint() {
+               long ret = bindings.ChannelPublicKeys_get_htlc_basepoint(this.ptr);
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.HtlcBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HtlcBasepoint(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
+               return ret_hu_conv;
        }
 
        /**
         * The base point which is used (with derive_public_key) to derive a per-commitment public key
         * which is used to encumber HTLC-in-flight outputs.
         */
-       public void set_htlc_basepoint(byte[] val) {
-               bindings.ChannelPublicKeys_set_htlc_basepoint(this.ptr, val);
+       public void set_htlc_basepoint(org.ldk.structs.HtlcBasepoint val) {
+               bindings.ChannelPublicKeys_set_htlc_basepoint(this.ptr, val == null ? 0 : val.ptr);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(val);
+               if (this != null) { this.ptrs_to.add(val); };
        }
 
        /**
         * Constructs a new ChannelPublicKeys given each field
         */
-       public static ChannelPublicKeys of(byte[] funding_pubkey_arg, byte[] revocation_basepoint_arg, byte[] payment_point_arg, byte[] delayed_payment_basepoint_arg, byte[] htlc_basepoint_arg) {
-               long ret = bindings.ChannelPublicKeys_new(funding_pubkey_arg, revocation_basepoint_arg, payment_point_arg, delayed_payment_basepoint_arg, htlc_basepoint_arg);
-               if (ret >= 0 && ret < 1024) { return null; }
-               ChannelPublicKeys ret_hu_conv = new ChannelPublicKeys(null, ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+       public static ChannelPublicKeys of(byte[] funding_pubkey_arg, org.ldk.structs.RevocationBasepoint revocation_basepoint_arg, byte[] payment_point_arg, org.ldk.structs.DelayedPaymentBasepoint delayed_payment_basepoint_arg, org.ldk.structs.HtlcBasepoint htlc_basepoint_arg) {
+               long ret = bindings.ChannelPublicKeys_new(InternalUtils.check_arr_len(funding_pubkey_arg, 33), revocation_basepoint_arg == null ? 0 : revocation_basepoint_arg.ptr, InternalUtils.check_arr_len(payment_point_arg, 33), delayed_payment_basepoint_arg == null ? 0 : delayed_payment_basepoint_arg.ptr, htlc_basepoint_arg == null ? 0 : htlc_basepoint_arg.ptr);
+               Reference.reachabilityFence(funding_pubkey_arg);
+               Reference.reachabilityFence(revocation_basepoint_arg);
+               Reference.reachabilityFence(payment_point_arg);
+               Reference.reachabilityFence(delayed_payment_basepoint_arg);
+               Reference.reachabilityFence(htlc_basepoint_arg);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelPublicKeys(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(revocation_basepoint_arg); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(delayed_payment_basepoint_arg); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(htlc_basepoint_arg); };
                return ret_hu_conv;
        }
 
+       long clone_ptr() {
+               long ret = bindings.ChannelPublicKeys_clone_ptr(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
+       }
+
        /**
         * Creates a copy of the ChannelPublicKeys
         */
        public ChannelPublicKeys clone() {
                long ret = bindings.ChannelPublicKeys_clone(this.ptr);
-               if (ret >= 0 && ret < 1024) { return null; }
-               ChannelPublicKeys ret_hu_conv = new ChannelPublicKeys(null, ret);
-               ret_hu_conv.ptrs_to.add(this);
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelPublicKeys(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
+       /**
+        * Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys.
+        */
+       public long hash() {
+               long ret = bindings.ChannelPublicKeys_hash(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
+       }
+
+       @Override public int hashCode() {
+               return (int)this.hash();
+       }
+       /**
+        * Checks if two ChannelPublicKeyss 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.ChannelPublicKeys b) {
+               boolean ret = bindings.ChannelPublicKeys_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 ChannelPublicKeys)) return false;
+               return this.eq((ChannelPublicKeys)o);
+       }
        /**
         * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
         */
        public byte[] write() {
                byte[] ret = bindings.ChannelPublicKeys_write(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -147,7 +220,8 @@ public class ChannelPublicKeys extends CommonBase {
         */
        public static Result_ChannelPublicKeysDecodeErrorZ read(byte[] ser) {
                long ret = bindings.ChannelPublicKeys_read(ser);
-               if (ret >= 0 && ret < 1024) { return null; }
+               Reference.reachabilityFence(ser);
+               if (ret >= 0 && ret <= 4096) { return null; }
                Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;
        }