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
8
9 /**
10  * Configuration we set when applicable.
11  * 
12  * Default::default() provides sane defaults.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class ChannelHandshakeConfig extends CommonBase {
16         ChannelHandshakeConfig(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.ChannelHandshakeConfig_free(ptr); }
21         }
22
23         /**
24          * Confirmations we will wait for before considering the channel locked in.
25          * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
26          * equivalent limit applied to outbound channels).
27          * 
28          * Default value: 6.
29          */
30         public int get_minimum_depth() {
31                 int ret = bindings.ChannelHandshakeConfig_get_minimum_depth(this.ptr);
32                 return ret;
33         }
34
35         /**
36          * Confirmations we will wait for before considering the channel locked in.
37          * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
38          * equivalent limit applied to outbound channels).
39          * 
40          * Default value: 6.
41          */
42         public void set_minimum_depth(int val) {
43                 bindings.ChannelHandshakeConfig_set_minimum_depth(this.ptr, val);
44         }
45
46         /**
47          * Set to the number of blocks we require our counterparty to wait to claim their money (ie
48          * the number of blocks we have to punish our counterparty if they broadcast a revoked
49          * transaction).
50          * 
51          * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
52          * be online to check for revoked transactions on-chain at least once every our_to_self_delay
53          * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
54          * possibly with time in between to RBF the spending transaction).
55          * 
56          * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
57          * case of an honest unilateral channel close, which implicitly decrease the economic value of
58          * our channel.
59          * 
60          * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
61          * can tweak config to ask for more security, not less.
62          */
63         public short get_our_to_self_delay() {
64                 short ret = bindings.ChannelHandshakeConfig_get_our_to_self_delay(this.ptr);
65                 return ret;
66         }
67
68         /**
69          * Set to the number of blocks we require our counterparty to wait to claim their money (ie
70          * the number of blocks we have to punish our counterparty if they broadcast a revoked
71          * transaction).
72          * 
73          * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
74          * be online to check for revoked transactions on-chain at least once every our_to_self_delay
75          * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
76          * possibly with time in between to RBF the spending transaction).
77          * 
78          * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
79          * case of an honest unilateral channel close, which implicitly decrease the economic value of
80          * our channel.
81          * 
82          * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
83          * can tweak config to ask for more security, not less.
84          */
85         public void set_our_to_self_delay(short val) {
86                 bindings.ChannelHandshakeConfig_set_our_to_self_delay(this.ptr, val);
87         }
88
89         /**
90          * Set to the smallest value HTLC we will accept to process.
91          * 
92          * This value is sent to our counterparty on channel-open and we close the channel any time
93          * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
94          * 
95          * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
96          * by the protocol.
97          */
98         public long get_our_htlc_minimum_msat() {
99                 long ret = bindings.ChannelHandshakeConfig_get_our_htlc_minimum_msat(this.ptr);
100                 return ret;
101         }
102
103         /**
104          * Set to the smallest value HTLC we will accept to process.
105          * 
106          * This value is sent to our counterparty on channel-open and we close the channel any time
107          * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
108          * 
109          * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
110          * by the protocol.
111          */
112         public void set_our_htlc_minimum_msat(long val) {
113                 bindings.ChannelHandshakeConfig_set_our_htlc_minimum_msat(this.ptr, val);
114         }
115
116         /**
117          * Constructs a new ChannelHandshakeConfig given each field
118          */
119         public static ChannelHandshakeConfig of(int minimum_depth_arg, short our_to_self_delay_arg, long our_htlc_minimum_msat_arg) {
120                 long ret = bindings.ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
121                 ChannelHandshakeConfig ret_hu_conv = new ChannelHandshakeConfig(null, ret);
122                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
123                 return ret_hu_conv;
124         }
125
126         /**
127          * Creates a copy of the ChannelHandshakeConfig
128          */
129         public ChannelHandshakeConfig clone() {
130                 long ret = bindings.ChannelHandshakeConfig_clone(this.ptr);
131                 ChannelHandshakeConfig ret_hu_conv = new ChannelHandshakeConfig(null, ret);
132                 ret_hu_conv.ptrs_to.add(this);
133                 return ret_hu_conv;
134         }
135
136         /**
137          * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
138          */
139         public static ChannelHandshakeConfig with_default() {
140                 long ret = bindings.ChannelHandshakeConfig_default();
141                 ChannelHandshakeConfig ret_hu_conv = new ChannelHandshakeConfig(null, ret);
142                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
143                 return ret_hu_conv;
144         }
145
146 }