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 byte[] get_channel_id() {
24 byte[] ret = bindings.ChannelReady_get_channel_id(this.ptr);
32 public void set_channel_id(byte[] val) {
33 bindings.ChannelReady_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
39 * The per-commitment point of the second commitment transaction
41 public byte[] get_next_per_commitment_point() {
42 byte[] ret = bindings.ChannelReady_get_next_per_commitment_point(this.ptr);
48 * The per-commitment point of the second commitment transaction
50 public void set_next_per_commitment_point(byte[] val) {
51 bindings.ChannelReady_set_next_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
57 * If set, provides a `short_channel_id` alias for this channel.
59 * The sender will accept payments to be forwarded over this SCID and forward them to this
60 * messages' recipient.
62 public Option_u64Z get_short_channel_id_alias() {
63 long ret = bindings.ChannelReady_get_short_channel_id_alias(this.ptr);
65 if (ret >= 0 && ret <= 4096) { return null; }
66 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
67 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
72 * If set, provides a `short_channel_id` alias for this channel.
74 * The sender will accept payments to be forwarded over this SCID and forward them to this
75 * messages' recipient.
77 public void set_short_channel_id_alias(org.ldk.structs.Option_u64Z val) {
78 bindings.ChannelReady_set_short_channel_id_alias(this.ptr, val.ptr);
81 if (this != null) { this.ptrs_to.AddLast(val); };
85 * Constructs a new ChannelReady given each field
87 public static ChannelReady of(byte[] channel_id_arg, byte[] next_per_commitment_point_arg, org.ldk.structs.Option_u64Z short_channel_id_alias_arg) {
88 long ret = bindings.ChannelReady_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(next_per_commitment_point_arg, 33), short_channel_id_alias_arg.ptr);
89 GC.KeepAlive(channel_id_arg);
90 GC.KeepAlive(next_per_commitment_point_arg);
91 GC.KeepAlive(short_channel_id_alias_arg);
92 if (ret >= 0 && ret <= 4096) { return null; }
93 org.ldk.structs.ChannelReady ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReady(null, ret); }
94 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
95 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(short_channel_id_alias_arg); };
99 internal long clone_ptr() {
100 long ret = bindings.ChannelReady_clone_ptr(this.ptr);
106 * Creates a copy of the ChannelReady
108 public ChannelReady clone() {
109 long ret = bindings.ChannelReady_clone(this.ptr);
111 if (ret >= 0 && ret <= 4096) { return null; }
112 org.ldk.structs.ChannelReady ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReady(null, ret); }
113 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
118 * Checks if two ChannelReadys contain equal inner contents.
119 * This ignores pointers and is_owned flags and looks at the values in fields.
120 * Two objects with NULL inner values will be considered "equal" here.
122 public bool eq(org.ldk.structs.ChannelReady b) {
123 bool ret = bindings.ChannelReady_eq(this.ptr, b == null ? 0 : b.ptr);
126 if (this != null) { this.ptrs_to.AddLast(b); };
130 public override bool Equals(object o) {
131 if (!(o is ChannelReady)) return false;
132 return this.eq((ChannelReady)o);
135 * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
137 public byte[] write() {
138 byte[] ret = bindings.ChannelReady_write(this.ptr);
144 * Read a ChannelReady from a byte array, created by ChannelReady_write
146 public static Result_ChannelReadyDecodeErrorZ read(byte[] ser) {
147 long ret = bindings.ChannelReady_read(ser);
149 if (ret >= 0 && ret <= 4096) { return null; }
150 Result_ChannelReadyDecodeErrorZ ret_hu_conv = Result_ChannelReadyDecodeErrorZ.constr_from_ptr(ret);