X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FInit.java;h=b2abc86da74967c85584c66b8999cb641aebcf19;hb=HEAD;hp=da5281f593082ddd13e6f0597bff71acec3a63c3;hpb=7811d2191440c55034e1abfbf3be442d4b25481b;p=ldk-java diff --git a/src/main/java/org/ldk/structs/Init.java b/src/main/java/org/ldk/structs/Init.java index da5281f5..b2abc86d 100644 --- a/src/main/java/org/ldk/structs/Init.java +++ b/src/main/java/org/ldk/structs/Init.java @@ -38,7 +38,7 @@ public class Init extends CommonBase { * The relevant features which the sender supports. */ public void set_features(org.ldk.structs.InitFeatures val) { - bindings.Init_set_features(this.ptr, val == null ? 0 : val.ptr); + bindings.Init_set_features(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); if (this != null) { this.ptrs_to.add(val); }; @@ -108,7 +108,7 @@ public class Init extends CommonBase { * Constructs a new Init given each field */ public static Init of(org.ldk.structs.InitFeatures features_arg, org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ networks_arg, org.ldk.structs.Option_SocketAddressZ remote_network_address_arg) { - long ret = bindings.Init_new(features_arg == null ? 0 : features_arg.ptr, networks_arg.ptr, remote_network_address_arg.ptr); + long ret = bindings.Init_new(features_arg.ptr, networks_arg.ptr, remote_network_address_arg.ptr); Reference.reachabilityFence(features_arg); Reference.reachabilityFence(networks_arg); Reference.reachabilityFence(remote_network_address_arg); @@ -139,13 +139,25 @@ public class Init extends CommonBase { return ret_hu_conv; } + /** + * Generates a non-cryptographic 64-bit hash of the Init. + */ + public long hash() { + long ret = bindings.Init_hash(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + @Override public int hashCode() { + return (int)this.hash(); + } /** * Checks if two Inits contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ public boolean eq(org.ldk.structs.Init b) { - boolean ret = bindings.Init_eq(this.ptr, b == null ? 0 : b.ptr); + boolean ret = bindings.Init_eq(this.ptr, b.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(b); if (this != null) { this.ptrs_to.add(b); };