Update java bindings with new generator and new upstream code
[ldk-java] / src / main / java / org / ldk / structs / ChannelHandshakeLimits.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
8
9 /**
10  * Optional channel limits which are applied during channel creation.
11  * 
12  * These limits are only applied to our counterparty's limits, not our own.
13  * 
14  * Use 0/<type>::max_value() as appropriate to skip checking.
15  * 
16  * Provides sane defaults for most configurations.
17  * 
18  * Most additional limits are disabled except those with which specify a default in individual
19  * field documentation. Note that this may result in barely-usable channels, but since they
20  * are applied mostly only to incoming channels that's not much of a problem.
21  */
22 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
23 public class ChannelHandshakeLimits extends CommonBase {
24         ChannelHandshakeLimits(Object _dummy, long ptr) { super(ptr); }
25         @Override @SuppressWarnings("deprecation")
26         protected void finalize() throws Throwable {
27                 super.finalize();
28                 if (ptr != 0) { bindings.ChannelHandshakeLimits_free(ptr); }
29         }
30
31         /**
32          * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
33          * only applies to inbound channels.
34          * 
35          * Default value: 0.
36          */
37         public long get_min_funding_satoshis() {
38                 long ret = bindings.ChannelHandshakeLimits_get_min_funding_satoshis(this.ptr);
39                 return ret;
40         }
41
42         /**
43          * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
44          * only applies to inbound channels.
45          * 
46          * Default value: 0.
47          */
48         public void set_min_funding_satoshis(long val) {
49                 bindings.ChannelHandshakeLimits_set_min_funding_satoshis(this.ptr, val);
50         }
51
52         /**
53          * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
54          * you to limit the maximum minimum-size they can require.
55          * 
56          * Default value: u64::max_value.
57          */
58         public long get_max_htlc_minimum_msat() {
59                 long ret = bindings.ChannelHandshakeLimits_get_max_htlc_minimum_msat(this.ptr);
60                 return ret;
61         }
62
63         /**
64          * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
65          * you to limit the maximum minimum-size they can require.
66          * 
67          * Default value: u64::max_value.
68          */
69         public void set_max_htlc_minimum_msat(long val) {
70                 bindings.ChannelHandshakeLimits_set_max_htlc_minimum_msat(this.ptr, val);
71         }
72
73         /**
74          * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
75          * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
76          * 
77          * Default value: 0.
78          */
79         public long get_min_max_htlc_value_in_flight_msat() {
80                 long ret = bindings.ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(this.ptr);
81                 return ret;
82         }
83
84         /**
85          * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
86          * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
87          * 
88          * Default value: 0.
89          */
90         public void set_min_max_htlc_value_in_flight_msat(long val) {
91                 bindings.ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(this.ptr, val);
92         }
93
94         /**
95          * The remote node will require we keep a certain amount in direct payment to ourselves at all
96          * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
97          * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
98          * 
99          * Default value: u64::max_value.
100          */
101         public long get_max_channel_reserve_satoshis() {
102                 long ret = bindings.ChannelHandshakeLimits_get_max_channel_reserve_satoshis(this.ptr);
103                 return ret;
104         }
105
106         /**
107          * The remote node will require we keep a certain amount in direct payment to ourselves at all
108          * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
109          * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
110          * 
111          * Default value: u64::max_value.
112          */
113         public void set_max_channel_reserve_satoshis(long val) {
114                 bindings.ChannelHandshakeLimits_set_max_channel_reserve_satoshis(this.ptr, val);
115         }
116
117         /**
118          * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
119          * time. This allows you to set a minimum such value.
120          * 
121          * Default value: 0.
122          */
123         public short get_min_max_accepted_htlcs() {
124                 short ret = bindings.ChannelHandshakeLimits_get_min_max_accepted_htlcs(this.ptr);
125                 return ret;
126         }
127
128         /**
129          * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
130          * time. This allows you to set a minimum such value.
131          * 
132          * Default value: 0.
133          */
134         public void set_min_max_accepted_htlcs(short val) {
135                 bindings.ChannelHandshakeLimits_set_min_max_accepted_htlcs(this.ptr, val);
136         }
137
138         /**
139          * Outputs below a certain value will not be added to on-chain transactions. The dust value is
140          * required to always be higher than this value so this only applies to HTLC outputs (and
141          * potentially to-self outputs before any payments have been made).
142          * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
143          * This setting allows you to set a minimum dust limit for their commitment transactions,
144          * reflecting the reality that tiny outputs are not considered standard transactions and will
145          * not propagate through the Bitcoin network.
146          * 
147          * Default value: 546, the current dust limit on the Bitcoin network.
148          */
149         public long get_min_dust_limit_satoshis() {
150                 long ret = bindings.ChannelHandshakeLimits_get_min_dust_limit_satoshis(this.ptr);
151                 return ret;
152         }
153
154         /**
155          * Outputs below a certain value will not be added to on-chain transactions. The dust value is
156          * required to always be higher than this value so this only applies to HTLC outputs (and
157          * potentially to-self outputs before any payments have been made).
158          * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
159          * This setting allows you to set a minimum dust limit for their commitment transactions,
160          * reflecting the reality that tiny outputs are not considered standard transactions and will
161          * not propagate through the Bitcoin network.
162          * 
163          * Default value: 546, the current dust limit on the Bitcoin network.
164          */
165         public void set_min_dust_limit_satoshis(long val) {
166                 bindings.ChannelHandshakeLimits_set_min_dust_limit_satoshis(this.ptr, val);
167         }
168
169         /**
170          * Maximum allowed threshold above which outputs will not be generated in their commitment
171          * transactions.
172          * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
173          * 
174          * Default value: u64::max_value.
175          */
176         public long get_max_dust_limit_satoshis() {
177                 long ret = bindings.ChannelHandshakeLimits_get_max_dust_limit_satoshis(this.ptr);
178                 return ret;
179         }
180
181         /**
182          * Maximum allowed threshold above which outputs will not be generated in their commitment
183          * transactions.
184          * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
185          * 
186          * Default value: u64::max_value.
187          */
188         public void set_max_dust_limit_satoshis(long val) {
189                 bindings.ChannelHandshakeLimits_set_max_dust_limit_satoshis(this.ptr, val);
190         }
191
192         /**
193          * Before a channel is usable the funding transaction will need to be confirmed by at least a
194          * certain number of blocks, specified by the node which is not the funder (as the funder can
195          * assume they aren't going to double-spend themselves).
196          * This config allows you to set a limit on the maximum amount of time to wait.
197          * 
198          * Default value: 144, or roughly one day and only applies to outbound channels.
199          */
200         public int get_max_minimum_depth() {
201                 int ret = bindings.ChannelHandshakeLimits_get_max_minimum_depth(this.ptr);
202                 return ret;
203         }
204
205         /**
206          * Before a channel is usable the funding transaction will need to be confirmed by at least a
207          * certain number of blocks, specified by the node which is not the funder (as the funder can
208          * assume they aren't going to double-spend themselves).
209          * This config allows you to set a limit on the maximum amount of time to wait.
210          * 
211          * Default value: 144, or roughly one day and only applies to outbound channels.
212          */
213         public void set_max_minimum_depth(int val) {
214                 bindings.ChannelHandshakeLimits_set_max_minimum_depth(this.ptr, val);
215         }
216
217         /**
218          * Set to force the incoming channel to match our announced channel preference in
219          * ChannelConfig.
220          * 
221          * Default value: true, to make the default that no announced channels are possible (which is
222          * appropriate for any nodes which are not online very reliably).
223          */
224         public boolean get_force_announced_channel_preference() {
225                 boolean ret = bindings.ChannelHandshakeLimits_get_force_announced_channel_preference(this.ptr);
226                 return ret;
227         }
228
229         /**
230          * Set to force the incoming channel to match our announced channel preference in
231          * ChannelConfig.
232          * 
233          * Default value: true, to make the default that no announced channels are possible (which is
234          * appropriate for any nodes which are not online very reliably).
235          */
236         public void set_force_announced_channel_preference(boolean val) {
237                 bindings.ChannelHandshakeLimits_set_force_announced_channel_preference(this.ptr, val);
238         }
239
240         /**
241          * Set to the amount of time we're willing to wait to claim money back to us.
242          * 
243          * Not checking this value would be a security issue, as our peer would be able to set it to
244          * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
245          * 
246          * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
247          * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
248          */
249         public short get_their_to_self_delay() {
250                 short ret = bindings.ChannelHandshakeLimits_get_their_to_self_delay(this.ptr);
251                 return ret;
252         }
253
254         /**
255          * Set to the amount of time we're willing to wait to claim money back to us.
256          * 
257          * Not checking this value would be a security issue, as our peer would be able to set it to
258          * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
259          * 
260          * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
261          * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
262          */
263         public void set_their_to_self_delay(short val) {
264                 bindings.ChannelHandshakeLimits_set_their_to_self_delay(this.ptr, val);
265         }
266
267         /**
268          * Constructs a new ChannelHandshakeLimits given each field
269          */
270         public static ChannelHandshakeLimits constructor_new(long min_funding_satoshis_arg, long max_htlc_minimum_msat_arg, long min_max_htlc_value_in_flight_msat_arg, long max_channel_reserve_satoshis_arg, short min_max_accepted_htlcs_arg, long min_dust_limit_satoshis_arg, long max_dust_limit_satoshis_arg, int max_minimum_depth_arg, boolean force_announced_channel_preference_arg, short their_to_self_delay_arg) {
271                 long ret = bindings.ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_htlc_minimum_msat_arg, min_max_htlc_value_in_flight_msat_arg, max_channel_reserve_satoshis_arg, min_max_accepted_htlcs_arg, min_dust_limit_satoshis_arg, max_dust_limit_satoshis_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
272                 ChannelHandshakeLimits ret_hu_conv = new ChannelHandshakeLimits(null, ret);
273                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
274                 return ret_hu_conv;
275         }
276
277         /**
278          * Creates a copy of the ChannelHandshakeLimits
279          */
280         public ChannelHandshakeLimits clone() {
281                 long ret = bindings.ChannelHandshakeLimits_clone(this.ptr);
282                 ChannelHandshakeLimits ret_hu_conv = new ChannelHandshakeLimits(null, ret);
283                 ret_hu_conv.ptrs_to.add(this);
284                 return ret_hu_conv;
285         }
286
287         /**
288          * Creates a "default" ChannelHandshakeLimits. See other documentaiton for details on what this implies.
289          */
290         public static ChannelHandshakeLimits constructor_default() {
291                 long ret = bindings.ChannelHandshakeLimits_default();
292                 ChannelHandshakeLimits ret_hu_conv = new ChannelHandshakeLimits(null, ret);
293                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
294                 return ret_hu_conv;
295         }
296
297 }