[Java] Update auto-generated Java bindings
[ldk-java] / src / main / java / org / ldk / structs / SpendableOutputDescriptor.java
index 34ff18ac1ec03dc60d5a8e10d9d5b42a0823af8e..e2cf0b2ffbe6163a75e4b40885a265adffb1f4c5 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;
 
 
@@ -47,16 +48,16 @@ public class SpendableOutputDescriptor extends CommonBase {
                /**
                 * The outpoint which is spendable
                */
-               public final OutPoint outpoint;
+               public final org.ldk.structs.OutPoint outpoint;
                /**
                 * The output which is referenced by the given outpoint.
                */
-               public final TxOut output;
+               public final org.ldk.structs.TxOut output;
                private StaticOutput(long ptr, bindings.LDKSpendableOutputDescriptor.StaticOutput obj) {
                        super(null, ptr);
                        long outpoint = obj.outpoint;
-                       OutPoint outpoint_hu_conv = null; if (outpoint < 0 || outpoint > 4096) { outpoint_hu_conv = new OutPoint(null, outpoint); }
-                       outpoint_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.OutPoint outpoint_hu_conv = null; if (outpoint < 0 || outpoint > 4096) { outpoint_hu_conv = new org.ldk.structs.OutPoint(null, outpoint); }
+                       if (outpoint_hu_conv != null) { outpoint_hu_conv.ptrs_to.add(this); };
                        this.outpoint = outpoint_hu_conv;
                        long output = obj.output;
                        TxOut output_conv = new TxOut(null, output);
@@ -94,12 +95,12 @@ public class SpendableOutputDescriptor extends CommonBase {
         * chan_utils::get_revokeable_redeemscript.
         */
        public final static class DelayedPaymentOutput extends SpendableOutputDescriptor {
-               public final DelayedPaymentOutputDescriptor delayed_payment_output;
+               public final org.ldk.structs.DelayedPaymentOutputDescriptor delayed_payment_output;
                private DelayedPaymentOutput(long ptr, bindings.LDKSpendableOutputDescriptor.DelayedPaymentOutput obj) {
                        super(null, ptr);
                        long delayed_payment_output = obj.delayed_payment_output;
-                       DelayedPaymentOutputDescriptor delayed_payment_output_hu_conv = null; if (delayed_payment_output < 0 || delayed_payment_output > 4096) { delayed_payment_output_hu_conv = new DelayedPaymentOutputDescriptor(null, delayed_payment_output); }
-                       delayed_payment_output_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.DelayedPaymentOutputDescriptor delayed_payment_output_hu_conv = null; if (delayed_payment_output < 0 || delayed_payment_output > 4096) { delayed_payment_output_hu_conv = new org.ldk.structs.DelayedPaymentOutputDescriptor(null, delayed_payment_output); }
+                       if (delayed_payment_output_hu_conv != null) { delayed_payment_output_hu_conv.ptrs_to.add(this); };
                        this.delayed_payment_output = delayed_payment_output_hu_conv;
                }
        }
@@ -113,17 +114,18 @@ public class SpendableOutputDescriptor extends CommonBase {
         * allowing us to claim the non-HTLC-encumbered outputs immediately.
         */
        public final static class StaticPaymentOutput extends SpendableOutputDescriptor {
-               public final StaticPaymentOutputDescriptor static_payment_output;
+               public final org.ldk.structs.StaticPaymentOutputDescriptor static_payment_output;
                private StaticPaymentOutput(long ptr, bindings.LDKSpendableOutputDescriptor.StaticPaymentOutput obj) {
                        super(null, ptr);
                        long static_payment_output = obj.static_payment_output;
-                       StaticPaymentOutputDescriptor static_payment_output_hu_conv = null; if (static_payment_output < 0 || static_payment_output > 4096) { static_payment_output_hu_conv = new StaticPaymentOutputDescriptor(null, static_payment_output); }
-                       static_payment_output_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.StaticPaymentOutputDescriptor static_payment_output_hu_conv = null; if (static_payment_output < 0 || static_payment_output > 4096) { static_payment_output_hu_conv = new org.ldk.structs.StaticPaymentOutputDescriptor(null, static_payment_output); }
+                       if (static_payment_output_hu_conv != null) { static_payment_output_hu_conv.ptrs_to.add(this); };
                        this.static_payment_output = static_payment_output_hu_conv;
                }
        }
        long clone_ptr() {
                long ret = bindings.SpendableOutputDescriptor_clone_ptr(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -132,9 +134,10 @@ public class SpendableOutputDescriptor extends CommonBase {
         */
        public SpendableOutputDescriptor clone() {
                long ret = bindings.SpendableOutputDescriptor_clone(this.ptr);
+               Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(this);
+               org.ldk.structs.SpendableOutputDescriptor ret_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -142,10 +145,13 @@ public class SpendableOutputDescriptor extends CommonBase {
         * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
         */
        public static SpendableOutputDescriptor static_output(OutPoint outpoint, TxOut output) {
-               long ret = bindings.SpendableOutputDescriptor_static_output(outpoint == null ? 0 : outpoint.ptr & ~1, output.ptr);
+               long ret = bindings.SpendableOutputDescriptor_static_output(outpoint == null ? 0 : outpoint.ptr, output.ptr);
+               Reference.reachabilityFence(outpoint);
+               Reference.reachabilityFence(output);
                if (ret >= 0 && ret <= 4096) { return null; }
-               SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               org.ldk.structs.SpendableOutputDescriptor ret_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(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(outpoint); };
                return ret_hu_conv;
        }
 
@@ -153,10 +159,12 @@ public class SpendableOutputDescriptor extends CommonBase {
         * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
         */
        public static SpendableOutputDescriptor delayed_payment_output(DelayedPaymentOutputDescriptor a) {
-               long ret = bindings.SpendableOutputDescriptor_delayed_payment_output(a == null ? 0 : a.ptr & ~1);
+               long ret = bindings.SpendableOutputDescriptor_delayed_payment_output(a == null ? 0 : a.ptr);
+               Reference.reachabilityFence(a);
                if (ret >= 0 && ret <= 4096) { return null; }
-               SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               org.ldk.structs.SpendableOutputDescriptor ret_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(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(a); };
                return ret_hu_conv;
        }
 
@@ -164,18 +172,36 @@ public class SpendableOutputDescriptor extends CommonBase {
         * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
         */
        public static SpendableOutputDescriptor static_payment_output(StaticPaymentOutputDescriptor a) {
-               long ret = bindings.SpendableOutputDescriptor_static_payment_output(a == null ? 0 : a.ptr & ~1);
+               long ret = bindings.SpendableOutputDescriptor_static_payment_output(a == null ? 0 : a.ptr);
+               Reference.reachabilityFence(a);
                if (ret >= 0 && ret <= 4096) { return null; }
-               SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               org.ldk.structs.SpendableOutputDescriptor ret_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(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(a); };
                return ret_hu_conv;
        }
 
+       /**
+        * Checks if two SpendableOutputDescriptors contain equal inner contents.
+        * This ignores pointers and is_owned flags and looks at the values in fields.
+        */
+       public boolean eq(SpendableOutputDescriptor b) {
+               boolean ret = bindings.SpendableOutputDescriptor_eq(this.ptr, b == null ? 0 : b.ptr);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(b);
+               return ret;
+       }
+
+       @Override public boolean equals(Object o) {
+               if (!(o instanceof SpendableOutputDescriptor)) return false;
+               return this.eq((SpendableOutputDescriptor)o);
+       }
        /**
         * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
         */
        public byte[] write() {
                byte[] ret = bindings.SpendableOutputDescriptor_write(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -184,6 +210,7 @@ public class SpendableOutputDescriptor extends CommonBase {
         */
        public static Result_SpendableOutputDescriptorDecodeErrorZ read(byte[] ser) {
                long ret = bindings.SpendableOutputDescriptor_read(ser);
+               Reference.reachabilityFence(ser);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_SpendableOutputDescriptorDecodeErrorZ ret_hu_conv = Result_SpendableOutputDescriptorDecodeErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;