[Java] Update auto-generated Java bindings to LDK 0.0.121
[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 byte[] get_channel_id() {
29                 byte[] ret = bindings.ChannelReestablish_get_channel_id(this.ptr);
30                 Reference.reachabilityFence(this);
31                 return ret;
32         }
33
34         /**
35          * The channel ID
36          */
37         public void set_channel_id(byte[] val) {
38                 bindings.ChannelReestablish_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
39                 Reference.reachabilityFence(this);
40                 Reference.reachabilityFence(val);
41         }
42
43         /**
44          * The next commitment number for the sender
45          */
46         public long get_next_local_commitment_number() {
47                 long ret = bindings.ChannelReestablish_get_next_local_commitment_number(this.ptr);
48                 Reference.reachabilityFence(this);
49                 return ret;
50         }
51
52         /**
53          * The next commitment number for the sender
54          */
55         public void set_next_local_commitment_number(long val) {
56                 bindings.ChannelReestablish_set_next_local_commitment_number(this.ptr, val);
57                 Reference.reachabilityFence(this);
58                 Reference.reachabilityFence(val);
59         }
60
61         /**
62          * The next commitment number for the recipient
63          */
64         public long get_next_remote_commitment_number() {
65                 long ret = bindings.ChannelReestablish_get_next_remote_commitment_number(this.ptr);
66                 Reference.reachabilityFence(this);
67                 return ret;
68         }
69
70         /**
71          * The next commitment number for the recipient
72          */
73         public void set_next_remote_commitment_number(long val) {
74                 bindings.ChannelReestablish_set_next_remote_commitment_number(this.ptr, val);
75                 Reference.reachabilityFence(this);
76                 Reference.reachabilityFence(val);
77         }
78
79         /**
80          * Proof that the sender knows the per-commitment secret of a specific commitment transaction
81          * belonging to the recipient
82          */
83         public byte[] get_your_last_per_commitment_secret() {
84                 byte[] ret = bindings.ChannelReestablish_get_your_last_per_commitment_secret(this.ptr);
85                 Reference.reachabilityFence(this);
86                 return ret;
87         }
88
89         /**
90          * Proof that the sender knows the per-commitment secret of a specific commitment transaction
91          * belonging to the recipient
92          */
93         public void set_your_last_per_commitment_secret(byte[] val) {
94                 bindings.ChannelReestablish_set_your_last_per_commitment_secret(this.ptr, InternalUtils.check_arr_len(val, 32));
95                 Reference.reachabilityFence(this);
96                 Reference.reachabilityFence(val);
97         }
98
99         /**
100          * The sender's per-commitment point for their current commitment transaction
101          */
102         public byte[] get_my_current_per_commitment_point() {
103                 byte[] ret = bindings.ChannelReestablish_get_my_current_per_commitment_point(this.ptr);
104                 Reference.reachabilityFence(this);
105                 return ret;
106         }
107
108         /**
109          * The sender's per-commitment point for their current commitment transaction
110          */
111         public void set_my_current_per_commitment_point(byte[] val) {
112                 bindings.ChannelReestablish_set_my_current_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
113                 Reference.reachabilityFence(this);
114                 Reference.reachabilityFence(val);
115         }
116
117         /**
118          * The next funding transaction ID
119          */
120         public Option_ThirtyTwoBytesZ get_next_funding_txid() {
121                 long ret = bindings.ChannelReestablish_get_next_funding_txid(this.ptr);
122                 Reference.reachabilityFence(this);
123                 if (ret >= 0 && ret <= 4096) { return null; }
124                 org.ldk.structs.Option_ThirtyTwoBytesZ ret_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(ret);
125                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
126                 return ret_hu_conv;
127         }
128
129         /**
130          * The next funding transaction ID
131          */
132         public void set_next_funding_txid(org.ldk.structs.Option_ThirtyTwoBytesZ val) {
133                 bindings.ChannelReestablish_set_next_funding_txid(this.ptr, val.ptr);
134                 Reference.reachabilityFence(this);
135                 Reference.reachabilityFence(val);
136                 if (this != null) { this.ptrs_to.add(val); };
137         }
138
139         /**
140          * Constructs a new ChannelReestablish given each field
141          */
142         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) {
143                 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);
144                 Reference.reachabilityFence(channel_id_arg);
145                 Reference.reachabilityFence(next_local_commitment_number_arg);
146                 Reference.reachabilityFence(next_remote_commitment_number_arg);
147                 Reference.reachabilityFence(your_last_per_commitment_secret_arg);
148                 Reference.reachabilityFence(my_current_per_commitment_point_arg);
149                 Reference.reachabilityFence(next_funding_txid_arg);
150                 if (ret >= 0 && ret <= 4096) { return null; }
151                 org.ldk.structs.ChannelReestablish ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReestablish(null, ret); }
152                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
153                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(next_funding_txid_arg); };
154                 return ret_hu_conv;
155         }
156
157         long clone_ptr() {
158                 long ret = bindings.ChannelReestablish_clone_ptr(this.ptr);
159                 Reference.reachabilityFence(this);
160                 return ret;
161         }
162
163         /**
164          * Creates a copy of the ChannelReestablish
165          */
166         public ChannelReestablish clone() {
167                 long ret = bindings.ChannelReestablish_clone(this.ptr);
168                 Reference.reachabilityFence(this);
169                 if (ret >= 0 && ret <= 4096) { return null; }
170                 org.ldk.structs.ChannelReestablish ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReestablish(null, ret); }
171                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
172                 return ret_hu_conv;
173         }
174
175         /**
176          * Generates a non-cryptographic 64-bit hash of the ChannelReestablish.
177          */
178         public long hash() {
179                 long ret = bindings.ChannelReestablish_hash(this.ptr);
180                 Reference.reachabilityFence(this);
181                 return ret;
182         }
183
184         @Override public int hashCode() {
185                 return (int)this.hash();
186         }
187         /**
188          * Checks if two ChannelReestablishs contain equal inner contents.
189          * This ignores pointers and is_owned flags and looks at the values in fields.
190          * Two objects with NULL inner values will be considered "equal" here.
191          */
192         public boolean eq(org.ldk.structs.ChannelReestablish b) {
193                 boolean ret = bindings.ChannelReestablish_eq(this.ptr, b == null ? 0 : b.ptr);
194                 Reference.reachabilityFence(this);
195                 Reference.reachabilityFence(b);
196                 if (this != null) { this.ptrs_to.add(b); };
197                 return ret;
198         }
199
200         @Override public boolean equals(Object o) {
201                 if (!(o instanceof ChannelReestablish)) return false;
202                 return this.eq((ChannelReestablish)o);
203         }
204         /**
205          * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
206          */
207         public byte[] write() {
208                 byte[] ret = bindings.ChannelReestablish_write(this.ptr);
209                 Reference.reachabilityFence(this);
210                 return ret;
211         }
212
213         /**
214          * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
215          */
216         public static Result_ChannelReestablishDecodeErrorZ read(byte[] ser) {
217                 long ret = bindings.ChannelReestablish_read(ser);
218                 Reference.reachabilityFence(ser);
219                 if (ret >= 0 && ret <= 4096) { return null; }
220                 Result_ChannelReestablishDecodeErrorZ ret_hu_conv = Result_ChannelReestablishDecodeErrorZ.constr_from_ptr(ret);
221                 return ret_hu_conv;
222         }
223
224 }