X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FDestination.java;h=dd4febe4e96bc1f482c4973decfc424296f97fa6;hb=ffdd56c967087cba7548599934585b8a9a3102e2;hp=e41c822339197c9a9f2bf65780ae2d641935ea68;hpb=7b75443b8305c6a24d3c08520e1785e9d39960e4;p=ldk-java diff --git a/src/main/java/org/ldk/structs/Destination.java b/src/main/java/org/ldk/structs/Destination.java index e41c8223..dd4febe4 100644 --- a/src/main/java/org/ldk/structs/Destination.java +++ b/src/main/java/org/ldk/structs/Destination.java @@ -87,7 +87,7 @@ public class Destination extends CommonBase { * Utility method to constructs a new BlindedPath-variant Destination */ public static Destination blinded_path(org.ldk.structs.BlindedPath a) { - long ret = bindings.Destination_blinded_path(a == null ? 0 : a.ptr); + long ret = bindings.Destination_blinded_path(a.ptr); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Destination ret_hu_conv = org.ldk.structs.Destination.constr_from_ptr(ret); @@ -96,4 +96,43 @@ public class Destination extends CommonBase { return ret_hu_conv; } + /** + * Generates a non-cryptographic 64-bit hash of the Destination. + */ + public long hash() { + long ret = bindings.Destination_hash(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + @Override public int hashCode() { + return (int)this.hash(); + } + /** + * Checks if two Destinations contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ + public boolean eq(org.ldk.structs.Destination b) { + boolean ret = bindings.Destination_eq(this.ptr, b.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); + return ret; + } + + @Override public boolean equals(Object o) { + if (!(o instanceof Destination)) return false; + return this.eq((Destination)o); + } + /** + * Attempts to resolve the [`IntroductionNode::DirectedShortChannelId`] of a + * [`Destination::BlindedPath`] to a [`IntroductionNode::NodeId`], if applicable, using the + * provided [`ReadOnlyNetworkGraph`]. + */ + public void resolve(org.ldk.structs.ReadOnlyNetworkGraph network_graph) { + bindings.Destination_resolve(this.ptr, network_graph.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(network_graph); + if (this != null) { this.ptrs_to.add(network_graph); }; + } + }