[Java] Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / ChannelHandshakeConfig.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  * Configuration we set when applicable.
13  * 
14  * Default::default() provides sane defaults.
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class ChannelHandshakeConfig extends CommonBase {
18         ChannelHandshakeConfig(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.ChannelHandshakeConfig_free(ptr); }
23         }
24
25         /**
26          * Confirmations we will wait for before considering the channel locked in.
27          * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
28          * equivalent limit applied to outbound channels).
29          * 
30          * Default value: 6.
31          */
32         public int get_minimum_depth() {
33                 int ret = bindings.ChannelHandshakeConfig_get_minimum_depth(this.ptr);
34                 Reference.reachabilityFence(this);
35                 return ret;
36         }
37
38         /**
39          * Confirmations we will wait for before considering the channel locked in.
40          * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
41          * equivalent limit applied to outbound channels).
42          * 
43          * Default value: 6.
44          */
45         public void set_minimum_depth(int val) {
46                 bindings.ChannelHandshakeConfig_set_minimum_depth(this.ptr, val);
47                 Reference.reachabilityFence(this);
48                 Reference.reachabilityFence(val);
49         }
50
51         /**
52          * Set to the number of blocks we require our counterparty to wait to claim their money (ie
53          * the number of blocks we have to punish our counterparty if they broadcast a revoked
54          * transaction).
55          * 
56          * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
57          * be online to check for revoked transactions on-chain at least once every our_to_self_delay
58          * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
59          * possibly with time in between to RBF the spending transaction).
60          * 
61          * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
62          * case of an honest unilateral channel close, which implicitly decrease the economic value of
63          * our channel.
64          * 
65          * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
66          * can tweak config to ask for more security, not less.
67          */
68         public short get_our_to_self_delay() {
69                 short ret = bindings.ChannelHandshakeConfig_get_our_to_self_delay(this.ptr);
70                 Reference.reachabilityFence(this);
71                 return ret;
72         }
73
74         /**
75          * Set to the number of blocks we require our counterparty to wait to claim their money (ie
76          * the number of blocks we have to punish our counterparty if they broadcast a revoked
77          * transaction).
78          * 
79          * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
80          * be online to check for revoked transactions on-chain at least once every our_to_self_delay
81          * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
82          * possibly with time in between to RBF the spending transaction).
83          * 
84          * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
85          * case of an honest unilateral channel close, which implicitly decrease the economic value of
86          * our channel.
87          * 
88          * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
89          * can tweak config to ask for more security, not less.
90          */
91         public void set_our_to_self_delay(short val) {
92                 bindings.ChannelHandshakeConfig_set_our_to_self_delay(this.ptr, val);
93                 Reference.reachabilityFence(this);
94                 Reference.reachabilityFence(val);
95         }
96
97         /**
98          * Set to the smallest value HTLC we will accept to process.
99          * 
100          * This value is sent to our counterparty on channel-open and we close the channel any time
101          * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
102          * 
103          * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
104          * by the protocol.
105          */
106         public long get_our_htlc_minimum_msat() {
107                 long ret = bindings.ChannelHandshakeConfig_get_our_htlc_minimum_msat(this.ptr);
108                 Reference.reachabilityFence(this);
109                 return ret;
110         }
111
112         /**
113          * Set to the smallest value HTLC we will accept to process.
114          * 
115          * This value is sent to our counterparty on channel-open and we close the channel any time
116          * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
117          * 
118          * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
119          * by the protocol.
120          */
121         public void set_our_htlc_minimum_msat(long val) {
122                 bindings.ChannelHandshakeConfig_set_our_htlc_minimum_msat(this.ptr, val);
123                 Reference.reachabilityFence(this);
124                 Reference.reachabilityFence(val);
125         }
126
127         /**
128          * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
129          * BOLTs) option for outbound private channels. This provides better privacy by not including
130          * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
131          * relay HTLCs to us using the channel's SCID alias.
132          * 
133          * If this option is set, channels may be created that will not be readable by LDK versions
134          * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
135          * [`DecodeError:InvalidValue`].
136          * 
137          * Note that setting this to true does *not* prevent us from opening channels with
138          * counterparties that do not support the `scid_alias` option; we will simply fall back to a
139          * private channel without that option.
140          * 
141          * Ignored if the channel is negotiated to be announced, see
142          * [`ChannelConfig::announced_channel`] and
143          * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
144          * 
145          * Default value: false. This value is likely to change to true in the future.
146          * 
147          * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
148          * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
149          */
150         public boolean get_negotiate_scid_privacy() {
151                 boolean ret = bindings.ChannelHandshakeConfig_get_negotiate_scid_privacy(this.ptr);
152                 Reference.reachabilityFence(this);
153                 return ret;
154         }
155
156         /**
157          * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
158          * BOLTs) option for outbound private channels. This provides better privacy by not including
159          * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
160          * relay HTLCs to us using the channel's SCID alias.
161          * 
162          * If this option is set, channels may be created that will not be readable by LDK versions
163          * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
164          * [`DecodeError:InvalidValue`].
165          * 
166          * Note that setting this to true does *not* prevent us from opening channels with
167          * counterparties that do not support the `scid_alias` option; we will simply fall back to a
168          * private channel without that option.
169          * 
170          * Ignored if the channel is negotiated to be announced, see
171          * [`ChannelConfig::announced_channel`] and
172          * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
173          * 
174          * Default value: false. This value is likely to change to true in the future.
175          * 
176          * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
177          * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
178          */
179         public void set_negotiate_scid_privacy(boolean val) {
180                 bindings.ChannelHandshakeConfig_set_negotiate_scid_privacy(this.ptr, val);
181                 Reference.reachabilityFence(this);
182                 Reference.reachabilityFence(val);
183         }
184
185         /**
186          * Constructs a new ChannelHandshakeConfig given each field
187          */
188         public static ChannelHandshakeConfig of(int minimum_depth_arg, short our_to_self_delay_arg, long our_htlc_minimum_msat_arg, boolean negotiate_scid_privacy_arg) {
189                 long ret = bindings.ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, negotiate_scid_privacy_arg);
190                 Reference.reachabilityFence(minimum_depth_arg);
191                 Reference.reachabilityFence(our_to_self_delay_arg);
192                 Reference.reachabilityFence(our_htlc_minimum_msat_arg);
193                 Reference.reachabilityFence(negotiate_scid_privacy_arg);
194                 if (ret >= 0 && ret <= 4096) { return null; }
195                 ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeConfig(null, ret); }
196                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
197                 return ret_hu_conv;
198         }
199
200         long clone_ptr() {
201                 long ret = bindings.ChannelHandshakeConfig_clone_ptr(this.ptr);
202                 Reference.reachabilityFence(this);
203                 return ret;
204         }
205
206         /**
207          * Creates a copy of the ChannelHandshakeConfig
208          */
209         public ChannelHandshakeConfig clone() {
210                 long ret = bindings.ChannelHandshakeConfig_clone(this.ptr);
211                 Reference.reachabilityFence(this);
212                 if (ret >= 0 && ret <= 4096) { return null; }
213                 ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeConfig(null, ret); }
214                 ret_hu_conv.ptrs_to.add(this);
215                 return ret_hu_conv;
216         }
217
218         /**
219          * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
220          */
221         public static ChannelHandshakeConfig with_default() {
222                 long ret = bindings.ChannelHandshakeConfig_default();
223                 if (ret >= 0 && ret <= 4096) { return null; }
224                 ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeConfig(null, ret); }
225                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
226                 return ret_hu_conv;
227         }
228
229 }