Update auto-generated bindings to LDK v0.0.99
[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          * Before a channel is usable the funding transaction will need to be confirmed by at least a
140          * certain number of blocks, specified by the node which is not the funder (as the funder can
141          * assume they aren't going to double-spend themselves).
142          * This config allows you to set a limit on the maximum amount of time to wait.
143          * 
144          * Default value: 144, or roughly one day and only applies to outbound channels.
145          */
146         public int get_max_minimum_depth() {
147                 int ret = bindings.ChannelHandshakeLimits_get_max_minimum_depth(this.ptr);
148                 return ret;
149         }
150
151         /**
152          * Before a channel is usable the funding transaction will need to be confirmed by at least a
153          * certain number of blocks, specified by the node which is not the funder (as the funder can
154          * assume they aren't going to double-spend themselves).
155          * This config allows you to set a limit on the maximum amount of time to wait.
156          * 
157          * Default value: 144, or roughly one day and only applies to outbound channels.
158          */
159         public void set_max_minimum_depth(int val) {
160                 bindings.ChannelHandshakeLimits_set_max_minimum_depth(this.ptr, val);
161         }
162
163         /**
164          * Set to force an incoming channel to match our announced channel preference in
165          * [`ChannelConfig::announced_channel`].
166          * 
167          * For a node which is not online reliably, this should be set to true and
168          * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
169          * channels will ever be opened.
170          * 
171          * Default value: true.
172          */
173         public boolean get_force_announced_channel_preference() {
174                 boolean ret = bindings.ChannelHandshakeLimits_get_force_announced_channel_preference(this.ptr);
175                 return ret;
176         }
177
178         /**
179          * Set to force an incoming channel to match our announced channel preference in
180          * [`ChannelConfig::announced_channel`].
181          * 
182          * For a node which is not online reliably, this should be set to true and
183          * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
184          * channels will ever be opened.
185          * 
186          * Default value: true.
187          */
188         public void set_force_announced_channel_preference(boolean val) {
189                 bindings.ChannelHandshakeLimits_set_force_announced_channel_preference(this.ptr, val);
190         }
191
192         /**
193          * Set to the amount of time we're willing to wait to claim money back to us.
194          * 
195          * Not checking this value would be a security issue, as our peer would be able to set it to
196          * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
197          * 
198          * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
199          * reduce the loss of having useless locked funds (if your peer accepts)
200          */
201         public short get_their_to_self_delay() {
202                 short ret = bindings.ChannelHandshakeLimits_get_their_to_self_delay(this.ptr);
203                 return ret;
204         }
205
206         /**
207          * Set to the amount of time we're willing to wait to claim money back to us.
208          * 
209          * Not checking this value would be a security issue, as our peer would be able to set it to
210          * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
211          * 
212          * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
213          * reduce the loss of having useless locked funds (if your peer accepts)
214          */
215         public void set_their_to_self_delay(short val) {
216                 bindings.ChannelHandshakeLimits_set_their_to_self_delay(this.ptr, val);
217         }
218
219         /**
220          * Constructs a new ChannelHandshakeLimits given each field
221          */
222         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) {
223                 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);
224                 ChannelHandshakeLimits ret_hu_conv = new ChannelHandshakeLimits(null, ret);
225                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
226                 return ret_hu_conv;
227         }
228
229         /**
230          * Creates a copy of the ChannelHandshakeLimits
231          */
232         public ChannelHandshakeLimits clone() {
233                 long ret = bindings.ChannelHandshakeLimits_clone(this.ptr);
234                 ChannelHandshakeLimits ret_hu_conv = new ChannelHandshakeLimits(null, ret);
235                 ret_hu_conv.ptrs_to.add(this);
236                 return ret_hu_conv;
237         }
238
239         /**
240          * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
241          */
242         public static ChannelHandshakeLimits with_default() {
243                 long ret = bindings.ChannelHandshakeLimits_default();
244                 ChannelHandshakeLimits ret_hu_conv = new ChannelHandshakeLimits(null, ret);
245                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
246                 return ret_hu_conv;
247         }
248
249 }