X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FChannelHandshakeConfig.java;fp=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FChannelHandshakeConfig.java;h=cea0ccc54fe02fa8f76462796e13c0a4ac7bb429;hb=2a8741cb87eb2b82381a6220a98f80f741147837;hp=f6a3bfb625d6a0f0c8b6a12fc1bf3f169df915c9;hpb=afb20259bc2191ba7525fe75cd48a49d63dcc2c5;p=ldk-java diff --git a/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java index f6a3bfb6..cea0ccc5 100644 --- a/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java +++ b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java @@ -27,7 +27,15 @@ public class ChannelHandshakeConfig extends CommonBase { * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the * equivalent limit applied to outbound channels). * + * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment + * transaction before operation. If you wish to accept channels with zero confirmations, see + * [`UserConfig::manually_accept_inbound_channels`] and + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]. + * * Default value: 6. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf */ public int get_minimum_depth() { int ret = bindings.ChannelHandshakeConfig_get_minimum_depth(this.ptr); @@ -40,7 +48,15 @@ public class ChannelHandshakeConfig extends CommonBase { * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the * equivalent limit applied to outbound channels). * + * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment + * transaction before operation. If you wish to accept channels with zero confirmations, see + * [`UserConfig::manually_accept_inbound_channels`] and + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]. + * * Default value: 6. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf */ public void set_minimum_depth(int val) { bindings.ChannelHandshakeConfig_set_minimum_depth(this.ptr, val); @@ -124,6 +140,68 @@ public class ChannelHandshakeConfig extends CommonBase { Reference.reachabilityFence(val); } + /** + * Sets the percentage of the channel value we will cap the total value of outstanding inbound + * HTLCs to. + * + * This can be set to a value between 1-100, where the value corresponds to the percent of the + * channel value in whole percentages. + * + * Note that: + * If configured to another value than the default value 10, any new channels created with + * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the + * `ChannelManager`. + * + * This caps the total value for inbound HTLCs in-flight only, and there's currently + * no way to configure the cap for the total value of outbound HTLCs in-flight. + * + * The requirements for your node being online to ensure the safety of HTLC-encumbered funds + * are different from the non-HTLC-encumbered funds. This makes this an important knob to + * restrict exposure to loss due to being offline for too long. + * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`] + * for more information. + * + * Default value: 10. + * Minimum value: 1, any values less than 1 will be treated as 1 instead. + * Maximum value: 100, any values larger than 100 will be treated as 100 instead. + */ + public byte get_max_inbound_htlc_value_in_flight_percent_of_channel() { + byte ret = bindings.ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Sets the percentage of the channel value we will cap the total value of outstanding inbound + * HTLCs to. + * + * This can be set to a value between 1-100, where the value corresponds to the percent of the + * channel value in whole percentages. + * + * Note that: + * If configured to another value than the default value 10, any new channels created with + * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the + * `ChannelManager`. + * + * This caps the total value for inbound HTLCs in-flight only, and there's currently + * no way to configure the cap for the total value of outbound HTLCs in-flight. + * + * The requirements for your node being online to ensure the safety of HTLC-encumbered funds + * are different from the non-HTLC-encumbered funds. This makes this an important knob to + * restrict exposure to loss due to being offline for too long. + * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`] + * for more information. + * + * Default value: 10. + * Minimum value: 1, any values less than 1 will be treated as 1 instead. + * Maximum value: 100, any values larger than 100 will be treated as 100 instead. + */ + public void set_max_inbound_htlc_value_in_flight_percent_of_channel(byte val) { + bindings.ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + /** * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the * BOLTs) option for outbound private channels. This provides better privacy by not including @@ -185,14 +263,15 @@ public class ChannelHandshakeConfig extends CommonBase { /** * Constructs a new ChannelHandshakeConfig given each field */ - 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) { - long ret = bindings.ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, negotiate_scid_privacy_arg); + public static ChannelHandshakeConfig of(int minimum_depth_arg, short our_to_self_delay_arg, long our_htlc_minimum_msat_arg, byte max_inbound_htlc_value_in_flight_percent_of_channel_arg, boolean negotiate_scid_privacy_arg) { + long ret = bindings.ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, max_inbound_htlc_value_in_flight_percent_of_channel_arg, negotiate_scid_privacy_arg); Reference.reachabilityFence(minimum_depth_arg); Reference.reachabilityFence(our_to_self_delay_arg); Reference.reachabilityFence(our_htlc_minimum_msat_arg); + Reference.reachabilityFence(max_inbound_htlc_value_in_flight_percent_of_channel_arg); Reference.reachabilityFence(negotiate_scid_privacy_arg); if (ret >= 0 && ret <= 4096) { return null; } - ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeConfig(null, ret); } + org.ldk.structs.ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelHandshakeConfig(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -210,7 +289,7 @@ public class ChannelHandshakeConfig extends CommonBase { long ret = bindings.ChannelHandshakeConfig_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeConfig(null, ret); } + org.ldk.structs.ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelHandshakeConfig(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -221,7 +300,7 @@ public class ChannelHandshakeConfig extends CommonBase { public static ChannelHandshakeConfig with_default() { long ret = bindings.ChannelHandshakeConfig_default(); if (ret >= 0 && ret <= 4096) { return null; } - ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeConfig(null, ret); } + org.ldk.structs.ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelHandshakeConfig(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; }