X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FNodeId.java;h=a0074a6592c3f2841cf76b9b3983dd8d3df9c0e2;hb=f3e670e9341decac613d33fc52febf19cea32f20;hp=a878cb5aaa1fd7fbc440776d8801267f21930edf;hpb=db55d4ed1b9ee1b2712db1df0f9b0081a70e269b;p=ldk-java diff --git a/src/main/java/org/ldk/structs/NodeId.java b/src/main/java/org/ldk/structs/NodeId.java index a878cb5a..a0074a65 100644 --- a/src/main/java/org/ldk/structs/NodeId.java +++ b/src/main/java/org/ldk/structs/NodeId.java @@ -19,13 +19,18 @@ public class NodeId extends CommonBase { if (ptr != 0) { bindings.NodeId_free(ptr); } } + long clone_ptr() { + long ret = bindings.NodeId_clone_ptr(this.ptr); + return ret; + } + /** * Creates a copy of the NodeId */ public NodeId clone() { long ret = bindings.NodeId_clone(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - NodeId ret_hu_conv = new NodeId(null, ret); + if (ret >= 0 && ret <= 4096) { return null; } + NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeId(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -34,9 +39,9 @@ public class NodeId extends CommonBase { * Create a new NodeId from a public key */ public static NodeId from_pubkey(byte[] pubkey) { - long ret = bindings.NodeId_from_pubkey(pubkey); - if (ret >= 0 && ret < 1024) { return null; } - NodeId ret_hu_conv = new NodeId(null, ret); + long ret = bindings.NodeId_from_pubkey(InternalUtils.check_arr_len(pubkey, 33)); + if (ret >= 0 && ret <= 4096) { return null; } + NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeId(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -70,7 +75,7 @@ public class NodeId extends CommonBase { */ public static Result_NodeIdDecodeErrorZ read(byte[] ser) { long ret = bindings.NodeId_read(ser); - if (ret >= 0 && ret < 1024) { return null; } + if (ret >= 0 && ret <= 4096) { return null; } Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; }