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 byte[] ret = bindings.ChannelReestablish_get_channel_id(this.ptr);
32 public void set_channel_id(byte[] val) {
33 bindings.ChannelReestablish_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
39 * The next commitment number for the sender
41 public long get_next_local_commitment_number() {
42 long ret = bindings.ChannelReestablish_get_next_local_commitment_number(this.ptr);
48 * The next commitment number for the sender
50 public void set_next_local_commitment_number(long val) {
51 bindings.ChannelReestablish_set_next_local_commitment_number(this.ptr, val);
57 * The next commitment number for the recipient
59 public long get_next_remote_commitment_number() {
60 long ret = bindings.ChannelReestablish_get_next_remote_commitment_number(this.ptr);
66 * The next commitment number for the recipient
68 public void set_next_remote_commitment_number(long val) {
69 bindings.ChannelReestablish_set_next_remote_commitment_number(this.ptr, val);
75 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
76 * belonging to the recipient
78 public byte[] get_your_last_per_commitment_secret() {
79 byte[] ret = bindings.ChannelReestablish_get_your_last_per_commitment_secret(this.ptr);
85 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
86 * belonging to the recipient
88 public void set_your_last_per_commitment_secret(byte[] val) {
89 bindings.ChannelReestablish_set_your_last_per_commitment_secret(this.ptr, InternalUtils.check_arr_len(val, 32));
95 * The sender's per-commitment point for their current commitment transaction
97 public byte[] get_my_current_per_commitment_point() {
98 byte[] ret = bindings.ChannelReestablish_get_my_current_per_commitment_point(this.ptr);
104 * The sender's per-commitment point for their current commitment transaction
106 public void set_my_current_per_commitment_point(byte[] val) {
107 bindings.ChannelReestablish_set_my_current_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
113 * The next funding transaction ID
115 public Option_TxidZ get_next_funding_txid() {
116 long ret = bindings.ChannelReestablish_get_next_funding_txid(this.ptr);
118 if (ret >= 0 && ret <= 4096) { return null; }
119 org.ldk.structs.Option_TxidZ ret_hu_conv = org.ldk.structs.Option_TxidZ.constr_from_ptr(ret);
120 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
125 * The next funding transaction ID
127 public void set_next_funding_txid(org.ldk.structs.Option_TxidZ val) {
128 bindings.ChannelReestablish_set_next_funding_txid(this.ptr, val.ptr);
131 if (this != null) { this.ptrs_to.AddLast(val); };
135 * Constructs a new ChannelReestablish given each field
137 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_TxidZ next_funding_txid_arg) {
138 long ret = bindings.ChannelReestablish_new(InternalUtils.check_arr_len(channel_id_arg, 32), next_local_commitment_number_arg, next_remote_commitment_number_arg, InternalUtils.check_arr_len(your_last_per_commitment_secret_arg, 32), InternalUtils.check_arr_len(my_current_per_commitment_point_arg, 33), next_funding_txid_arg.ptr);
139 GC.KeepAlive(channel_id_arg);
140 GC.KeepAlive(next_local_commitment_number_arg);
141 GC.KeepAlive(next_remote_commitment_number_arg);
142 GC.KeepAlive(your_last_per_commitment_secret_arg);
143 GC.KeepAlive(my_current_per_commitment_point_arg);
144 GC.KeepAlive(next_funding_txid_arg);
145 if (ret >= 0 && ret <= 4096) { return null; }
146 org.ldk.structs.ChannelReestablish ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReestablish(null, ret); }
147 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
148 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(next_funding_txid_arg); };
152 internal long clone_ptr() {
153 long ret = bindings.ChannelReestablish_clone_ptr(this.ptr);
159 * Creates a copy of the ChannelReestablish
161 public ChannelReestablish clone() {
162 long ret = bindings.ChannelReestablish_clone(this.ptr);
164 if (ret >= 0 && ret <= 4096) { return null; }
165 org.ldk.structs.ChannelReestablish ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReestablish(null, ret); }
166 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
171 * Checks if two ChannelReestablishs contain equal inner contents.
172 * This ignores pointers and is_owned flags and looks at the values in fields.
173 * Two objects with NULL inner values will be considered "equal" here.
175 public bool eq(org.ldk.structs.ChannelReestablish b) {
176 bool ret = bindings.ChannelReestablish_eq(this.ptr, b == null ? 0 : b.ptr);
179 if (this != null) { this.ptrs_to.AddLast(b); };
183 public override bool Equals(object o) {
184 if (!(o is ChannelReestablish)) return false;
185 return this.eq((ChannelReestablish)o);
188 * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
190 public byte[] write() {
191 byte[] ret = bindings.ChannelReestablish_write(this.ptr);
197 * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
199 public static Result_ChannelReestablishDecodeErrorZ read(byte[] ser) {
200 long ret = bindings.ChannelReestablish_read(ser);
202 if (ret >= 0 && ret <= 4096) { return null; }
203 Result_ChannelReestablishDecodeErrorZ ret_hu_conv = Result_ChannelReestablishDecodeErrorZ.constr_from_ptr(ret);