Update java bindings with new generator and new upstream code
[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 amount of time we require our counterparty to wait to claim their money.
48          * 
49          * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
50          * be online to check for peer having broadcast a revoked transaction to steal our funds
51          * at least once every our_to_self_delay blocks.
52          * 
53          * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
54          * case of an honest unilateral channel close, which implicitly decrease the economic value of
55          * our channel.
56          * 
57          * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
58          * opening so you can tweak config to ask for more security, not less.
59          */
60         public short get_our_to_self_delay() {
61                 short ret = bindings.ChannelHandshakeConfig_get_our_to_self_delay(this.ptr);
62                 return ret;
63         }
64
65         /**
66          * Set to the amount of time we require our counterparty to wait to claim their money.
67          * 
68          * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
69          * be online to check for peer having broadcast a revoked transaction to steal our funds
70          * at least once every our_to_self_delay blocks.
71          * 
72          * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
73          * case of an honest unilateral channel close, which implicitly decrease the economic value of
74          * our channel.
75          * 
76          * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
77          * opening so you can tweak config to ask for more security, not less.
78          */
79         public void set_our_to_self_delay(short val) {
80                 bindings.ChannelHandshakeConfig_set_our_to_self_delay(this.ptr, val);
81         }
82
83         /**
84          * Set to the smallest value HTLC we will accept to process.
85          * 
86          * This value is sent to our counterparty on channel-open and we close the channel any time
87          * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
88          * 
89          * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
90          * by the protocol.
91          */
92         public long get_our_htlc_minimum_msat() {
93                 long ret = bindings.ChannelHandshakeConfig_get_our_htlc_minimum_msat(this.ptr);
94                 return ret;
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 void set_our_htlc_minimum_msat(long val) {
107                 bindings.ChannelHandshakeConfig_set_our_htlc_minimum_msat(this.ptr, val);
108         }
109
110         /**
111          * Constructs a new ChannelHandshakeConfig given each field
112          */
113         public static ChannelHandshakeConfig constructor_new(int minimum_depth_arg, short our_to_self_delay_arg, long our_htlc_minimum_msat_arg) {
114                 long ret = bindings.ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
115                 ChannelHandshakeConfig ret_hu_conv = new ChannelHandshakeConfig(null, ret);
116                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
117                 return ret_hu_conv;
118         }
119
120         /**
121          * Creates a copy of the ChannelHandshakeConfig
122          */
123         public ChannelHandshakeConfig clone() {
124                 long ret = bindings.ChannelHandshakeConfig_clone(this.ptr);
125                 ChannelHandshakeConfig ret_hu_conv = new ChannelHandshakeConfig(null, ret);
126                 ret_hu_conv.ptrs_to.add(this);
127                 return ret_hu_conv;
128         }
129
130         /**
131          * Creates a "default" ChannelHandshakeConfig. See other documentaiton for details on what this implies.
132          */
133         public static ChannelHandshakeConfig constructor_default() {
134                 long ret = bindings.ChannelHandshakeConfig_default();
135                 ChannelHandshakeConfig ret_hu_conv = new ChannelHandshakeConfig(null, ret);
136                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
137                 return ret_hu_conv;
138         }
139
140 }