X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FChannelHandshakeConfig.java;h=f89b9a05654d7bbb1213e2e295a0c245e2d1cc1d;hb=65a17b9ef4884736783566e30e075ca59b472cc7;hp=2b1a7eeedc1fd065e80c1f0770e830cf95ed413b;hpb=7926bd31d1152339c3f1e26b5f70900981c53599;p=ldk-java diff --git a/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java index 2b1a7eee..f89b9a05 100644 --- a/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java +++ b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java @@ -44,18 +44,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 +66,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 +116,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,6 +129,7 @@ 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; @@ -130,8 +138,9 @@ public class ChannelHandshakeConfig extends CommonBase { /** * 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;