[Java] Update auto-generated Java structs
[ldk-java] / src / main / java / org / ldk / structs / InMemorySigner.java
index 031985fff5f855f6ad745f7bf7a91d69ae42eade..bc90a526c662d02474ae0ebad051e241a3177fc4 100644 (file)
@@ -144,16 +144,17 @@ public class InMemorySigner extends CommonBase {
                long ret = bindings.InMemorySigner_clone(this.ptr);
                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);
+               org.ldk.structs.InMemorySigner ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InMemorySigner(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
        /**
         * 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(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));
+       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);
@@ -163,8 +164,8 @@ public class InMemorySigner extends CommonBase {
                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);
+               org.ldk.structs.InMemorySigner ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InMemorySigner(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -176,8 +177,8 @@ public class InMemorySigner extends CommonBase {
                long ret = bindings.InMemorySigner_counterparty_pubkeys(this.ptr);
                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);
+               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;
        }
 
@@ -223,8 +224,8 @@ public class InMemorySigner extends CommonBase {
                long ret = bindings.InMemorySigner_funding_outpoint(this.ptr);
                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);
+               org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -238,8 +239,8 @@ public class InMemorySigner extends CommonBase {
                long ret = bindings.InMemorySigner_get_channel_parameters(this.ptr);
                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);
+               org.ldk.structs.ChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTransactionParameters(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -258,17 +259,18 @@ 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,
-        * 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);
+               long ret = bindings.InMemorySigner_sign_counterparty_payment_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr);
                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);
+               if (this != null) { this.ptrs_to.add(descriptor); };
                return ret_hu_conv;
        }
 
@@ -277,18 +279,19 @@ 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);
+               long ret = bindings.InMemorySigner_sign_dynamic_p2wsh_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr);
                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);
+               if (this != null) { this.ptrs_to.add(descriptor); };
                return ret_hu_conv;
        }
 
@@ -301,7 +304,7 @@ public class InMemorySigner extends CommonBase {
                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);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -314,7 +317,7 @@ public class InMemorySigner extends CommonBase {
                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);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -330,9 +333,10 @@ public class InMemorySigner extends CommonBase {
        /**
         * Read a InMemorySigner from a byte array, created by InMemorySigner_write
         */
-       public static Result_InMemorySignerDecodeErrorZ read(byte[] ser) {
-               long ret = bindings.InMemorySigner_read(ser);
+       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;