Merge pull request #123 from tnull/patch-1
[ldk-java] / src / main / java / org / ldk / structs / ChannelReestablish.java
index b5492388765614a0c92ba3c89ffb2daf99ed3a47..ae89ef232ed0cbd78edeff47327a260246e9961b 100644 (file)
@@ -88,10 +88,27 @@ public class ChannelReestablish extends CommonBase {
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ChannelReestablish ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReestablish(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;
        }
 
+       /**
+        * Checks if two ChannelReestablishs 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(ChannelReestablish b) {
+               boolean ret = bindings.ChannelReestablish_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 ChannelReestablish)) return false;
+               return this.eq((ChannelReestablish)o);
+       }
        /**
         * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
         */