Update auto-updated Java files
[ldk-java] / src / main / java / org / ldk / structs / UnsignedChannelUpdate.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  * The unsigned part of a channel_update
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class UnsignedChannelUpdate extends CommonBase {
16         UnsignedChannelUpdate(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.UnsignedChannelUpdate_free(ptr); }
21         }
22
23         /**
24          * The genesis hash of the blockchain where the channel is to be opened
25          */
26         public byte[] get_chain_hash() {
27                 byte[] ret = bindings.UnsignedChannelUpdate_get_chain_hash(this.ptr);
28                 Reference.reachabilityFence(this);
29                 return ret;
30         }
31
32         /**
33          * The genesis hash of the blockchain where the channel is to be opened
34          */
35         public void set_chain_hash(byte[] val) {
36                 bindings.UnsignedChannelUpdate_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
37                 Reference.reachabilityFence(this);
38                 Reference.reachabilityFence(val);
39         }
40
41         /**
42          * The short channel ID
43          */
44         public long get_short_channel_id() {
45                 long ret = bindings.UnsignedChannelUpdate_get_short_channel_id(this.ptr);
46                 Reference.reachabilityFence(this);
47                 return ret;
48         }
49
50         /**
51          * The short channel ID
52          */
53         public void set_short_channel_id(long val) {
54                 bindings.UnsignedChannelUpdate_set_short_channel_id(this.ptr, val);
55                 Reference.reachabilityFence(this);
56                 Reference.reachabilityFence(val);
57         }
58
59         /**
60          * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
61          */
62         public int get_timestamp() {
63                 int ret = bindings.UnsignedChannelUpdate_get_timestamp(this.ptr);
64                 Reference.reachabilityFence(this);
65                 return ret;
66         }
67
68         /**
69          * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
70          */
71         public void set_timestamp(int val) {
72                 bindings.UnsignedChannelUpdate_set_timestamp(this.ptr, val);
73                 Reference.reachabilityFence(this);
74                 Reference.reachabilityFence(val);
75         }
76
77         /**
78          * Channel flags
79          */
80         public byte get_flags() {
81                 byte ret = bindings.UnsignedChannelUpdate_get_flags(this.ptr);
82                 Reference.reachabilityFence(this);
83                 return ret;
84         }
85
86         /**
87          * Channel flags
88          */
89         public void set_flags(byte val) {
90                 bindings.UnsignedChannelUpdate_set_flags(this.ptr, val);
91                 Reference.reachabilityFence(this);
92                 Reference.reachabilityFence(val);
93         }
94
95         /**
96          * The number of blocks such that if:
97          * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
98          * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
99          * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
100          * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
101          * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
102          * forwarding. Note that the HTLC sender is the one who originally sets this value when
103          * constructing the route.
104          */
105         public short get_cltv_expiry_delta() {
106                 short ret = bindings.UnsignedChannelUpdate_get_cltv_expiry_delta(this.ptr);
107                 Reference.reachabilityFence(this);
108                 return ret;
109         }
110
111         /**
112          * The number of blocks such that if:
113          * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
114          * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
115          * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
116          * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
117          * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
118          * forwarding. Note that the HTLC sender is the one who originally sets this value when
119          * constructing the route.
120          */
121         public void set_cltv_expiry_delta(short val) {
122                 bindings.UnsignedChannelUpdate_set_cltv_expiry_delta(this.ptr, val);
123                 Reference.reachabilityFence(this);
124                 Reference.reachabilityFence(val);
125         }
126
127         /**
128          * The minimum HTLC size incoming to sender, in milli-satoshi
129          */
130         public long get_htlc_minimum_msat() {
131                 long ret = bindings.UnsignedChannelUpdate_get_htlc_minimum_msat(this.ptr);
132                 Reference.reachabilityFence(this);
133                 return ret;
134         }
135
136         /**
137          * The minimum HTLC size incoming to sender, in milli-satoshi
138          */
139         public void set_htlc_minimum_msat(long val) {
140                 bindings.UnsignedChannelUpdate_set_htlc_minimum_msat(this.ptr, val);
141                 Reference.reachabilityFence(this);
142                 Reference.reachabilityFence(val);
143         }
144
145         /**
146          * The base HTLC fee charged by sender, in milli-satoshi
147          */
148         public int get_fee_base_msat() {
149                 int ret = bindings.UnsignedChannelUpdate_get_fee_base_msat(this.ptr);
150                 Reference.reachabilityFence(this);
151                 return ret;
152         }
153
154         /**
155          * The base HTLC fee charged by sender, in milli-satoshi
156          */
157         public void set_fee_base_msat(int val) {
158                 bindings.UnsignedChannelUpdate_set_fee_base_msat(this.ptr, val);
159                 Reference.reachabilityFence(this);
160                 Reference.reachabilityFence(val);
161         }
162
163         /**
164          * The amount to fee multiplier, in micro-satoshi
165          */
166         public int get_fee_proportional_millionths() {
167                 int ret = bindings.UnsignedChannelUpdate_get_fee_proportional_millionths(this.ptr);
168                 Reference.reachabilityFence(this);
169                 return ret;
170         }
171
172         /**
173          * The amount to fee multiplier, in micro-satoshi
174          */
175         public void set_fee_proportional_millionths(int val) {
176                 bindings.UnsignedChannelUpdate_set_fee_proportional_millionths(this.ptr, val);
177                 Reference.reachabilityFence(this);
178                 Reference.reachabilityFence(val);
179         }
180
181         long clone_ptr() {
182                 long ret = bindings.UnsignedChannelUpdate_clone_ptr(this.ptr);
183                 Reference.reachabilityFence(this);
184                 return ret;
185         }
186
187         /**
188          * Creates a copy of the UnsignedChannelUpdate
189          */
190         public UnsignedChannelUpdate clone() {
191                 long ret = bindings.UnsignedChannelUpdate_clone(this.ptr);
192                 Reference.reachabilityFence(this);
193                 if (ret >= 0 && ret <= 4096) { return null; }
194                 UnsignedChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UnsignedChannelUpdate(null, ret); }
195                 ret_hu_conv.ptrs_to.add(this);
196                 return ret_hu_conv;
197         }
198
199         /**
200          * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
201          */
202         public byte[] write() {
203                 byte[] ret = bindings.UnsignedChannelUpdate_write(this.ptr);
204                 Reference.reachabilityFence(this);
205                 return ret;
206         }
207
208         /**
209          * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
210          */
211         public static Result_UnsignedChannelUpdateDecodeErrorZ read(byte[] ser) {
212                 long ret = bindings.UnsignedChannelUpdate_read(ser);
213                 Reference.reachabilityFence(ser);
214                 if (ret >= 0 && ret <= 4096) { return null; }
215                 Result_UnsignedChannelUpdateDecodeErrorZ ret_hu_conv = Result_UnsignedChannelUpdateDecodeErrorZ.constr_from_ptr(ret);
216                 return ret_hu_conv;
217         }
218
219 }