[Java] Update auto-generated Java bindings for 0.0.113
[ldk-java] / src / main / java / org / ldk / structs / ClosureReason.java
index 542c6ed7f52a6168bf5f8d43f556c06415ff75cf..2993d9340ab8148c86910e271543c7663426f25a 100644 (file)
@@ -122,8 +122,13 @@ public class ClosureReason extends CommonBase {
         * The peer disconnected prior to funding completing. In this case the spec mandates that we
         * forget the channel entirely - we can attempt again if the peer reconnects.
         * 
+        * This includes cases where we restarted prior to funding completion, including prior to the
+        * initial [`ChannelMonitor`] persistence completing.
+        * 
         * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
         * peer because of mutual incompatibility between us and our channel counterparty.
+        * 
+        * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
         */
        public final static class DisconnectedPeer extends ClosureReason {
                private DisconnectedPeer(long ptr, bindings.LDKClosureReason.DisconnectedPeer obj) {
@@ -131,8 +136,11 @@ public class ClosureReason extends CommonBase {
                }
        }
        /**
-        * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
-        * the ChannelManager deserialized.
+        * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than
+        * the [`ChannelManager`] deserialized.
+        * 
+        * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
+        * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
         */
        public final static class OutdatedChannelManager extends ClosureReason {
                private OutdatedChannelManager(long ptr, bindings.LDKClosureReason.OutdatedChannelManager obj) {
@@ -153,7 +161,7 @@ public class ClosureReason extends CommonBase {
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(this);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -165,7 +173,7 @@ public class ClosureReason extends CommonBase {
                Reference.reachabilityFence(peer_msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -176,7 +184,7 @@ public class ClosureReason extends CommonBase {
                long ret = bindings.ClosureReason_holder_force_closed();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -187,7 +195,7 @@ public class ClosureReason extends CommonBase {
                long ret = bindings.ClosureReason_cooperative_closure();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -198,7 +206,7 @@ public class ClosureReason extends CommonBase {
                long ret = bindings.ClosureReason_commitment_tx_confirmed();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -209,7 +217,7 @@ public class ClosureReason extends CommonBase {
                long ret = bindings.ClosureReason_funding_timed_out();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -221,7 +229,7 @@ public class ClosureReason extends CommonBase {
                Reference.reachabilityFence(err);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -232,7 +240,7 @@ public class ClosureReason extends CommonBase {
                long ret = bindings.ClosureReason_disconnected_peer();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -243,10 +251,25 @@ public class ClosureReason extends CommonBase {
                long ret = bindings.ClosureReason_outdated_channel_manager();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
+       /**
+        * Checks if two ClosureReasons contain equal inner contents.
+        * This ignores pointers and is_owned flags and looks at the values in fields.
+        */
+       public boolean eq(org.ldk.structs.ClosureReason b) {
+               boolean ret = bindings.ClosureReason_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 ClosureReason)) return false;
+               return this.eq((ClosureReason)o);
+       }
        /**
         * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
         */