1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * Optional channel limits which are applied during channel creation.
12 * These limits are only applied to our counterparty's limits, not our own.
14 * Use 0/<type>::max_value() as appropriate to skip checking.
16 * Provides sane defaults for most configurations.
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.
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 {
28 if (ptr != 0) { bindings.ChannelHandshakeLimits_free(ptr); }
32 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
33 * only applies to inbound channels.
37 public long get_min_funding_satoshis() {
38 long ret = bindings.ChannelHandshakeLimits_get_min_funding_satoshis(this.ptr);
43 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
44 * only applies to inbound channels.
48 public void set_min_funding_satoshis(long val) {
49 bindings.ChannelHandshakeLimits_set_min_funding_satoshis(this.ptr, val);
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.
56 * Default value: u64::max_value.
58 public long get_max_htlc_minimum_msat() {
59 long ret = bindings.ChannelHandshakeLimits_get_max_htlc_minimum_msat(this.ptr);
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.
67 * Default value: u64::max_value.
69 public void set_max_htlc_minimum_msat(long val) {
70 bindings.ChannelHandshakeLimits_set_max_htlc_minimum_msat(this.ptr, val);
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.
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);
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.
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);
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).
99 * Default value: u64::max_value.
101 public long get_max_channel_reserve_satoshis() {
102 long ret = bindings.ChannelHandshakeLimits_get_max_channel_reserve_satoshis(this.ptr);
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).
111 * Default value: u64::max_value.
113 public void set_max_channel_reserve_satoshis(long val) {
114 bindings.ChannelHandshakeLimits_set_max_channel_reserve_satoshis(this.ptr, val);
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.
123 public short get_min_max_accepted_htlcs() {
124 short ret = bindings.ChannelHandshakeLimits_get_min_max_accepted_htlcs(this.ptr);
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.
134 public void set_min_max_accepted_htlcs(short val) {
135 bindings.ChannelHandshakeLimits_set_min_max_accepted_htlcs(this.ptr, val);
139 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
140 * required to always be higher than this value so this only applies to HTLC outputs (and
141 * potentially to-self outputs before any payments have been made).
142 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
143 * This setting allows you to set a minimum dust limit for their commitment transactions,
144 * reflecting the reality that tiny outputs are not considered standard transactions and will
145 * not propagate through the Bitcoin network.
147 * Default value: 546, the current dust limit on the Bitcoin network.
149 public long get_min_dust_limit_satoshis() {
150 long ret = bindings.ChannelHandshakeLimits_get_min_dust_limit_satoshis(this.ptr);
155 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
156 * required to always be higher than this value so this only applies to HTLC outputs (and
157 * potentially to-self outputs before any payments have been made).
158 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
159 * This setting allows you to set a minimum dust limit for their commitment transactions,
160 * reflecting the reality that tiny outputs are not considered standard transactions and will
161 * not propagate through the Bitcoin network.
163 * Default value: 546, the current dust limit on the Bitcoin network.
165 public void set_min_dust_limit_satoshis(long val) {
166 bindings.ChannelHandshakeLimits_set_min_dust_limit_satoshis(this.ptr, val);
170 * Maximum allowed threshold above which outputs will not be generated in their commitment
172 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
174 * Default value: u64::max_value.
176 public long get_max_dust_limit_satoshis() {
177 long ret = bindings.ChannelHandshakeLimits_get_max_dust_limit_satoshis(this.ptr);
182 * Maximum allowed threshold above which outputs will not be generated in their commitment
184 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
186 * Default value: u64::max_value.
188 public void set_max_dust_limit_satoshis(long val) {
189 bindings.ChannelHandshakeLimits_set_max_dust_limit_satoshis(this.ptr, val);
193 * Before a channel is usable the funding transaction will need to be confirmed by at least a
194 * certain number of blocks, specified by the node which is not the funder (as the funder can
195 * assume they aren't going to double-spend themselves).
196 * This config allows you to set a limit on the maximum amount of time to wait.
198 * Default value: 144, or roughly one day and only applies to outbound channels.
200 public int get_max_minimum_depth() {
201 int ret = bindings.ChannelHandshakeLimits_get_max_minimum_depth(this.ptr);
206 * Before a channel is usable the funding transaction will need to be confirmed by at least a
207 * certain number of blocks, specified by the node which is not the funder (as the funder can
208 * assume they aren't going to double-spend themselves).
209 * This config allows you to set a limit on the maximum amount of time to wait.
211 * Default value: 144, or roughly one day and only applies to outbound channels.
213 public void set_max_minimum_depth(int val) {
214 bindings.ChannelHandshakeLimits_set_max_minimum_depth(this.ptr, val);
218 * Set to force the incoming channel to match our announced channel preference in
221 * Default value: true, to make the default that no announced channels are possible (which is
222 * appropriate for any nodes which are not online very reliably).
224 public boolean get_force_announced_channel_preference() {
225 boolean ret = bindings.ChannelHandshakeLimits_get_force_announced_channel_preference(this.ptr);
230 * Set to force the incoming channel to match our announced channel preference in
233 * Default value: true, to make the default that no announced channels are possible (which is
234 * appropriate for any nodes which are not online very reliably).
236 public void set_force_announced_channel_preference(boolean val) {
237 bindings.ChannelHandshakeLimits_set_force_announced_channel_preference(this.ptr, val);
241 * Set to the amount of time we're willing to wait to claim money back to us.
243 * Not checking this value would be a security issue, as our peer would be able to set it to
244 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
246 * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
247 * reduce the loss of having useless locked funds (if your peer accepts)
249 public short get_their_to_self_delay() {
250 short ret = bindings.ChannelHandshakeLimits_get_their_to_self_delay(this.ptr);
255 * Set to the amount of time we're willing to wait to claim money back to us.
257 * Not checking this value would be a security issue, as our peer would be able to set it to
258 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
260 * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
261 * reduce the loss of having useless locked funds (if your peer accepts)
263 public void set_their_to_self_delay(short val) {
264 bindings.ChannelHandshakeLimits_set_their_to_self_delay(this.ptr, val);
268 * Constructs a new ChannelHandshakeLimits given each field
270 public static ChannelHandshakeLimits constructor_new(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, long min_dust_limit_satoshis_arg, long max_dust_limit_satoshis_arg, int max_minimum_depth_arg, boolean force_announced_channel_preference_arg, short their_to_self_delay_arg) {
271 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, min_dust_limit_satoshis_arg, max_dust_limit_satoshis_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
272 ChannelHandshakeLimits ret_hu_conv = new ChannelHandshakeLimits(null, ret);
273 ret_hu_conv.ptrs_to.add(ret_hu_conv);
278 * Creates a copy of the ChannelHandshakeLimits
280 public ChannelHandshakeLimits clone() {
281 long ret = bindings.ChannelHandshakeLimits_clone(this.ptr);
282 ChannelHandshakeLimits ret_hu_conv = new ChannelHandshakeLimits(null, ret);
283 ret_hu_conv.ptrs_to.add(this);
288 * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
290 public static ChannelHandshakeLimits constructor_default() {
291 long ret = bindings.ChannelHandshakeLimits_default();
292 ChannelHandshakeLimits ret_hu_conv = new ChannelHandshakeLimits(null, ret);
293 ret_hu_conv.ptrs_to.add(ret_hu_conv);