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