]> git.bitcoin.ninja Git - ldk-java/blobdiff - src/main/java/org/ldk/structs/NetworkUpdate.java
Update CI references to LDK 0.0.124 drop stale memchr pins
[ldk-java] / src / main / java / org / ldk / structs / NetworkUpdate.java
index 8dff959e53063cbd0ceff0eb959c63a38a42aaef..f57803dbfbcafd4c25118620df25e40b6ed0ede2 100644 (file)
@@ -24,9 +24,6 @@ public class NetworkUpdate extends CommonBase {
        }
        static NetworkUpdate constr_from_ptr(long ptr) {
                bindings.LDKNetworkUpdate raw_val = bindings.LDKNetworkUpdate_ref_from_ptr(ptr);
-               if (raw_val.getClass() == bindings.LDKNetworkUpdate.ChannelUpdateMessage.class) {
-                       return new ChannelUpdateMessage(ptr, (bindings.LDKNetworkUpdate.ChannelUpdateMessage)raw_val);
-               }
                if (raw_val.getClass() == bindings.LDKNetworkUpdate.ChannelFailure.class) {
                        return new ChannelFailure(ptr, (bindings.LDKNetworkUpdate.ChannelFailure)raw_val);
                }
@@ -36,26 +33,9 @@ public class NetworkUpdate extends CommonBase {
                assert false; return null; // Unreachable without extending the (internal) bindings interface
        }
 
-       /**
-        * An error indicating a `channel_update` messages should be applied via
-        * [`NetworkGraph::update_channel`].
-        */
-       public final static class ChannelUpdateMessage extends NetworkUpdate {
-               /**
-                * The update to apply via [`NetworkGraph::update_channel`].
-               */
-               public final org.ldk.structs.ChannelUpdate msg;
-               private ChannelUpdateMessage(long ptr, bindings.LDKNetworkUpdate.ChannelUpdateMessage obj) {
-                       super(null, ptr);
-                       long msg = obj.msg;
-                       org.ldk.structs.ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelUpdate(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
-                       this.msg = msg_hu_conv;
-               }
-       }
        /**
         * An error indicating that a channel failed to route a payment, which should be applied via
-        * [`NetworkGraph::channel_failed`].
+        * [`NetworkGraph::channel_failed_permanent`] if permanent.
         */
        public final static class ChannelFailure extends NetworkUpdate {
                /**
@@ -75,7 +55,7 @@ public class NetworkUpdate extends CommonBase {
        }
        /**
         * An error indicating that a node failed to route a payment, which should be applied via
-        * [`NetworkGraph::node_failed`].
+        * [`NetworkGraph::node_failed_permanent`] if permanent.
         */
        public final static class NodeFailure extends NetworkUpdate {
                /**
@@ -107,19 +87,7 @@ public class NetworkUpdate extends CommonBase {
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.NetworkUpdate ret_hu_conv = org.ldk.structs.NetworkUpdate.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(this);
-               return ret_hu_conv;
-       }
-
-       /**
-        * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
-        */
-       public static NetworkUpdate channel_update_message(ChannelUpdate msg) {
-               long ret = bindings.NetworkUpdate_channel_update_message(msg == null ? 0 : msg.ptr & ~1);
-               Reference.reachabilityFence(msg);
-               if (ret >= 0 && ret <= 4096) { return null; }
-               org.ldk.structs.NetworkUpdate ret_hu_conv = org.ldk.structs.NetworkUpdate.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -132,7 +100,7 @@ public class NetworkUpdate extends CommonBase {
                Reference.reachabilityFence(is_permanent);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.NetworkUpdate ret_hu_conv = org.ldk.structs.NetworkUpdate.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;
        }
 
@@ -145,10 +113,25 @@ public class NetworkUpdate extends CommonBase {
                Reference.reachabilityFence(is_permanent);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.NetworkUpdate ret_hu_conv = org.ldk.structs.NetworkUpdate.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 NetworkUpdates contain equal inner contents.
+        * This ignores pointers and is_owned flags and looks at the values in fields.
+        */
+       public boolean eq(org.ldk.structs.NetworkUpdate b) {
+               boolean ret = bindings.NetworkUpdate_eq(this.ptr, b.ptr);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(b);
+               return ret;
+       }
+
+       @Override public boolean equals(Object o) {
+               if (!(o instanceof NetworkUpdate)) return false;
+               return this.eq((NetworkUpdate)o);
+       }
        /**
         * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
         */