X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FNodeId.java;h=b18198869c36351686441741a4cb67c473ab29c7;hb=ca313f2eee377bec222fa82b2939751fa9eab32e;hp=ead181e9124257f55dd2e263bb9e411fac4c8886;hpb=47341beaeecf907f422f126500baf586d54a0d41;p=ldk-java diff --git a/src/main/java/org/ldk/structs/NodeId.java b/src/main/java/org/ldk/structs/NodeId.java index ead181e9..b1819886 100644 --- a/src/main/java/org/ldk/structs/NodeId.java +++ b/src/main/java/org/ldk/structs/NodeId.java @@ -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,7 @@ 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; } @@ -60,7 +60,18 @@ public class NodeId extends CommonBase { } /** - * Checks if two NodeIds contain equal inner contents. + * 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);