[Java] Update auto-generated bindings to LDK 0.0.118
[ldk-java] / src / main / java / org / ldk / structs / CommitmentTransaction.java
index 70b0ab5a0c33e02f8f82c16380ad85e91ef4c3b8..9c1a693bbf068ad51b6fdcda730cc45928250838 100644 (file)
@@ -4,10 +4,12 @@ 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;
 
 
 /**
- * This class tracks the per-transaction information needed to build a commitment transaction and to
+ * This class tracks the per-transaction information needed to build a commitment transaction and will
  * actually build it and sign.  It is used for holder transactions that we sign only when needed
  * and for transactions we sign for the counterparty.
  * 
@@ -23,13 +25,21 @@ public class CommitmentTransaction extends CommonBase {
                if (ptr != 0) { bindings.CommitmentTransaction_free(ptr); }
        }
 
+       long clone_ptr() {
+               long ret = bindings.CommitmentTransaction_clone_ptr(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
+       }
+
        /**
         * Creates a copy of the CommitmentTransaction
         */
        public CommitmentTransaction clone() {
                long ret = bindings.CommitmentTransaction_clone(this.ptr);
-               CommitmentTransaction ret_hu_conv = new CommitmentTransaction(null, ret);
-               ret_hu_conv.ptrs_to.add(this);
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.CommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommitmentTransaction(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -38,14 +48,17 @@ public class CommitmentTransaction extends CommonBase {
         */
        public byte[] write() {
                byte[] ret = bindings.CommitmentTransaction_write(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
        /**
         * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
         */
-       public static Result_CommitmentTransactionDecodeErrorZ constructor_read(byte[] ser) {
+       public static Result_CommitmentTransactionDecodeErrorZ read(byte[] ser) {
                long ret = bindings.CommitmentTransaction_read(ser);
+               Reference.reachabilityFence(ser);
+               if (ret >= 0 && ret <= 4096) { return null; }
                Result_CommitmentTransactionDecodeErrorZ ret_hu_conv = Result_CommitmentTransactionDecodeErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;
        }
@@ -55,6 +68,16 @@ public class CommitmentTransaction extends CommonBase {
         */
        public long commitment_number() {
                long ret = bindings.CommitmentTransaction_commitment_number(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
+       }
+
+       /**
+        * The per commitment point used by the broadcaster.
+        */
+       public byte[] per_commitment_point() {
+               byte[] ret = bindings.CommitmentTransaction_per_commitment_point(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -63,6 +86,7 @@ public class CommitmentTransaction extends CommonBase {
         */
        public long to_broadcaster_value_sat() {
                long ret = bindings.CommitmentTransaction_to_broadcaster_value_sat(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -71,6 +95,7 @@ public class CommitmentTransaction extends CommonBase {
         */
        public long to_countersignatory_value_sat() {
                long ret = bindings.CommitmentTransaction_to_countersignatory_value_sat(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -79,6 +104,7 @@ public class CommitmentTransaction extends CommonBase {
         */
        public int feerate_per_kw() {
                int ret = bindings.CommitmentTransaction_feerate_per_kw(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -88,12 +114,14 @@ public class CommitmentTransaction extends CommonBase {
         * Applies a wrapper which allows access to these fields.
         * 
         * This should only be used if you fully trust the builder of this object.  It should not
-        * \tbe used by an external signer - instead use the verify function.
+        * be used by an external signer - instead use the verify function.
         */
        public TrustedCommitmentTransaction trust() {
                long ret = bindings.CommitmentTransaction_trust(this.ptr);
-               TrustedCommitmentTransaction ret_hu_conv = new TrustedCommitmentTransaction(null, ret);
-               ret_hu_conv.ptrs_to.add(this);
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.TrustedCommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TrustedCommitmentTransaction(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -105,12 +133,17 @@ public class CommitmentTransaction extends CommonBase {
         * An external validating signer must call this method before signing
         * or using the built transaction.
         */
-       public Result_TrustedCommitmentTransactionNoneZ verify(DirectedChannelTransactionParameters channel_parameters, ChannelPublicKeys broadcaster_keys, ChannelPublicKeys countersignatory_keys) {
-               long ret = bindings.CommitmentTransaction_verify(this.ptr, channel_parameters == null ? 0 : channel_parameters.ptr & ~1, broadcaster_keys == null ? 0 : broadcaster_keys.ptr & ~1, countersignatory_keys == null ? 0 : countersignatory_keys.ptr & ~1);
+       public Result_TrustedCommitmentTransactionNoneZ verify(org.ldk.structs.DirectedChannelTransactionParameters channel_parameters, org.ldk.structs.ChannelPublicKeys broadcaster_keys, org.ldk.structs.ChannelPublicKeys countersignatory_keys) {
+               long ret = bindings.CommitmentTransaction_verify(this.ptr, channel_parameters == null ? 0 : channel_parameters.ptr, broadcaster_keys == null ? 0 : broadcaster_keys.ptr, countersignatory_keys == null ? 0 : countersignatory_keys.ptr);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(channel_parameters);
+               Reference.reachabilityFence(broadcaster_keys);
+               Reference.reachabilityFence(countersignatory_keys);
+               if (ret >= 0 && ret <= 4096) { return null; }
                Result_TrustedCommitmentTransactionNoneZ ret_hu_conv = Result_TrustedCommitmentTransactionNoneZ.constr_from_ptr(ret);
-               this.ptrs_to.add(channel_parameters);
-               this.ptrs_to.add(broadcaster_keys);
-               this.ptrs_to.add(countersignatory_keys);
+               if (this != null) { this.ptrs_to.add(channel_parameters); };
+               if (this != null) { this.ptrs_to.add(broadcaster_keys); };
+               if (this != null) { this.ptrs_to.add(countersignatory_keys); };
                return ret_hu_conv;
        }