6 namespace org { namespace ldk { namespace structs {
10 * A [`channel_reestablish`] message to be sent to or received from a peer.
12 * [`channel_reestablish`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#message-retransmission
14 public class ChannelReestablish : CommonBase {
15 internal ChannelReestablish(object _dummy, long ptr) : base(ptr) { }
16 ~ChannelReestablish() {
17 if (ptr != 0) { bindings.ChannelReestablish_free(ptr); }
23 public byte[] get_channel_id() {
24 long ret = bindings.ChannelReestablish_get_channel_id(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
34 public void set_channel_id(byte[] val) {
35 bindings.ChannelReestablish_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
41 * The next commitment number for the sender
43 public long get_next_local_commitment_number() {
44 long ret = bindings.ChannelReestablish_get_next_local_commitment_number(this.ptr);
50 * The next commitment number for the sender
52 public void set_next_local_commitment_number(long val) {
53 bindings.ChannelReestablish_set_next_local_commitment_number(this.ptr, val);
59 * The next commitment number for the recipient
61 public long get_next_remote_commitment_number() {
62 long ret = bindings.ChannelReestablish_get_next_remote_commitment_number(this.ptr);
68 * The next commitment number for the recipient
70 public void set_next_remote_commitment_number(long val) {
71 bindings.ChannelReestablish_set_next_remote_commitment_number(this.ptr, val);
77 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
78 * belonging to the recipient
80 public byte[] get_your_last_per_commitment_secret() {
81 long ret = bindings.ChannelReestablish_get_your_last_per_commitment_secret(this.ptr);
83 if (ret >= 0 && ret <= 4096) { return null; }
84 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
89 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
90 * belonging to the recipient
92 public void set_your_last_per_commitment_secret(byte[] val) {
93 bindings.ChannelReestablish_set_your_last_per_commitment_secret(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
99 * The sender's per-commitment point for their current commitment transaction
101 public byte[] get_my_current_per_commitment_point() {
102 long ret = bindings.ChannelReestablish_get_my_current_per_commitment_point(this.ptr);
104 if (ret >= 0 && ret <= 4096) { return null; }
105 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
110 * The sender's per-commitment point for their current commitment transaction
112 public void set_my_current_per_commitment_point(byte[] val) {
113 bindings.ChannelReestablish_set_my_current_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
119 * The next funding transaction ID
121 public Option_ThirtyTwoBytesZ get_next_funding_txid() {
122 long ret = bindings.ChannelReestablish_get_next_funding_txid(this.ptr);
124 if (ret >= 0 && ret <= 4096) { return null; }
125 org.ldk.structs.Option_ThirtyTwoBytesZ ret_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(ret);
126 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
131 * The next funding transaction ID
133 public void set_next_funding_txid(org.ldk.structs.Option_ThirtyTwoBytesZ val) {
134 bindings.ChannelReestablish_set_next_funding_txid(this.ptr, val.ptr);
137 if (this != null) { this.ptrs_to.AddLast(val); };
141 * Constructs a new ChannelReestablish given each field
143 public static ChannelReestablish of(byte[] channel_id_arg, long next_local_commitment_number_arg, long next_remote_commitment_number_arg, byte[] your_last_per_commitment_secret_arg, byte[] my_current_per_commitment_point_arg, org.ldk.structs.Option_ThirtyTwoBytesZ next_funding_txid_arg) {
144 long ret = bindings.ChannelReestablish_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), next_local_commitment_number_arg, next_remote_commitment_number_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(your_last_per_commitment_secret_arg, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(my_current_per_commitment_point_arg, 33)), next_funding_txid_arg.ptr);
145 GC.KeepAlive(channel_id_arg);
146 GC.KeepAlive(next_local_commitment_number_arg);
147 GC.KeepAlive(next_remote_commitment_number_arg);
148 GC.KeepAlive(your_last_per_commitment_secret_arg);
149 GC.KeepAlive(my_current_per_commitment_point_arg);
150 GC.KeepAlive(next_funding_txid_arg);
151 if (ret >= 0 && ret <= 4096) { return null; }
152 org.ldk.structs.ChannelReestablish ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReestablish(null, ret); }
153 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
154 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(next_funding_txid_arg); };
158 internal long clone_ptr() {
159 long ret = bindings.ChannelReestablish_clone_ptr(this.ptr);
165 * Creates a copy of the ChannelReestablish
167 public ChannelReestablish clone() {
168 long ret = bindings.ChannelReestablish_clone(this.ptr);
170 if (ret >= 0 && ret <= 4096) { return null; }
171 org.ldk.structs.ChannelReestablish ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReestablish(null, ret); }
172 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
177 * Generates a non-cryptographic 64-bit hash of the ChannelReestablish.
180 long ret = bindings.ChannelReestablish_hash(this.ptr);
185 public override int GetHashCode() {
186 return (int)this.hash();
189 * Checks if two ChannelReestablishs contain equal inner contents.
190 * This ignores pointers and is_owned flags and looks at the values in fields.
191 * Two objects with NULL inner values will be considered "equal" here.
193 public bool eq(org.ldk.structs.ChannelReestablish b) {
194 bool ret = bindings.ChannelReestablish_eq(this.ptr, b == null ? 0 : b.ptr);
197 if (this != null) { this.ptrs_to.AddLast(b); };
201 public override bool Equals(object o) {
202 if (!(o is ChannelReestablish)) return false;
203 return this.eq((ChannelReestablish)o);
206 * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
208 public byte[] write() {
209 long ret = bindings.ChannelReestablish_write(this.ptr);
211 if (ret >= 0 && ret <= 4096) { return null; }
212 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
217 * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
219 public static Result_ChannelReestablishDecodeErrorZ read(byte[] ser) {
220 long ret = bindings.ChannelReestablish_read(InternalUtils.encodeUint8Array(ser));
222 if (ret >= 0 && ret <= 4096) { return null; }
223 Result_ChannelReestablishDecodeErrorZ ret_hu_conv = Result_ChannelReestablishDecodeErrorZ.constr_from_ptr(ret);