X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FChannelHandshakeConfig.java;h=633a36772d9a05d9a06ef2f014f49b6ce1492651;hb=db1a11032b4164540a2d3403696be12bbca70e94;hp=3bab616c0c8c5990e23fcc475dbb8850c2757465;hpb=1b870a3ffab1c0024411e30102bc6d198300f095;p=ldk-java diff --git a/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java index 3bab616c..633a3677 100644 --- a/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java +++ b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import javax.annotation.Nullable; /** @@ -44,18 +45,21 @@ public class ChannelHandshakeConfig extends CommonBase { } /** - * Set to the amount of time we require our counterparty to wait to claim their money. + * Set to the number of blocks we require our counterparty to wait to claim their money (ie + * the number of blocks we have to punish our counterparty if they broadcast a revoked + * transaction). * - * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST - * be online to check for peer having broadcast a revoked transaction to steal our funds - * at least once every our_to_self_delay blocks. + * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST + * be online to check for revoked transactions on-chain at least once every our_to_self_delay + * 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). * * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in * case of an honest unilateral channel close, which implicitly decrease the economic value of * our channel. * - * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel - * opening so you can tweak config to ask for more security, not less. + * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you + * can tweak config to ask for more security, not less. */ public short get_our_to_self_delay() { short ret = bindings.ChannelHandshakeConfig_get_our_to_self_delay(this.ptr); @@ -63,18 +67,21 @@ public class ChannelHandshakeConfig extends CommonBase { } /** - * Set to the amount of time we require our counterparty to wait to claim their money. + * Set to the number of blocks we require our counterparty to wait to claim their money (ie + * the number of blocks we have to punish our counterparty if they broadcast a revoked + * transaction). * - * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST - * be online to check for peer having broadcast a revoked transaction to steal our funds - * at least once every our_to_self_delay blocks. + * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST + * be online to check for revoked transactions on-chain at least once every our_to_self_delay + * 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). * * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in * case of an honest unilateral channel close, which implicitly decrease the economic value of * our channel. * - * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel - * opening so you can tweak config to ask for more security, not less. + * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you + * can tweak config to ask for more security, not less. */ public void set_our_to_self_delay(short val) { bindings.ChannelHandshakeConfig_set_our_to_self_delay(this.ptr, val); @@ -110,8 +117,9 @@ public class ChannelHandshakeConfig extends CommonBase { /** * Constructs a new ChannelHandshakeConfig given each field */ - public static ChannelHandshakeConfig constructor_new(int minimum_depth_arg, short our_to_self_delay_arg, long our_htlc_minimum_msat_arg) { + public static ChannelHandshakeConfig of(int minimum_depth_arg, short our_to_self_delay_arg, long our_htlc_minimum_msat_arg) { long ret = bindings.ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg); + if (ret < 1024) { return null; } ChannelHandshakeConfig ret_hu_conv = new ChannelHandshakeConfig(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; @@ -122,16 +130,18 @@ public class ChannelHandshakeConfig extends CommonBase { */ public ChannelHandshakeConfig clone() { long ret = bindings.ChannelHandshakeConfig_clone(this.ptr); + if (ret < 1024) { return null; } ChannelHandshakeConfig ret_hu_conv = new ChannelHandshakeConfig(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } /** - * Creates a "default" ChannelHandshakeConfig. See other documentaiton for details on what this implies. + * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used. */ - public static ChannelHandshakeConfig constructor_default() { + public static ChannelHandshakeConfig with_default() { long ret = bindings.ChannelHandshakeConfig_default(); + if (ret < 1024) { return null; } ChannelHandshakeConfig ret_hu_conv = new ChannelHandshakeConfig(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv;