X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FChannelConfig.java;h=37f2bbde8c1ed96ee0528372114356014eef16e5;hb=f385eff0dd0aa61fbf21ae946c424f4a6a26de04;hp=26bcff3daf654ddf507c8ef8b124b630c9cf4dbb;hpb=1d0c372339e4d0148449728072c95964088412c4;p=ldk-java diff --git a/src/main/java/org/ldk/structs/ChannelConfig.java b/src/main/java/org/ldk/structs/ChannelConfig.java index 26bcff3d..37f2bbde 100644 --- a/src/main/java/org/ldk/structs/ChannelConfig.java +++ b/src/main/java/org/ldk/structs/ChannelConfig.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -30,6 +31,7 @@ public class ChannelConfig extends CommonBase { */ public int get_forwarding_fee_proportional_millionths() { int ret = bindings.ChannelConfig_get_forwarding_fee_proportional_millionths(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -43,6 +45,8 @@ public class ChannelConfig extends CommonBase { */ public void set_forwarding_fee_proportional_millionths(int val) { bindings.ChannelConfig_set_forwarding_fee_proportional_millionths(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -61,6 +65,7 @@ public class ChannelConfig extends CommonBase { */ public int get_forwarding_fee_base_msat() { int ret = bindings.ChannelConfig_get_forwarding_fee_base_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,8 @@ public class ChannelConfig extends CommonBase { */ public void set_forwarding_fee_base_msat(int val) { bindings.ChannelConfig_set_forwarding_fee_base_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -105,6 +112,7 @@ public class ChannelConfig extends CommonBase { */ public short get_cltv_expiry_delta() { short ret = bindings.ChannelConfig_get_cltv_expiry_delta(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -131,76 +139,8 @@ public class ChannelConfig extends CommonBase { */ public void set_cltv_expiry_delta(short val) { bindings.ChannelConfig_set_cltv_expiry_delta(this.ptr, val); - } - - /** - * Set to announce the channel publicly and notify all nodes that they can route via this - * channel. - * - * 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_preference`] is set. - * - * This cannot be changed after the initial channel handshake. - * - * Default value: false. - */ - public boolean get_announced_channel() { - boolean ret = bindings.ChannelConfig_get_announced_channel(this.ptr); - return ret; - } - - /** - * Set to announce the channel publicly and notify all nodes that they can route via this - * channel. - * - * 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_preference`] is set. - * - * This cannot be changed after the initial channel handshake. - * - * Default value: false. - */ - public void set_announced_channel(boolean val) { - bindings.ChannelConfig_set_announced_channel(this.ptr, val); - } - - /** - * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty - * supports it, they will then enforce the mutual-close output to us matches what we provided - * at intialization, preventing us from closing to an alternate pubkey. - * - * This is set to true by default to provide a slight increase in security, though ultimately - * any attacker who is able to take control of a channel can just as easily send the funds via - * lightning payments, so we never require that our counterparties support this option. - * - * This cannot be changed after a channel has been initialized. - * - * Default value: true. - */ - public boolean get_commit_upfront_shutdown_pubkey() { - boolean ret = bindings.ChannelConfig_get_commit_upfront_shutdown_pubkey(this.ptr); - return ret; - } - - /** - * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty - * supports it, they will then enforce the mutual-close output to us matches what we provided - * at intialization, preventing us from closing to an alternate pubkey. - * - * This is set to true by default to provide a slight increase in security, though ultimately - * any attacker who is able to take control of a channel can just as easily send the funds via - * lightning payments, so we never require that our counterparties support this option. - * - * This cannot be changed after a channel has been initialized. - * - * Default value: true. - */ - public void set_commit_upfront_shutdown_pubkey(boolean val) { - bindings.ChannelConfig_set_commit_upfront_shutdown_pubkey(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -222,6 +162,7 @@ public class ChannelConfig extends CommonBase { */ public long get_max_dust_htlc_exposure_msat() { long ret = bindings.ChannelConfig_get_max_dust_htlc_exposure_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -244,6 +185,8 @@ public class ChannelConfig extends CommonBase { */ public void set_max_dust_htlc_exposure_msat(long val) { bindings.ChannelConfig_set_max_dust_htlc_exposure_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -272,6 +215,7 @@ public class ChannelConfig extends CommonBase { */ public long get_force_close_avoidance_max_fee_satoshis() { long ret = bindings.ChannelConfig_get_force_close_avoidance_max_fee_satoshis(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -301,27 +245,41 @@ public class ChannelConfig extends CommonBase { */ public void set_force_close_avoidance_max_fee_satoshis(long val) { bindings.ChannelConfig_set_force_close_avoidance_max_fee_satoshis(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** * Constructs a new ChannelConfig given each field */ - 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 max_dust_htlc_exposure_msat_arg, long force_close_avoidance_max_fee_satoshis_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, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg); - if (ret < 1024) { return null; } - ChannelConfig ret_hu_conv = new ChannelConfig(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); + public static ChannelConfig of(int forwarding_fee_proportional_millionths_arg, int forwarding_fee_base_msat_arg, short cltv_expiry_delta_arg, long max_dust_htlc_exposure_msat_arg, long force_close_avoidance_max_fee_satoshis_arg) { + long ret = bindings.ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg); + Reference.reachabilityFence(forwarding_fee_proportional_millionths_arg); + Reference.reachabilityFence(forwarding_fee_base_msat_arg); + Reference.reachabilityFence(cltv_expiry_delta_arg); + Reference.reachabilityFence(max_dust_htlc_exposure_msat_arg); + Reference.reachabilityFence(force_close_avoidance_max_fee_satoshis_arg); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelConfig(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; return ret_hu_conv; } + long clone_ptr() { + long ret = bindings.ChannelConfig_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Creates a copy of the ChannelConfig */ public ChannelConfig clone() { long ret = bindings.ChannelConfig_clone(this.ptr); - if (ret < 1024) { return null; } - ChannelConfig ret_hu_conv = new ChannelConfig(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelConfig(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -330,9 +288,9 @@ public class ChannelConfig extends CommonBase { */ public static ChannelConfig with_default() { long ret = bindings.ChannelConfig_default(); - if (ret < 1024) { return null; } - ChannelConfig ret_hu_conv = new ChannelConfig(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelConfig(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; return ret_hu_conv; } @@ -341,6 +299,7 @@ public class ChannelConfig extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ChannelConfig_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -349,7 +308,8 @@ public class ChannelConfig extends CommonBase { */ public static Result_ChannelConfigDecodeErrorZ read(byte[] ser) { long ret = bindings.ChannelConfig_read(ser); - if (ret < 1024) { return null; } + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelConfigDecodeErrorZ ret_hu_conv = Result_ChannelConfigDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; }