X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FPositiveTimestamp.java;h=03b0cbd1a08ed8865ecec8d2e3fd59c543b2e0bb;hb=890e35a4387758c0447aab34166caa579bbf3a08;hp=6e7d7add7aeef8185516785cf75f5cf1573c076e;hpb=9760d533f7ecac9bb7a8249f9b557e3f995c276d;p=ldk-java diff --git a/src/main/java/org/ldk/structs/PositiveTimestamp.java b/src/main/java/org/ldk/structs/PositiveTimestamp.java index 6e7d7add..03b0cbd1 100644 --- a/src/main/java/org/ldk/structs/PositiveTimestamp.java +++ b/src/main/java/org/ldk/structs/PositiveTimestamp.java @@ -34,7 +34,7 @@ public class PositiveTimestamp extends CommonBase { boolean ret = bindings.PositiveTimestamp_eq(this.ptr, b == null ? 0 : b.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(b); - this.ptrs_to.add(b); + if (this != null) { this.ptrs_to.add(b); }; return ret; } @@ -56,10 +56,22 @@ public class PositiveTimestamp extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.PositiveTimestamp ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PositiveTimestamp(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; } + /** + * Checks if two PositiveTimestamps contain equal inner contents. + */ + public long hash() { + long ret = bindings.PositiveTimestamp_hash(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + @Override public int hashCode() { + return (int)this.hash(); + } /** * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`. *