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 ChannelId get_channel_id() {
24 long ret = bindings.ChannelReestablish_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.ChannelReestablish_set_channel_id(this.ptr, val.ptr);
39 if (this != null) { this.ptrs_to.AddLast(val); };
43 * The next commitment number for the sender
45 public long get_next_local_commitment_number() {
46 long ret = bindings.ChannelReestablish_get_next_local_commitment_number(this.ptr);
52 * The next commitment number for the sender
54 public void set_next_local_commitment_number(long val) {
55 bindings.ChannelReestablish_set_next_local_commitment_number(this.ptr, val);
61 * The next commitment number for the recipient
63 public long get_next_remote_commitment_number() {
64 long ret = bindings.ChannelReestablish_get_next_remote_commitment_number(this.ptr);
70 * The next commitment number for the recipient
72 public void set_next_remote_commitment_number(long val) {
73 bindings.ChannelReestablish_set_next_remote_commitment_number(this.ptr, val);
79 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
80 * belonging to the recipient
82 public byte[] get_your_last_per_commitment_secret() {
83 long ret = bindings.ChannelReestablish_get_your_last_per_commitment_secret(this.ptr);
85 if (ret >= 0 && ret <= 4096) { return null; }
86 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
91 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
92 * belonging to the recipient
94 public void set_your_last_per_commitment_secret(byte[] val) {
95 bindings.ChannelReestablish_set_your_last_per_commitment_secret(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
101 * The sender's per-commitment point for their current commitment transaction
103 public byte[] get_my_current_per_commitment_point() {
104 long ret = bindings.ChannelReestablish_get_my_current_per_commitment_point(this.ptr);
106 if (ret >= 0 && ret <= 4096) { return null; }
107 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
112 * The sender's per-commitment point for their current commitment transaction
114 public void set_my_current_per_commitment_point(byte[] val) {
115 bindings.ChannelReestablish_set_my_current_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
121 * The next funding transaction ID
123 public Option_ThirtyTwoBytesZ get_next_funding_txid() {
124 long ret = bindings.ChannelReestablish_get_next_funding_txid(this.ptr);
126 if (ret >= 0 && ret <= 4096) { return null; }
127 org.ldk.structs.Option_ThirtyTwoBytesZ ret_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(ret);
128 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
133 * The next funding transaction ID
135 public void set_next_funding_txid(org.ldk.structs.Option_ThirtyTwoBytesZ val) {
136 bindings.ChannelReestablish_set_next_funding_txid(this.ptr, val.ptr);
139 if (this != null) { this.ptrs_to.AddLast(val); };
143 * Constructs a new ChannelReestablish given each field
145 public static ChannelReestablish of(org.ldk.structs.ChannelId 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) {
146 long ret = bindings.ChannelReestablish_new(channel_id_arg.ptr, 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);
147 GC.KeepAlive(channel_id_arg);
148 GC.KeepAlive(next_local_commitment_number_arg);
149 GC.KeepAlive(next_remote_commitment_number_arg);
150 GC.KeepAlive(your_last_per_commitment_secret_arg);
151 GC.KeepAlive(my_current_per_commitment_point_arg);
152 GC.KeepAlive(next_funding_txid_arg);
153 if (ret >= 0 && ret <= 4096) { return null; }
154 org.ldk.structs.ChannelReestablish ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReestablish(null, ret); }
155 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
156 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id_arg); };
157 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(next_funding_txid_arg); };
161 internal long clone_ptr() {
162 long ret = bindings.ChannelReestablish_clone_ptr(this.ptr);
168 * Creates a copy of the ChannelReestablish
170 public ChannelReestablish clone() {
171 long ret = bindings.ChannelReestablish_clone(this.ptr);
173 if (ret >= 0 && ret <= 4096) { return null; }
174 org.ldk.structs.ChannelReestablish ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReestablish(null, ret); }
175 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
180 * Generates a non-cryptographic 64-bit hash of the ChannelReestablish.
183 long ret = bindings.ChannelReestablish_hash(this.ptr);
188 public override int GetHashCode() {
189 return (int)this.hash();
192 * Checks if two ChannelReestablishs contain equal inner contents.
193 * This ignores pointers and is_owned flags and looks at the values in fields.
194 * Two objects with NULL inner values will be considered "equal" here.
196 public bool eq(org.ldk.structs.ChannelReestablish b) {
197 bool ret = bindings.ChannelReestablish_eq(this.ptr, b.ptr);
200 if (this != null) { this.ptrs_to.AddLast(b); };
204 public override bool Equals(object o) {
205 if (!(o is ChannelReestablish)) return false;
206 return this.eq((ChannelReestablish)o);
209 * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
211 public byte[] write() {
212 long ret = bindings.ChannelReestablish_write(this.ptr);
214 if (ret >= 0 && ret <= 4096) { return null; }
215 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
220 * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
222 public static Result_ChannelReestablishDecodeErrorZ read(byte[] ser) {
223 long ret = bindings.ChannelReestablish_read(InternalUtils.encodeUint8Array(ser));
225 if (ret >= 0 && ret <= 4096) { return null; }
226 Result_ChannelReestablishDecodeErrorZ ret_hu_conv = Result_ChannelReestablishDecodeErrorZ.constr_from_ptr(ret);