X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FChannelConfig.java;h=eaef6ab81e5c804ead7c6bcdc8f09d0be1a38118;hb=12c3ea6f32816f379249a75863971a1c7e1089a1;hp=f465f6cf27f82684a6fc9f536f1268c5c6cfc5e4;hpb=1b870a3ffab1c0024411e30102bc6d198300f095;p=ldk-java diff --git a/src/main/java/org/ldk/structs/ChannelConfig.java b/src/main/java/org/ldk/structs/ChannelConfig.java index f465f6cf..eaef6ab8 100644 --- a/src/main/java/org/ldk/structs/ChannelConfig.java +++ b/src/main/java/org/ldk/structs/ChannelConfig.java @@ -20,26 +20,116 @@ public class ChannelConfig extends CommonBase { } /** - * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi. + * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound + * over the channel. * This may be allowed to change at runtime in a later update, however doing so must result in * update messages sent to notify all nodes of our updated relay fee. * * Default value: 0. */ - public int get_fee_proportional_millionths() { - int ret = bindings.ChannelConfig_get_fee_proportional_millionths(this.ptr); + public int get_forwarding_fee_proportional_millionths() { + int ret = bindings.ChannelConfig_get_forwarding_fee_proportional_millionths(this.ptr); return ret; } /** - * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi. + * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound + * over the channel. * This may be allowed to change at runtime in a later update, however doing so must result in * update messages sent to notify all nodes of our updated relay fee. * * Default value: 0. */ - public void set_fee_proportional_millionths(int val) { - bindings.ChannelConfig_set_fee_proportional_millionths(this.ptr, val); + public void set_forwarding_fee_proportional_millionths(int val) { + bindings.ChannelConfig_set_forwarding_fee_proportional_millionths(this.ptr, val); + } + + /** + * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in + * excess of [`forwarding_fee_proportional_millionths`]. + * This may be allowed to change at runtime in a later update, however doing so must result in + * update messages sent to notify all nodes of our updated relay fee. + * + * The default value of a single satoshi roughly matches the market rate on many routing nodes + * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through + * this node. + * + * Default value: 1000. + * + * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + */ + public int get_forwarding_fee_base_msat() { + int ret = bindings.ChannelConfig_get_forwarding_fee_base_msat(this.ptr); + return ret; + } + + /** + * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in + * excess of [`forwarding_fee_proportional_millionths`]. + * This may be allowed to change at runtime in a later update, however doing so must result in + * update messages sent to notify all nodes of our updated relay fee. + * + * The default value of a single satoshi roughly matches the market rate on many routing nodes + * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through + * this node. + * + * Default value: 1000. + * + * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + */ + public void set_forwarding_fee_base_msat(int val) { + bindings.ChannelConfig_set_forwarding_fee_base_msat(this.ptr, val); + } + + /** + * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over + * the channel this config applies to. + * + * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight + * HTLC balance when a channel appears on-chain whereas + * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining + * (non-HTLC-encumbered) balance. + * + * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, + * we (or one of our watchtowers) MUST be online to check for broadcast of the current + * commitment transaction at least once per this many blocks (minus some margin to allow us + * enough time to broadcast and confirm a transaction, possibly with time in between to RBF + * the spending transaction). + * + * Default value: 72 (12 hours at an average of 6 blocks/hour). + * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as + * [`MIN_CLTV_EXPIRY_DELTA`] instead. + * + * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA + */ + public short get_cltv_expiry_delta() { + short ret = bindings.ChannelConfig_get_cltv_expiry_delta(this.ptr); + return ret; + } + + /** + * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over + * the channel this config applies to. + * + * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight + * HTLC balance when a channel appears on-chain whereas + * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining + * (non-HTLC-encumbered) balance. + * + * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, + * we (or one of our watchtowers) MUST be online to check for broadcast of the current + * commitment transaction at least once per this many blocks (minus some margin to allow us + * enough time to broadcast and confirm a transaction, possibly with time in between to RBF + * the spending transaction). + * + * Default value: 72 (12 hours at an average of 6 blocks/hour). + * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as + * [`MIN_CLTV_EXPIRY_DELTA`] instead. + * + * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA + */ + public void set_cltv_expiry_delta(short val) { + bindings.ChannelConfig_set_cltv_expiry_delta(this.ptr, val); } /** @@ -49,7 +139,7 @@ public class ChannelConfig extends CommonBase { * This should only be set to true for nodes which expect to be online reliably. * * As the node which funds a channel picks this value this will only apply for new outbound - * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set. + * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. * * This cannot be changed after the initial channel handshake. * @@ -67,7 +157,7 @@ public class ChannelConfig extends CommonBase { * This should only be set to true for nodes which expect to be online reliably. * * As the node which funds a channel picks this value this will only apply for new outbound - * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set. + * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. * * This cannot be changed after the initial channel handshake. * @@ -115,8 +205,8 @@ public class ChannelConfig extends CommonBase { /** * Constructs a new ChannelConfig given each field */ - public static ChannelConfig constructor_new(int fee_proportional_millionths_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg) { - long ret = bindings.ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg); + public static ChannelConfig of(int forwarding_fee_proportional_millionths_arg, int forwarding_fee_base_msat_arg, short cltv_expiry_delta_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg) { + long ret = bindings.ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg); ChannelConfig ret_hu_conv = new ChannelConfig(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; @@ -133,9 +223,9 @@ public class ChannelConfig extends CommonBase { } /** - * Creates a "default" ChannelConfig. See other documentaiton for details on what this implies. + * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used. */ - public static ChannelConfig constructor_default() { + public static ChannelConfig with_default() { long ret = bindings.ChannelConfig_default(); ChannelConfig ret_hu_conv = new ChannelConfig(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -153,7 +243,7 @@ public class ChannelConfig extends CommonBase { /** * Read a ChannelConfig from a byte array, created by ChannelConfig_write */ - public static Result_ChannelConfigDecodeErrorZ constructor_read(byte[] ser) { + public static Result_ChannelConfigDecodeErrorZ read(byte[] ser) { long ret = bindings.ChannelConfig_read(ser); Result_ChannelConfigDecodeErrorZ ret_hu_conv = Result_ChannelConfigDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv;