[Java] Update auto-generated bindings to LDK 0.0.123
[ldk-java] / src / main / java / org / ldk / structs / NodeId.java
index ead181e9124257f55dd2e263bb9e411fac4c8886..73e903f9e0a603b93b4cfd3e8de9bfce59aef231 100644 (file)
@@ -34,7 +34,7 @@ public class NodeId extends CommonBase {
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(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;
        }
 
@@ -46,7 +46,18 @@ public class NodeId extends CommonBase {
                Reference.reachabilityFence(pubkey);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, 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;
+       }
+
+       /**
+        * Create a new NodeId from a slice of bytes
+        */
+       public static Result_NodeIdDecodeErrorZ from_slice(byte[] bytes) {
+               long ret = bindings.NodeId_from_slice(bytes);
+               Reference.reachabilityFence(bytes);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;
        }
 
@@ -60,7 +71,27 @@ public class NodeId extends CommonBase {
        }
 
        /**
-        * Checks if two NodeIds contain equal inner contents.
+        * Get the public key as an array from this NodeId
+        */
+       public byte[] as_array() {
+               byte[] ret = bindings.NodeId_as_array(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
+       }
+
+       /**
+        * Get the public key from this NodeId
+        */
+       public Result_PublicKeySecp256k1ErrorZ as_pubkey() {
+               long ret = bindings.NodeId_as_pubkey(this.ptr);
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_PublicKeySecp256k1ErrorZ ret_hu_conv = Result_PublicKeySecp256k1ErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Generates a non-cryptographic 64-bit hash of the NodeId.
         */
        public long hash() {
                long ret = bindings.NodeId_hash(this.ptr);