6 namespace org { namespace ldk { namespace structs {
10 * A [`channel_ready`] message to be sent to or received from a peer.
12 * [`channel_ready`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-channel_ready-message
14 public class ChannelReady : CommonBase {
15 internal ChannelReady(object _dummy, long ptr) : base(ptr) { }
17 if (ptr != 0) { bindings.ChannelReady_free(ptr); }
23 public ChannelId get_channel_id() {
24 long ret = bindings.ChannelReady_get_channel_id(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
28 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
35 public void set_channel_id(org.ldk.structs.ChannelId val) {
36 bindings.ChannelReady_set_channel_id(this.ptr, val.ptr);
39 if (this != null) { this.ptrs_to.AddLast(val); };
43 * The per-commitment point of the second commitment transaction
45 public byte[] get_next_per_commitment_point() {
46 long ret = bindings.ChannelReady_get_next_per_commitment_point(this.ptr);
48 if (ret >= 0 && ret <= 4096) { return null; }
49 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
54 * The per-commitment point of the second commitment transaction
56 public void set_next_per_commitment_point(byte[] val) {
57 bindings.ChannelReady_set_next_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
63 * If set, provides a `short_channel_id` alias for this channel.
65 * The sender will accept payments to be forwarded over this SCID and forward them to this
66 * messages' recipient.
68 public Option_u64Z get_short_channel_id_alias() {
69 long ret = bindings.ChannelReady_get_short_channel_id_alias(this.ptr);
71 if (ret >= 0 && ret <= 4096) { return null; }
72 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
73 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
78 * If set, provides a `short_channel_id` alias for this channel.
80 * The sender will accept payments to be forwarded over this SCID and forward them to this
81 * messages' recipient.
83 public void set_short_channel_id_alias(org.ldk.structs.Option_u64Z val) {
84 bindings.ChannelReady_set_short_channel_id_alias(this.ptr, val.ptr);
87 if (this != null) { this.ptrs_to.AddLast(val); };
91 * Constructs a new ChannelReady given each field
93 public static ChannelReady of(org.ldk.structs.ChannelId channel_id_arg, byte[] next_per_commitment_point_arg, org.ldk.structs.Option_u64Z short_channel_id_alias_arg) {
94 long ret = bindings.ChannelReady_new(channel_id_arg.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(next_per_commitment_point_arg, 33)), short_channel_id_alias_arg.ptr);
95 GC.KeepAlive(channel_id_arg);
96 GC.KeepAlive(next_per_commitment_point_arg);
97 GC.KeepAlive(short_channel_id_alias_arg);
98 if (ret >= 0 && ret <= 4096) { return null; }
99 org.ldk.structs.ChannelReady ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReady(null, ret); }
100 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
101 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id_arg); };
102 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(short_channel_id_alias_arg); };
106 internal long clone_ptr() {
107 long ret = bindings.ChannelReady_clone_ptr(this.ptr);
113 * Creates a copy of the ChannelReady
115 public ChannelReady clone() {
116 long ret = bindings.ChannelReady_clone(this.ptr);
118 if (ret >= 0 && ret <= 4096) { return null; }
119 org.ldk.structs.ChannelReady ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReady(null, ret); }
120 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
125 * Generates a non-cryptographic 64-bit hash of the ChannelReady.
128 long ret = bindings.ChannelReady_hash(this.ptr);
133 public override int GetHashCode() {
134 return (int)this.hash();
137 * Checks if two ChannelReadys contain equal inner contents.
138 * This ignores pointers and is_owned flags and looks at the values in fields.
139 * Two objects with NULL inner values will be considered "equal" here.
141 public bool eq(org.ldk.structs.ChannelReady b) {
142 bool ret = bindings.ChannelReady_eq(this.ptr, b.ptr);
145 if (this != null) { this.ptrs_to.AddLast(b); };
149 public override bool Equals(object o) {
150 if (!(o is ChannelReady)) return false;
151 return this.eq((ChannelReady)o);
154 * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
156 public byte[] write() {
157 long ret = bindings.ChannelReady_write(this.ptr);
159 if (ret >= 0 && ret <= 4096) { return null; }
160 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
165 * Read a ChannelReady from a byte array, created by ChannelReady_write
167 public static Result_ChannelReadyDecodeErrorZ read(byte[] ser) {
168 long ret = bindings.ChannelReady_read(InternalUtils.encodeUint8Array(ser));
170 if (ret >= 0 && ret <= 4096) { return null; }
171 Result_ChannelReadyDecodeErrorZ ret_hu_conv = Result_ChannelReadyDecodeErrorZ.constr_from_ptr(ret);