[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / Init.cs
index d4d1fe3862776e6736ec5ae4f599bcc5d8529aca..bc5f9ca63695233f29939b51e81106feee9c533d 100644 (file)
@@ -7,7 +7,9 @@ namespace org { namespace ldk { namespace structs {
 
 
 /**
- * An init message to be sent or received from a peer
+ * An [`init`] message to be sent to or received from a peer.
+ * 
+ * [`init`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-init-message
  */
 public class Init : CommonBase {
        internal Init(object _dummy, long ptr) : base(ptr) { }
@@ -16,7 +18,7 @@ public class Init : CommonBase {
        }
 
        /**
-        * The relevant features which the sender supports
+        * The relevant features which the sender supports.
         */
        public InitFeatures get_features() {
                long ret = bindings.Init_get_features(this.ptr);
@@ -28,7 +30,7 @@ public class Init : CommonBase {
        }
 
        /**
-        * The relevant features which the sender supports
+        * 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);
@@ -38,43 +40,79 @@ public class Init : CommonBase {
        }
 
        /**
-        * The receipient's network address. This adds the option to report a remote IP address
-        * back to a connecting peer using the init message. A node can decide to use that information
-        * to discover a potential update to its public IPv4 address (NAT) and use
-        * that for a node_announcement update message containing the new address.
+        * 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_NetAddressZ get_remote_network_address() {
+       public Option_CVec_ThirtyTwoBytesZZ get_networks() {
+               long ret = bindings.Init_get_networks(this.ptr);
+               GC.KeepAlive(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.AddLast(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);
+               GC.KeepAlive(this);
+               GC.KeepAlive(val);
+               if (this != null) { this.ptrs_to.AddLast(val); };
+       }
+
+       /**
+        * The receipient's network address.
+        * 
+        * This adds the option to report a remote IP address back to a connecting peer using the init
+        * message. A node can decide to use that information to discover a potential update to its
+        * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing
+        * the new address.
+        */
+       public Option_SocketAddressZ get_remote_network_address() {
                long ret = bindings.Init_get_remote_network_address(this.ptr);
                GC.KeepAlive(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.AddLast(this); };
                return ret_hu_conv;
        }
 
        /**
-        * The receipient's network address. This adds the option to report a remote IP address
-        * back to a connecting peer using the init message. A node can decide to use that information
-        * to discover a potential update to its public IPv4 address (NAT) and use
-        * that for a node_announcement update message containing the new address.
+        * The receipient's network address.
+        * 
+        * This adds the option to report a remote IP address back to a connecting peer using the init
+        * message. A node can decide to use that information to discover a potential update to its
+        * 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);
                GC.KeepAlive(this);
                GC.KeepAlive(val);
+               if (this != null) { this.ptrs_to.AddLast(val); };
        }
 
        /**
         * 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);
                GC.KeepAlive(features_arg);
+               GC.KeepAlive(networks_arg);
                GC.KeepAlive(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.AddLast(ret_hu_conv); };
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(features_arg); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(networks_arg); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(remote_network_address_arg); };
                return ret_hu_conv;
        }
 
@@ -96,6 +134,18 @@ public class Init : 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);
+               GC.KeepAlive(this);
+               return ret;
+       }
+
+       public override int GetHashCode() {
+               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.
@@ -117,16 +167,18 @@ public class Init : CommonBase {
         * Serialize the Init object into a byte array which can be read by Init_read
         */
        public byte[] write() {
-               byte[] ret = bindings.Init_write(this.ptr);
+               long ret = bindings.Init_write(this.ptr);
                GC.KeepAlive(this);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * Read a Init from a byte array, created by Init_write
         */
        public static Result_InitDecodeErrorZ read(byte[] ser) {
-               long ret = bindings.Init_read(ser);
+               long ret = bindings.Init_read(InternalUtils.encodeUint8Array(ser));
                GC.KeepAlive(ser);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_InitDecodeErrorZ ret_hu_conv = Result_InitDecodeErrorZ.constr_from_ptr(ret);