X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FInit.java;h=6379382b67f7d7a80f7f0b780f97486633545014;hb=2bb592fb946e316dba9f4d1123f8ac72ff4e9bf8;hp=8b0122395437448924633fe2a1f531d95eed8109;hpb=5cdb34f643d09f21c147c9d0b2f8888609e43429;p=ldk-java diff --git a/src/main/java/org/ldk/structs/Init.java b/src/main/java/org/ldk/structs/Init.java index 8b012239..6379382b 100644 --- a/src/main/java/org/ldk/structs/Init.java +++ b/src/main/java/org/ldk/structs/Init.java @@ -44,6 +44,34 @@ public class Init extends CommonBase { if (this != null) { this.ptrs_to.add(val); }; } + /** + * Indicates chains the sender is interested in. + * + * If there are no common chains, the connection will be closed. + * + * Returns a copy of the field. + */ + public Option_CVec_ThirtyTwoBytesZZ get_networks() { + long ret = bindings.Init_get_networks(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ ret_hu_conv = org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Indicates chains the sender is interested in. + * + * If there are no common chains, the connection will be closed. + */ + public void set_networks(org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ val) { + bindings.Init_set_networks(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; + } + /** * The receipient's network address. * @@ -52,11 +80,11 @@ public class Init extends CommonBase { * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing * the new address. */ - public Option_NetAddressZ get_remote_network_address() { + public Option_SocketAddressZ get_remote_network_address() { long ret = bindings.Init_get_remote_network_address(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.Option_NetAddressZ ret_hu_conv = org.ldk.structs.Option_NetAddressZ.constr_from_ptr(ret); + org.ldk.structs.Option_SocketAddressZ ret_hu_conv = org.ldk.structs.Option_SocketAddressZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -69,7 +97,7 @@ public class Init extends CommonBase { * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing * the new address. */ - public void set_remote_network_address(org.ldk.structs.Option_NetAddressZ val) { + public void set_remote_network_address(org.ldk.structs.Option_SocketAddressZ val) { bindings.Init_set_remote_network_address(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); @@ -79,14 +107,16 @@ 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_NetAddressZ remote_network_address_arg) { - long ret = bindings.Init_new(features_arg == null ? 0 : features_arg.ptr, remote_network_address_arg.ptr); + 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); Reference.reachabilityFence(features_arg); + Reference.reachabilityFence(networks_arg); Reference.reachabilityFence(remote_network_address_arg); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Init ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Init(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(features_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(networks_arg); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(remote_network_address_arg); }; return ret_hu_conv; } @@ -109,6 +139,18 @@ 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.