- public void set_force_announced_channel_preference(ChannelHandshakeLimits this_ptr, boolean val) {
- bindings.ChannelHandshakeLimits_set_force_announced_channel_preference(this_ptr == null ? 0 : this_ptr.ptr & ~1, val);
- this.ptrs_to.add(this_ptr);
- }
-
- public short get_their_to_self_delay(ChannelHandshakeLimits this_ptr) {
- short ret = bindings.ChannelHandshakeLimits_get_their_to_self_delay(this_ptr == null ? 0 : this_ptr.ptr & ~1);
- this.ptrs_to.add(this_ptr);
- return ret;
- }
-
- public void set_their_to_self_delay(ChannelHandshakeLimits this_ptr, short val) {
- bindings.ChannelHandshakeLimits_set_their_to_self_delay(this_ptr == null ? 0 : this_ptr.ptr & ~1, val);
- this.ptrs_to.add(this_ptr);
- }
-
- public ChannelHandshakeLimits(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) {
- super(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));
- }
-
- public ChannelHandshakeLimits() {
- super(bindings.ChannelHandshakeLimits_default());
+ /**
+ * Set to the amount of time we're willing to wait to claim money back to us.
+ *
+ * Not checking this value would be a security issue, as our peer would be able to set it to
+ * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
+ *
+ * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
+ * reduce the loss of having useless locked funds (if your peer accepts)
+ */
+ public void set_their_to_self_delay(short val) {
+ bindings.ChannelHandshakeLimits_set_their_to_self_delay(this.ptr, val);
+ }
+
+ /**
+ * Constructs a new ChannelHandshakeLimits given each field
+ */
+ public static ChannelHandshakeLimits of(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, int max_minimum_depth_arg, boolean force_announced_channel_preference_arg, short their_to_self_delay_arg) {
+ 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, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ ChannelHandshakeLimits ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeLimits(null, ret); }
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Creates a copy of the ChannelHandshakeLimits
+ */
+ public ChannelHandshakeLimits clone() {
+ long ret = bindings.ChannelHandshakeLimits_clone(this.ptr);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ ChannelHandshakeLimits ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeLimits(null, ret); }
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
+ */
+ public static ChannelHandshakeLimits with_default() {
+ long ret = bindings.ChannelHandshakeLimits_default();
+ if (ret >= 0 && ret <= 4096) { return null; }
+ ChannelHandshakeLimits ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeLimits(null, ret); }
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;