[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ChannelConfig.cs
index 197e2ad7d1743e2734da7838b9940eb205b8caea..da4589dcc5ce4bf3f6dba7d12bffee0242e9b322 100644 (file)
@@ -152,19 +152,22 @@ public class ChannelConfig : CommonBase {
         * channel negotiated throughout the channel open process, along with the fees required to have
         * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
         * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
-        * account the HTLC transaction fee as it is zero.
+        * account the HTLC transaction fee as it is zero. Because of this, you may want to set this
+        * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier
+        * variant is primarily intended for use with pre-anchor channels.
         * 
-        * 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.
+        * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total
+        * exposure across all three types per-channel.
         * 
-        * Default value: 5_000_000 msat.
+        * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of 5000.
         */
-       public long get_max_dust_htlc_exposure_msat() {
-               long ret = bindings.ChannelConfig_get_max_dust_htlc_exposure_msat(this.ptr);
+       public MaxDustHTLCExposure get_max_dust_htlc_exposure() {
+               long ret = bindings.ChannelConfig_get_max_dust_htlc_exposure(this.ptr);
                GC.KeepAlive(this);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.MaxDustHTLCExposure ret_hu_conv = org.ldk.structs.MaxDustHTLCExposure.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
+               return ret_hu_conv;
        }
 
        /**
@@ -181,19 +184,20 @@ public class ChannelConfig : CommonBase {
         * channel negotiated throughout the channel open process, along with the fees required to have
         * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
         * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
-        * account the HTLC transaction fee as it is zero.
+        * account the HTLC transaction fee as it is zero. Because of this, you may want to set this
+        * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier
+        * variant is primarily intended for use with pre-anchor channels.
         * 
-        * 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.
+        * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total
+        * exposure across all three types per-channel.
         * 
-        * Default value: 5_000_000 msat.
+        * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of 5000.
         */
-       public void set_max_dust_htlc_exposure_msat(long val) {
-               bindings.ChannelConfig_set_max_dust_htlc_exposure_msat(this.ptr, val);
+       public void set_max_dust_htlc_exposure(org.ldk.structs.MaxDustHTLCExposure val) {
+               bindings.ChannelConfig_set_max_dust_htlc_exposure(this.ptr, val.ptr);
                GC.KeepAlive(this);
                GC.KeepAlive(val);
+               if (this != null) { this.ptrs_to.AddLast(val); };
        }
 
        /**
@@ -205,20 +209,20 @@ public class ChannelConfig : CommonBase {
         * 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
+        * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] 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
+        * [`NonAnchorChannelFee`] 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.
+        * [`ChannelCloseMinimum`] 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
+        * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
+        * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum
         */
        public long get_force_close_avoidance_max_fee_satoshis() {
                long ret = bindings.ChannelConfig_get_force_close_avoidance_max_fee_satoshis(this.ptr);
@@ -235,20 +239,20 @@ public class ChannelConfig : CommonBase {
         * 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
+        * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] 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
+        * [`NonAnchorChannelFee`] 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.
+        * [`ChannelCloseMinimum`] 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
+        * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
+        * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum
         */
        public void set_force_close_avoidance_max_fee_satoshis(long val) {
                bindings.ChannelConfig_set_force_close_avoidance_max_fee_satoshis(this.ptr, val);
@@ -256,19 +260,95 @@ public class ChannelConfig : CommonBase {
                GC.KeepAlive(val);
        }
 
+       /**
+        * If set, allows this channel's counterparty to skim an additional fee off this node's inbound
+        * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users.
+        * 
+        * Usage:
+        * - The payee will set this option and set its invoice route hints to use [intercept scids]
+        * generated by this channel's counterparty.
+        * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call
+        * [`forward_intercepted_htlc`] with less than the amount provided in
+        * [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and
+        * actual forward amounts is their fee.
+        * 
+        * # Note
+        * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is
+        * as-expected if this feature is activated, otherwise they may lose money!
+        * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the
+        * counterparty.
+        * 
+        * # Note
+        * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116.
+        * Unsetting this flag between restarts may lead to payment receive failures.
+        * 
+        * Default value: false.
+        * 
+        * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
+        * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
+        * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
+        * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat
+        * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat
+        * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat
+        */
+       public bool get_accept_underpaying_htlcs() {
+               bool ret = bindings.ChannelConfig_get_accept_underpaying_htlcs(this.ptr);
+               GC.KeepAlive(this);
+               return ret;
+       }
+
+       /**
+        * If set, allows this channel's counterparty to skim an additional fee off this node's inbound
+        * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users.
+        * 
+        * Usage:
+        * - The payee will set this option and set its invoice route hints to use [intercept scids]
+        * generated by this channel's counterparty.
+        * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call
+        * [`forward_intercepted_htlc`] with less than the amount provided in
+        * [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and
+        * actual forward amounts is their fee.
+        * 
+        * # Note
+        * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is
+        * as-expected if this feature is activated, otherwise they may lose money!
+        * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the
+        * counterparty.
+        * 
+        * # Note
+        * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116.
+        * Unsetting this flag between restarts may lead to payment receive failures.
+        * 
+        * Default value: false.
+        * 
+        * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
+        * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
+        * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
+        * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat
+        * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat
+        * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat
+        */
+       public void set_accept_underpaying_htlcs(bool val) {
+               bindings.ChannelConfig_set_accept_underpaying_htlcs(this.ptr, val);
+               GC.KeepAlive(this);
+               GC.KeepAlive(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, 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);
+       public static ChannelConfig of(int forwarding_fee_proportional_millionths_arg, int forwarding_fee_base_msat_arg, short cltv_expiry_delta_arg, org.ldk.structs.MaxDustHTLCExposure max_dust_htlc_exposure_arg, long force_close_avoidance_max_fee_satoshis_arg, bool accept_underpaying_htlcs_arg) {
+               long ret = bindings.ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, max_dust_htlc_exposure_arg.ptr, force_close_avoidance_max_fee_satoshis_arg, accept_underpaying_htlcs_arg);
                GC.KeepAlive(forwarding_fee_proportional_millionths_arg);
                GC.KeepAlive(forwarding_fee_base_msat_arg);
                GC.KeepAlive(cltv_expiry_delta_arg);
-               GC.KeepAlive(max_dust_htlc_exposure_msat_arg);
+               GC.KeepAlive(max_dust_htlc_exposure_arg);
                GC.KeepAlive(force_close_avoidance_max_fee_satoshis_arg);
+               GC.KeepAlive(accept_underpaying_htlcs_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.AddLast(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(max_dust_htlc_exposure_arg); };
                return ret_hu_conv;
        }
 
@@ -307,6 +387,16 @@ public class ChannelConfig : CommonBase {
                if (!(o is ChannelConfig)) return false;
                return this.eq((ChannelConfig)o);
        }
+       /**
+        * Applies the given [`ChannelConfigUpdate`] as a partial update to the [`ChannelConfig`].
+        */
+       public void apply(org.ldk.structs.ChannelConfigUpdate update) {
+               bindings.ChannelConfig_apply(this.ptr, update == null ? 0 : update.ptr);
+               GC.KeepAlive(this);
+               GC.KeepAlive(update);
+               if (this != null) { this.ptrs_to.AddLast(update); };
+       }
+
        /**
         * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
         */
@@ -322,16 +412,18 @@ public class ChannelConfig : CommonBase {
         * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
         */
        public byte[] write() {
-               byte[] ret = bindings.ChannelConfig_write(this.ptr);
+               long ret = bindings.ChannelConfig_write(this.ptr);
                GC.KeepAlive(this);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * Read a ChannelConfig from a byte array, created by ChannelConfig_write
         */
        public static Result_ChannelConfigDecodeErrorZ read(byte[] ser) {
-               long ret = bindings.ChannelConfig_read(ser);
+               long ret = bindings.ChannelConfig_read(InternalUtils.encodeUint8Array(ser));
                GC.KeepAlive(ser);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_ChannelConfigDecodeErrorZ ret_hu_conv = Result_ChannelConfigDecodeErrorZ.constr_from_ptr(ret);