Update auto-updated Java files
[ldk-java] / src / main / java / org / ldk / structs / ChannelConfig.java
index 51680d6a39fbeb3778cd2a9ecf571d326ea11865..eda992d4c56554fb2828b17c474bc0f830f748eb 100644 (file)
@@ -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,6 +139,8 @@ public class ChannelConfig extends CommonBase {
         */
        public void set_cltv_expiry_delta(short val) {
                bindings.ChannelConfig_set_cltv_expiry_delta(this.ptr, val);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(val);
        }
 
        /**
@@ -148,6 +158,7 @@ public class ChannelConfig extends CommonBase {
         */
        public boolean get_announced_channel() {
                boolean ret = bindings.ChannelConfig_get_announced_channel(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -166,6 +177,8 @@ public class ChannelConfig extends CommonBase {
         */
        public void set_announced_channel(boolean val) {
                bindings.ChannelConfig_set_announced_channel(this.ptr, val);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(val);
        }
 
        /**
@@ -183,6 +196,7 @@ public class ChannelConfig extends CommonBase {
         */
        public boolean get_commit_upfront_shutdown_pubkey() {
                boolean ret = bindings.ChannelConfig_get_commit_upfront_shutdown_pubkey(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -201,26 +215,148 @@ public class ChannelConfig extends CommonBase {
         */
        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);
+       }
+
+       /**
+        * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
+        * small to claim on-chain.
+        * 
+        * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
+        * not be claimable on-chain, instead being turned into additional miner fees if either
+        * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
+        * to such payments may be sustantial if there are many dust HTLCs present when the
+        * channel is force-closed.
+        * 
+        * This limit is applied for sent, forwarded, and received HTLCs and limits the total
+        * exposure across all three types per-channel. Setting this too low may prevent the
+        * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
+        * important to prevent stealing of dust HTLCs by miners.
+        * 
+        * Default value: 5_000_000 msat.
+        */
+       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;
+       }
+
+       /**
+        * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
+        * small to claim on-chain.
+        * 
+        * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
+        * not be claimable on-chain, instead being turned into additional miner fees if either
+        * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
+        * to such payments may be sustantial if there are many dust HTLCs present when the
+        * channel is force-closed.
+        * 
+        * This limit is applied for sent, forwarded, and received HTLCs and limits the total
+        * exposure across all three types per-channel. Setting this too low may prevent the
+        * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
+        * important to prevent stealing of dust HTLCs by miners.
+        * 
+        * Default value: 5_000_000 msat.
+        */
+       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);
+       }
+
+       /**
+        * The additional fee we're willing to pay to avoid waiting for the counterparty's
+        * `to_self_delay` to reclaim funds.
+        * 
+        * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
+        * closing transaction which both sides find acceptable, ultimately paid by the channel
+        * funder/initiator.
+        * 
+        * When we are the funder, because we have to pay the channel closing fee, we bound the
+        * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
+        * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
+        * [`Normal`] feerate during normal operation, this value represents the additional fee we're
+        * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
+        * funds.
+        * 
+        * When we are not the funder, we require the closing transaction fee pay at least our
+        * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
+        * Thus, this value is ignored when we are not the funder.
+        * 
+        * Default value: 1000 satoshis.
+        * 
+        * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
+        * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
+        */
+       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;
+       }
+
+       /**
+        * The additional fee we're willing to pay to avoid waiting for the counterparty's
+        * `to_self_delay` to reclaim funds.
+        * 
+        * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
+        * closing transaction which both sides find acceptable, ultimately paid by the channel
+        * funder/initiator.
+        * 
+        * When we are the funder, because we have to pay the channel closing fee, we bound the
+        * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
+        * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
+        * [`Normal`] feerate during normal operation, this value represents the additional fee we're
+        * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
+        * funds.
+        * 
+        * When we are not the funder, we require the closing transaction fee pay at least our
+        * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
+        * Thus, this value is ignored when we are not the funder.
+        * 
+        * Default value: 1000 satoshis.
+        * 
+        * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
+        * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
+        */
+       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 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);
-               if (ret < 1024) { return null; }
-               ChannelConfig ret_hu_conv = new ChannelConfig(null, ret);
+       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);
+               Reference.reachabilityFence(forwarding_fee_proportional_millionths_arg);
+               Reference.reachabilityFence(forwarding_fee_base_msat_arg);
+               Reference.reachabilityFence(cltv_expiry_delta_arg);
+               Reference.reachabilityFence(announced_channel_arg);
+               Reference.reachabilityFence(commit_upfront_shutdown_pubkey_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; }
+               ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelConfig(null, ret); }
                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);
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelConfig(null, ret); }
                ret_hu_conv.ptrs_to.add(this);
                return ret_hu_conv;
        }
@@ -230,8 +366,8 @@ 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);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelConfig(null, ret); }
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
                return ret_hu_conv;
        }
@@ -241,6 +377,7 @@ public class ChannelConfig extends CommonBase {
         */
        public byte[] write() {
                byte[] ret = bindings.ChannelConfig_write(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -249,7 +386,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;
        }