[Java] Update auto-generated bindings to 0.0.105.0
[ldk-java] / src / main / java / org / ldk / structs / InMemorySigner.java
index 8b35588778fed62db46d878919443152eaf9de71..f166a47e173d7632c59643b0ca5c6433f402e1aa 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;
 
 
@@ -27,6 +28,7 @@ public class InMemorySigner extends CommonBase {
         */
        public byte[] get_funding_key() {
                byte[] ret = bindings.InMemorySigner_get_funding_key(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -34,7 +36,9 @@ public class InMemorySigner extends CommonBase {
         * Private key of anchor tx
         */
        public void set_funding_key(byte[] val) {
-               bindings.InMemorySigner_set_funding_key(this.ptr, val);
+               bindings.InMemorySigner_set_funding_key(this.ptr, InternalUtils.check_arr_len(val, 32));
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(val);
        }
 
        /**
@@ -42,6 +46,7 @@ public class InMemorySigner extends CommonBase {
         */
        public byte[] get_revocation_base_key() {
                byte[] ret = bindings.InMemorySigner_get_revocation_base_key(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -49,7 +54,9 @@ public class InMemorySigner extends CommonBase {
         * Holder secret key for blinded revocation pubkey
         */
        public void set_revocation_base_key(byte[] val) {
-               bindings.InMemorySigner_set_revocation_base_key(this.ptr, val);
+               bindings.InMemorySigner_set_revocation_base_key(this.ptr, InternalUtils.check_arr_len(val, 32));
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(val);
        }
 
        /**
@@ -57,6 +64,7 @@ public class InMemorySigner extends CommonBase {
         */
        public byte[] get_payment_key() {
                byte[] ret = bindings.InMemorySigner_get_payment_key(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -64,7 +72,9 @@ public class InMemorySigner extends CommonBase {
         * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
         */
        public void set_payment_key(byte[] val) {
-               bindings.InMemorySigner_set_payment_key(this.ptr, val);
+               bindings.InMemorySigner_set_payment_key(this.ptr, InternalUtils.check_arr_len(val, 32));
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(val);
        }
 
        /**
@@ -72,6 +82,7 @@ public class InMemorySigner extends CommonBase {
         */
        public byte[] get_delayed_payment_base_key() {
                byte[] ret = bindings.InMemorySigner_get_delayed_payment_base_key(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -79,7 +90,9 @@ public class InMemorySigner extends CommonBase {
         * Holder secret key used in HTLC tx
         */
        public void set_delayed_payment_base_key(byte[] val) {
-               bindings.InMemorySigner_set_delayed_payment_base_key(this.ptr, val);
+               bindings.InMemorySigner_set_delayed_payment_base_key(this.ptr, InternalUtils.check_arr_len(val, 32));
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(val);
        }
 
        /**
@@ -87,6 +100,7 @@ public class InMemorySigner extends CommonBase {
         */
        public byte[] get_htlc_base_key() {
                byte[] ret = bindings.InMemorySigner_get_htlc_base_key(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -94,7 +108,9 @@ public class InMemorySigner extends CommonBase {
         * Holder htlc secret key used in commitment tx htlc outputs
         */
        public void set_htlc_base_key(byte[] val) {
-               bindings.InMemorySigner_set_htlc_base_key(this.ptr, val);
+               bindings.InMemorySigner_set_htlc_base_key(this.ptr, InternalUtils.check_arr_len(val, 32));
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(val);
        }
 
        /**
@@ -102,6 +118,7 @@ public class InMemorySigner extends CommonBase {
         */
        public byte[] get_commitment_seed() {
                byte[] ret = bindings.InMemorySigner_get_commitment_seed(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -109,7 +126,15 @@ public class InMemorySigner extends CommonBase {
         * Commitment seed
         */
        public void set_commitment_seed(byte[] val) {
-               bindings.InMemorySigner_set_commitment_seed(this.ptr, val);
+               bindings.InMemorySigner_set_commitment_seed(this.ptr, InternalUtils.check_arr_len(val, 32));
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(val);
+       }
+
+       long clone_ptr() {
+               long ret = bindings.InMemorySigner_clone_ptr(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
        }
 
        /**
@@ -117,8 +142,9 @@ public class InMemorySigner extends CommonBase {
         */
        public InMemorySigner clone() {
                long ret = bindings.InMemorySigner_clone(this.ptr);
-               if (ret < 1024) { return null; }
-               InMemorySigner ret_hu_conv = new InMemorySigner(null, ret);
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               InMemorySigner ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InMemorySigner(null, ret); }
                ret_hu_conv.ptrs_to.add(this);
                return ret_hu_conv;
        }
@@ -126,10 +152,19 @@ public class InMemorySigner extends CommonBase {
        /**
         * Create a new InMemorySigner
         */
-       public static InMemorySigner of(byte[] funding_key, byte[] revocation_base_key, byte[] payment_key, byte[] delayed_payment_base_key, byte[] htlc_base_key, byte[] commitment_seed, long channel_value_satoshis, byte[] channel_keys_id) {
-               long ret = bindings.InMemorySigner_new(funding_key, revocation_base_key, payment_key, delayed_payment_base_key, htlc_base_key, commitment_seed, channel_value_satoshis, channel_keys_id);
-               if (ret < 1024) { return null; }
-               InMemorySigner ret_hu_conv = new InMemorySigner(null, ret);
+       public static InMemorySigner of(byte[] node_secret, byte[] funding_key, byte[] revocation_base_key, byte[] payment_key, byte[] delayed_payment_base_key, byte[] htlc_base_key, byte[] commitment_seed, long channel_value_satoshis, byte[] channel_keys_id) {
+               long ret = bindings.InMemorySigner_new(InternalUtils.check_arr_len(node_secret, 32), InternalUtils.check_arr_len(funding_key, 32), InternalUtils.check_arr_len(revocation_base_key, 32), InternalUtils.check_arr_len(payment_key, 32), InternalUtils.check_arr_len(delayed_payment_base_key, 32), InternalUtils.check_arr_len(htlc_base_key, 32), InternalUtils.check_arr_len(commitment_seed, 32), channel_value_satoshis, InternalUtils.check_arr_len(channel_keys_id, 32));
+               Reference.reachabilityFence(node_secret);
+               Reference.reachabilityFence(funding_key);
+               Reference.reachabilityFence(revocation_base_key);
+               Reference.reachabilityFence(payment_key);
+               Reference.reachabilityFence(delayed_payment_base_key);
+               Reference.reachabilityFence(htlc_base_key);
+               Reference.reachabilityFence(commitment_seed);
+               Reference.reachabilityFence(channel_value_satoshis);
+               Reference.reachabilityFence(channel_keys_id);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               InMemorySigner ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InMemorySigner(null, ret); }
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
                return ret_hu_conv;
        }
@@ -140,8 +175,9 @@ public class InMemorySigner extends CommonBase {
         */
        public ChannelPublicKeys counterparty_pubkeys() {
                long ret = bindings.InMemorySigner_counterparty_pubkeys(this.ptr);
-               if (ret < 1024) { return null; }
-               ChannelPublicKeys ret_hu_conv = new ChannelPublicKeys(null, ret);
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelPublicKeys(null, ret); }
                ret_hu_conv.ptrs_to.add(this);
                return ret_hu_conv;
        }
@@ -154,6 +190,7 @@ public class InMemorySigner extends CommonBase {
         */
        public short counterparty_selected_contest_delay() {
                short ret = bindings.InMemorySigner_counterparty_selected_contest_delay(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -165,6 +202,7 @@ public class InMemorySigner extends CommonBase {
         */
        public short holder_selected_contest_delay() {
                short ret = bindings.InMemorySigner_holder_selected_contest_delay(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -174,6 +212,7 @@ public class InMemorySigner extends CommonBase {
         */
        public boolean is_outbound() {
                boolean ret = bindings.InMemorySigner_is_outbound(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -183,8 +222,9 @@ public class InMemorySigner extends CommonBase {
         */
        public OutPoint funding_outpoint() {
                long ret = bindings.InMemorySigner_funding_outpoint(this.ptr);
-               if (ret < 1024) { return null; }
-               OutPoint ret_hu_conv = new OutPoint(null, ret);
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OutPoint(null, ret); }
                ret_hu_conv.ptrs_to.add(this);
                return ret_hu_conv;
        }
@@ -197,22 +237,38 @@ public class InMemorySigner extends CommonBase {
         */
        public ChannelTransactionParameters get_channel_parameters() {
                long ret = bindings.InMemorySigner_get_channel_parameters(this.ptr);
-               if (ret < 1024) { return null; }
-               ChannelTransactionParameters ret_hu_conv = new ChannelTransactionParameters(null, ret);
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               ChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelTransactionParameters(null, ret); }
                ret_hu_conv.ptrs_to.add(this);
                return ret_hu_conv;
        }
 
+       /**
+        * Whether anchors should be used.
+        * Will panic if ready_channel wasn't called.
+        */
+       public boolean opt_anchors() {
+               boolean ret = bindings.InMemorySigner_opt_anchors(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
+       }
+
        /**
         * Sign the single input of spend_tx at index `input_idx` which spends the output
         * described by descriptor, returning the witness stack for the input.
         * 
         * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
-        * or is not spending the outpoint described by `descriptor.outpoint`.
+        * is not spending the outpoint described by `descriptor.outpoint`,
+        * or if an output descriptor script_pubkey does not match the one we can spend.
         */
        public Result_CVec_CVec_u8ZZNoneZ sign_counterparty_payment_input(byte[] spend_tx, long input_idx, StaticPaymentOutputDescriptor descriptor) {
                long ret = bindings.InMemorySigner_sign_counterparty_payment_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr & ~1);
-               if (ret < 1024) { return null; }
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(spend_tx);
+               Reference.reachabilityFence(input_idx);
+               Reference.reachabilityFence(descriptor);
+               if (ret >= 0 && ret <= 4096) { return null; }
                Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret);
                this.ptrs_to.add(descriptor);
                return ret_hu_conv;
@@ -223,12 +279,17 @@ public class InMemorySigner extends CommonBase {
         * described by descriptor, returning the witness stack for the input.
         * 
         * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
-        * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
-        * sequence set to `descriptor.to_self_delay`.
+        * is not spending the outpoint described by `descriptor.outpoint`, does not have a
+        * sequence set to `descriptor.to_self_delay`, or if an output descriptor
+        * script_pubkey does not match the one we can spend.
         */
        public Result_CVec_CVec_u8ZZNoneZ sign_dynamic_p2wsh_input(byte[] spend_tx, long input_idx, DelayedPaymentOutputDescriptor descriptor) {
                long ret = bindings.InMemorySigner_sign_dynamic_p2wsh_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr & ~1);
-               if (ret < 1024) { return null; }
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(spend_tx);
+               Reference.reachabilityFence(input_idx);
+               Reference.reachabilityFence(descriptor);
+               if (ret >= 0 && ret <= 4096) { return null; }
                Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret);
                this.ptrs_to.add(descriptor);
                return ret_hu_conv;
@@ -240,7 +301,8 @@ public class InMemorySigner extends CommonBase {
         */
        public BaseSign as_BaseSign() {
                long ret = bindings.InMemorySigner_as_BaseSign(this.ptr);
-               if (ret < 1024) { return null; }
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
                BaseSign ret_hu_conv = new BaseSign(null, ret);
                ret_hu_conv.ptrs_to.add(this);
                return ret_hu_conv;
@@ -252,7 +314,8 @@ public class InMemorySigner extends CommonBase {
         */
        public Sign as_Sign() {
                long ret = bindings.InMemorySigner_as_Sign(this.ptr);
-               if (ret < 1024) { return null; }
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
                Sign ret_hu_conv = new Sign(null, ret);
                ret_hu_conv.ptrs_to.add(this);
                return ret_hu_conv;
@@ -263,15 +326,18 @@ public class InMemorySigner extends CommonBase {
         */
        public byte[] write() {
                byte[] ret = bindings.InMemorySigner_write(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
        /**
         * Read a InMemorySigner from a byte array, created by InMemorySigner_write
         */
-       public static Result_InMemorySignerDecodeErrorZ read(byte[] ser) {
-               long ret = bindings.InMemorySigner_read(ser);
-               if (ret < 1024) { return null; }
+       public static Result_InMemorySignerDecodeErrorZ read(byte[] ser, byte[] arg) {
+               long ret = bindings.InMemorySigner_read(ser, InternalUtils.check_arr_len(arg, 32));
+               Reference.reachabilityFence(ser);
+               Reference.reachabilityFence(arg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                Result_InMemorySignerDecodeErrorZ ret_hu_conv = Result_InMemorySignerDecodeErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;
        }