[C#] Run tests against release library in determinism CI run
[ldk-java] / src / main / java / org / ldk / structs / ChannelReestablish.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * A [`channel_reestablish`] message to be sent to or received from a peer.
13  * 
14  * [`channel_reestablish`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#message-retransmission
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class ChannelReestablish extends CommonBase {
18         ChannelReestablish(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.ChannelReestablish_free(ptr); }
23         }
24
25         /**
26          * The channel ID
27          */
28         public ChannelId get_channel_id() {
29                 long ret = bindings.ChannelReestablish_get_channel_id(this.ptr);
30                 Reference.reachabilityFence(this);
31                 if (ret >= 0 && ret <= 4096) { return null; }
32                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
33                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
34                 return ret_hu_conv;
35         }
36
37         /**
38          * The channel ID
39          */
40         public void set_channel_id(org.ldk.structs.ChannelId val) {
41                 bindings.ChannelReestablish_set_channel_id(this.ptr, val.ptr);
42                 Reference.reachabilityFence(this);
43                 Reference.reachabilityFence(val);
44                 if (this != null) { this.ptrs_to.add(val); };
45         }
46
47         /**
48          * The next commitment number for the sender
49          */
50         public long get_next_local_commitment_number() {
51                 long ret = bindings.ChannelReestablish_get_next_local_commitment_number(this.ptr);
52                 Reference.reachabilityFence(this);
53                 return ret;
54         }
55
56         /**
57          * The next commitment number for the sender
58          */
59         public void set_next_local_commitment_number(long val) {
60                 bindings.ChannelReestablish_set_next_local_commitment_number(this.ptr, val);
61                 Reference.reachabilityFence(this);
62                 Reference.reachabilityFence(val);
63         }
64
65         /**
66          * The next commitment number for the recipient
67          */
68         public long get_next_remote_commitment_number() {
69                 long ret = bindings.ChannelReestablish_get_next_remote_commitment_number(this.ptr);
70                 Reference.reachabilityFence(this);
71                 return ret;
72         }
73
74         /**
75          * The next commitment number for the recipient
76          */
77         public void set_next_remote_commitment_number(long val) {
78                 bindings.ChannelReestablish_set_next_remote_commitment_number(this.ptr, val);
79                 Reference.reachabilityFence(this);
80                 Reference.reachabilityFence(val);
81         }
82
83         /**
84          * Proof that the sender knows the per-commitment secret of a specific commitment transaction
85          * belonging to the recipient
86          */
87         public byte[] get_your_last_per_commitment_secret() {
88                 byte[] ret = bindings.ChannelReestablish_get_your_last_per_commitment_secret(this.ptr);
89                 Reference.reachabilityFence(this);
90                 return ret;
91         }
92
93         /**
94          * Proof that the sender knows the per-commitment secret of a specific commitment transaction
95          * belonging to the recipient
96          */
97         public void set_your_last_per_commitment_secret(byte[] val) {
98                 bindings.ChannelReestablish_set_your_last_per_commitment_secret(this.ptr, InternalUtils.check_arr_len(val, 32));
99                 Reference.reachabilityFence(this);
100                 Reference.reachabilityFence(val);
101         }
102
103         /**
104          * The sender's per-commitment point for their current commitment transaction
105          */
106         public byte[] get_my_current_per_commitment_point() {
107                 byte[] ret = bindings.ChannelReestablish_get_my_current_per_commitment_point(this.ptr);
108                 Reference.reachabilityFence(this);
109                 return ret;
110         }
111
112         /**
113          * The sender's per-commitment point for their current commitment transaction
114          */
115         public void set_my_current_per_commitment_point(byte[] val) {
116                 bindings.ChannelReestablish_set_my_current_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
117                 Reference.reachabilityFence(this);
118                 Reference.reachabilityFence(val);
119         }
120
121         /**
122          * The next funding transaction ID
123          */
124         public Option_ThirtyTwoBytesZ get_next_funding_txid() {
125                 long ret = bindings.ChannelReestablish_get_next_funding_txid(this.ptr);
126                 Reference.reachabilityFence(this);
127                 if (ret >= 0 && ret <= 4096) { return null; }
128                 org.ldk.structs.Option_ThirtyTwoBytesZ ret_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(ret);
129                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
130                 return ret_hu_conv;
131         }
132
133         /**
134          * The next funding transaction ID
135          */
136         public void set_next_funding_txid(org.ldk.structs.Option_ThirtyTwoBytesZ val) {
137                 bindings.ChannelReestablish_set_next_funding_txid(this.ptr, val.ptr);
138                 Reference.reachabilityFence(this);
139                 Reference.reachabilityFence(val);
140                 if (this != null) { this.ptrs_to.add(val); };
141         }
142
143         /**
144          * Constructs a new ChannelReestablish given each field
145          */
146         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) {
147                 long ret = bindings.ChannelReestablish_new(channel_id_arg.ptr, 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);
148                 Reference.reachabilityFence(channel_id_arg);
149                 Reference.reachabilityFence(next_local_commitment_number_arg);
150                 Reference.reachabilityFence(next_remote_commitment_number_arg);
151                 Reference.reachabilityFence(your_last_per_commitment_secret_arg);
152                 Reference.reachabilityFence(my_current_per_commitment_point_arg);
153                 Reference.reachabilityFence(next_funding_txid_arg);
154                 if (ret >= 0 && ret <= 4096) { return null; }
155                 org.ldk.structs.ChannelReestablish ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReestablish(null, ret); }
156                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
157                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
158                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(next_funding_txid_arg); };
159                 return ret_hu_conv;
160         }
161
162         long clone_ptr() {
163                 long ret = bindings.ChannelReestablish_clone_ptr(this.ptr);
164                 Reference.reachabilityFence(this);
165                 return ret;
166         }
167
168         /**
169          * Creates a copy of the ChannelReestablish
170          */
171         public ChannelReestablish clone() {
172                 long ret = bindings.ChannelReestablish_clone(this.ptr);
173                 Reference.reachabilityFence(this);
174                 if (ret >= 0 && ret <= 4096) { return null; }
175                 org.ldk.structs.ChannelReestablish ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReestablish(null, ret); }
176                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
177                 return ret_hu_conv;
178         }
179
180         /**
181          * Generates a non-cryptographic 64-bit hash of the ChannelReestablish.
182          */
183         public long hash() {
184                 long ret = bindings.ChannelReestablish_hash(this.ptr);
185                 Reference.reachabilityFence(this);
186                 return ret;
187         }
188
189         @Override public int hashCode() {
190                 return (int)this.hash();
191         }
192         /**
193          * Checks if two ChannelReestablishs contain equal inner contents.
194          * This ignores pointers and is_owned flags and looks at the values in fields.
195          * Two objects with NULL inner values will be considered "equal" here.
196          */
197         public boolean eq(org.ldk.structs.ChannelReestablish b) {
198                 boolean ret = bindings.ChannelReestablish_eq(this.ptr, b.ptr);
199                 Reference.reachabilityFence(this);
200                 Reference.reachabilityFence(b);
201                 if (this != null) { this.ptrs_to.add(b); };
202                 return ret;
203         }
204
205         @Override public boolean equals(Object o) {
206                 if (!(o instanceof ChannelReestablish)) return false;
207                 return this.eq((ChannelReestablish)o);
208         }
209         /**
210          * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
211          */
212         public byte[] write() {
213                 byte[] ret = bindings.ChannelReestablish_write(this.ptr);
214                 Reference.reachabilityFence(this);
215                 return ret;
216         }
217
218         /**
219          * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
220          */
221         public static Result_ChannelReestablishDecodeErrorZ read(byte[] ser) {
222                 long ret = bindings.ChannelReestablish_read(ser);
223                 Reference.reachabilityFence(ser);
224                 if (ret >= 0 && ret <= 4096) { return null; }
225                 Result_ChannelReestablishDecodeErrorZ ret_hu_conv = Result_ChannelReestablishDecodeErrorZ.constr_from_ptr(ret);
226                 return ret_hu_conv;
227         }
228
229 }