1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * Configuration we set when applicable.
12 * Default::default() provides sane defaults.
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 {
20 if (ptr != 0) { bindings.ChannelHandshakeConfig_free(ptr); }
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).
30 public int get_minimum_depth() {
31 int ret = bindings.ChannelHandshakeConfig_get_minimum_depth(this.ptr);
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).
42 public void set_minimum_depth(int val) {
43 bindings.ChannelHandshakeConfig_set_minimum_depth(this.ptr, val);
47 * Set to the amount of time we require our counterparty to wait to claim their money.
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.
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
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.
60 public short get_our_to_self_delay() {
61 short ret = bindings.ChannelHandshakeConfig_get_our_to_self_delay(this.ptr);
66 * Set to the amount of time we require our counterparty to wait to claim their money.
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.
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
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.
79 public void set_our_to_self_delay(short val) {
80 bindings.ChannelHandshakeConfig_set_our_to_self_delay(this.ptr, val);
84 * Set to the smallest value HTLC we will accept to process.
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.
89 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
92 public long get_our_htlc_minimum_msat() {
93 long ret = bindings.ChannelHandshakeConfig_get_our_htlc_minimum_msat(this.ptr);
98 * Set to the smallest value HTLC we will accept to process.
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.
103 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
106 public void set_our_htlc_minimum_msat(long val) {
107 bindings.ChannelHandshakeConfig_set_our_htlc_minimum_msat(this.ptr, val);
111 * Constructs a new ChannelHandshakeConfig given each field
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);
121 * Creates a copy of the ChannelHandshakeConfig
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);
131 * Creates a "default" ChannelHandshakeConfig. See other documentaiton for details on what this implies.
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);