Update auto-generated bindings to latest upstream
[ldk-c-bindings] / lightning-c-bindings / src / lightning / util / config.rs
index 8ee8561062be00ede7a3a0c65a210500d6b109cb..28acdcafac84587df5e20d505e0bd777cac74109 100644 (file)
@@ -9,6 +9,7 @@
 //! Various user-configurable channel limits and settings which ChannelManager
 //! applies for you.
 
+use std::str::FromStr;
 use std::ffi::c_void;
 use bitcoin::hashes::Hash;
 use crate::c_types::*;
@@ -68,7 +69,7 @@ impl ChannelHandshakeConfig {
 #[no_mangle]
 pub extern "C" fn ChannelHandshakeConfig_get_minimum_depth(this_ptr: &ChannelHandshakeConfig) -> u32 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.minimum_depth;
-       (*inner_val)
+       *inner_val
 }
 /// Confirmations we will wait for before considering the channel locked in.
 /// Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
@@ -97,7 +98,7 @@ pub extern "C" fn ChannelHandshakeConfig_set_minimum_depth(this_ptr: &mut Channe
 #[no_mangle]
 pub extern "C" fn ChannelHandshakeConfig_get_our_to_self_delay(this_ptr: &ChannelHandshakeConfig) -> u16 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.our_to_self_delay;
-       (*inner_val)
+       *inner_val
 }
 /// 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
@@ -128,7 +129,7 @@ pub extern "C" fn ChannelHandshakeConfig_set_our_to_self_delay(this_ptr: &mut Ch
 #[no_mangle]
 pub extern "C" fn ChannelHandshakeConfig_get_our_htlc_minimum_msat(this_ptr: &ChannelHandshakeConfig) -> u64 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.our_htlc_minimum_msat;
-       (*inner_val)
+       *inner_val
 }
 /// Set to the smallest value HTLC we will accept to process.
 ///
@@ -238,7 +239,7 @@ impl ChannelHandshakeLimits {
 #[no_mangle]
 pub extern "C" fn ChannelHandshakeLimits_get_min_funding_satoshis(this_ptr: &ChannelHandshakeLimits) -> u64 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.min_funding_satoshis;
-       (*inner_val)
+       *inner_val
 }
 /// Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
 /// only applies to inbound channels.
@@ -255,7 +256,7 @@ pub extern "C" fn ChannelHandshakeLimits_set_min_funding_satoshis(this_ptr: &mut
 #[no_mangle]
 pub extern "C" fn ChannelHandshakeLimits_get_max_htlc_minimum_msat(this_ptr: &ChannelHandshakeLimits) -> u64 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_htlc_minimum_msat;
-       (*inner_val)
+       *inner_val
 }
 /// The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
 /// you to limit the maximum minimum-size they can require.
@@ -272,7 +273,7 @@ pub extern "C" fn ChannelHandshakeLimits_set_max_htlc_minimum_msat(this_ptr: &mu
 #[no_mangle]
 pub extern "C" fn ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(this_ptr: &ChannelHandshakeLimits) -> u64 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.min_max_htlc_value_in_flight_msat;
-       (*inner_val)
+       *inner_val
 }
 /// The remote node sets a limit on the maximum value of pending HTLCs to them at any given
 /// time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
@@ -290,7 +291,7 @@ pub extern "C" fn ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(t
 #[no_mangle]
 pub extern "C" fn ChannelHandshakeLimits_get_max_channel_reserve_satoshis(this_ptr: &ChannelHandshakeLimits) -> u64 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_channel_reserve_satoshis;
-       (*inner_val)
+       *inner_val
 }
 /// The remote node will require we keep a certain amount in direct payment to ourselves at all
 /// time, ensuring that we are able to be punished if we broadcast an old state. This allows to
@@ -308,7 +309,7 @@ pub extern "C" fn ChannelHandshakeLimits_set_max_channel_reserve_satoshis(this_p
 #[no_mangle]
 pub extern "C" fn ChannelHandshakeLimits_get_min_max_accepted_htlcs(this_ptr: &ChannelHandshakeLimits) -> u16 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.min_max_accepted_htlcs;
-       (*inner_val)
+       *inner_val
 }
 /// The remote node sets a limit on the maximum number of pending HTLCs to them at any given
 /// time. This allows you to set a minimum such value.
@@ -318,52 +319,6 @@ pub extern "C" fn ChannelHandshakeLimits_get_min_max_accepted_htlcs(this_ptr: &C
 pub extern "C" fn ChannelHandshakeLimits_set_min_max_accepted_htlcs(this_ptr: &mut ChannelHandshakeLimits, mut val: u16) {
        unsafe { &mut *this_ptr.inner }.min_max_accepted_htlcs = val;
 }
-/// Outputs below a certain value will not be added to on-chain transactions. The dust value is
-/// required to always be higher than this value so this only applies to HTLC outputs (and
-/// potentially to-self outputs before any payments have been made).
-/// Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
-/// This setting allows you to set a minimum dust limit for their commitment transactions,
-/// reflecting the reality that tiny outputs are not considered standard transactions and will
-/// not propagate through the Bitcoin network.
-///
-/// Default value: 546, the current dust limit on the Bitcoin network.
-#[no_mangle]
-pub extern "C" fn ChannelHandshakeLimits_get_min_dust_limit_satoshis(this_ptr: &ChannelHandshakeLimits) -> u64 {
-       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.min_dust_limit_satoshis;
-       (*inner_val)
-}
-/// Outputs below a certain value will not be added to on-chain transactions. The dust value is
-/// required to always be higher than this value so this only applies to HTLC outputs (and
-/// potentially to-self outputs before any payments have been made).
-/// Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
-/// This setting allows you to set a minimum dust limit for their commitment transactions,
-/// reflecting the reality that tiny outputs are not considered standard transactions and will
-/// not propagate through the Bitcoin network.
-///
-/// Default value: 546, the current dust limit on the Bitcoin network.
-#[no_mangle]
-pub extern "C" fn ChannelHandshakeLimits_set_min_dust_limit_satoshis(this_ptr: &mut ChannelHandshakeLimits, mut val: u64) {
-       unsafe { &mut *this_ptr.inner }.min_dust_limit_satoshis = val;
-}
-/// Maximum allowed threshold above which outputs will not be generated in their commitment
-/// transactions.
-/// HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
-///
-/// Default value: u64::max_value.
-#[no_mangle]
-pub extern "C" fn ChannelHandshakeLimits_get_max_dust_limit_satoshis(this_ptr: &ChannelHandshakeLimits) -> u64 {
-       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_dust_limit_satoshis;
-       (*inner_val)
-}
-/// Maximum allowed threshold above which outputs will not be generated in their commitment
-/// transactions.
-/// HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
-///
-/// Default value: u64::max_value.
-#[no_mangle]
-pub extern "C" fn ChannelHandshakeLimits_set_max_dust_limit_satoshis(this_ptr: &mut ChannelHandshakeLimits, mut val: u64) {
-       unsafe { &mut *this_ptr.inner }.max_dust_limit_satoshis = val;
-}
 /// Before a channel is usable the funding transaction will need to be confirmed by at least a
 /// certain number of blocks, specified by the node which is not the funder (as the funder can
 /// assume they aren't going to double-spend themselves).
@@ -373,7 +328,7 @@ pub extern "C" fn ChannelHandshakeLimits_set_max_dust_limit_satoshis(this_ptr: &
 #[no_mangle]
 pub extern "C" fn ChannelHandshakeLimits_get_max_minimum_depth(this_ptr: &ChannelHandshakeLimits) -> u32 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_minimum_depth;
-       (*inner_val)
+       *inner_val
 }
 /// Before a channel is usable the funding transaction will need to be confirmed by at least a
 /// certain number of blocks, specified by the node which is not the funder (as the funder can
@@ -385,21 +340,27 @@ pub extern "C" fn ChannelHandshakeLimits_get_max_minimum_depth(this_ptr: &Channe
 pub extern "C" fn ChannelHandshakeLimits_set_max_minimum_depth(this_ptr: &mut ChannelHandshakeLimits, mut val: u32) {
        unsafe { &mut *this_ptr.inner }.max_minimum_depth = val;
 }
-/// Set to force the incoming channel to match our announced channel preference in
-/// ChannelConfig.
+/// Set to force an incoming channel to match our announced channel preference in
+/// [`ChannelConfig::announced_channel`].
 ///
-/// Default value: true, to make the default that no announced channels are possible (which is
-/// appropriate for any nodes which are not online very reliably).
+/// For a node which is not online reliably, this should be set to true and
+/// [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
+/// channels will ever be opened.
+///
+/// Default value: true.
 #[no_mangle]
 pub extern "C" fn ChannelHandshakeLimits_get_force_announced_channel_preference(this_ptr: &ChannelHandshakeLimits) -> bool {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.force_announced_channel_preference;
-       (*inner_val)
+       *inner_val
 }
-/// Set to force the incoming channel to match our announced channel preference in
-/// ChannelConfig.
+/// Set to force an incoming channel to match our announced channel preference in
+/// [`ChannelConfig::announced_channel`].
+///
+/// For a node which is not online reliably, this should be set to true and
+/// [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
+/// channels will ever be opened.
 ///
-/// Default value: true, to make the default that no announced channels are possible (which is
-/// appropriate for any nodes which are not online very reliably).
+/// Default value: true.
 #[no_mangle]
 pub extern "C" fn ChannelHandshakeLimits_set_force_announced_channel_preference(this_ptr: &mut ChannelHandshakeLimits, mut val: bool) {
        unsafe { &mut *this_ptr.inner }.force_announced_channel_preference = val;
@@ -414,7 +375,7 @@ pub extern "C" fn ChannelHandshakeLimits_set_force_announced_channel_preference(
 #[no_mangle]
 pub extern "C" fn ChannelHandshakeLimits_get_their_to_self_delay(this_ptr: &ChannelHandshakeLimits) -> u16 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.their_to_self_delay;
-       (*inner_val)
+       *inner_val
 }
 /// Set to the amount of time we're willing to wait to claim money back to us.
 ///
@@ -430,15 +391,13 @@ pub extern "C" fn ChannelHandshakeLimits_set_their_to_self_delay(this_ptr: &mut
 /// Constructs a new ChannelHandshakeLimits given each field
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelHandshakeLimits_new(mut min_funding_satoshis_arg: u64, mut max_htlc_minimum_msat_arg: u64, mut min_max_htlc_value_in_flight_msat_arg: u64, mut max_channel_reserve_satoshis_arg: u64, mut min_max_accepted_htlcs_arg: u16, mut min_dust_limit_satoshis_arg: u64, mut max_dust_limit_satoshis_arg: u64, mut max_minimum_depth_arg: u32, mut force_announced_channel_preference_arg: bool, mut their_to_self_delay_arg: u16) -> ChannelHandshakeLimits {
+pub extern "C" fn ChannelHandshakeLimits_new(mut min_funding_satoshis_arg: u64, mut max_htlc_minimum_msat_arg: u64, mut min_max_htlc_value_in_flight_msat_arg: u64, mut max_channel_reserve_satoshis_arg: u64, mut min_max_accepted_htlcs_arg: u16, mut max_minimum_depth_arg: u32, mut force_announced_channel_preference_arg: bool, mut their_to_self_delay_arg: u16) -> ChannelHandshakeLimits {
        ChannelHandshakeLimits { inner: Box::into_raw(Box::new(nativeChannelHandshakeLimits {
                min_funding_satoshis: min_funding_satoshis_arg,
                max_htlc_minimum_msat: max_htlc_minimum_msat_arg,
                min_max_htlc_value_in_flight_msat: min_max_htlc_value_in_flight_msat_arg,
                max_channel_reserve_satoshis: max_channel_reserve_satoshis_arg,
                min_max_accepted_htlcs: min_max_accepted_htlcs_arg,
-               min_dust_limit_satoshis: min_dust_limit_satoshis_arg,
-               max_dust_limit_satoshis: max_dust_limit_satoshis_arg,
                max_minimum_depth: max_minimum_depth_arg,
                force_announced_channel_preference: force_announced_channel_preference_arg,
                their_to_self_delay: their_to_self_delay_arg,
@@ -515,24 +474,59 @@ impl ChannelConfig {
                ret
        }
 }
-/// Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
+/// Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
+/// over the channel.
 /// This may be allowed to change at runtime in a later update, however doing so must result in
 /// update messages sent to notify all nodes of our updated relay fee.
 ///
 /// Default value: 0.
 #[no_mangle]
-pub extern "C" fn ChannelConfig_get_fee_proportional_millionths(this_ptr: &ChannelConfig) -> u32 {
-       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_proportional_millionths;
-       (*inner_val)
+pub extern "C" fn ChannelConfig_get_forwarding_fee_proportional_millionths(this_ptr: &ChannelConfig) -> u32 {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.forwarding_fee_proportional_millionths;
+       *inner_val
 }
-/// Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
+/// Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
+/// over the channel.
 /// This may be allowed to change at runtime in a later update, however doing so must result in
 /// update messages sent to notify all nodes of our updated relay fee.
 ///
 /// Default value: 0.
 #[no_mangle]
-pub extern "C" fn ChannelConfig_set_fee_proportional_millionths(this_ptr: &mut ChannelConfig, mut val: u32) {
-       unsafe { &mut *this_ptr.inner }.fee_proportional_millionths = val;
+pub extern "C" fn ChannelConfig_set_forwarding_fee_proportional_millionths(this_ptr: &mut ChannelConfig, mut val: u32) {
+       unsafe { &mut *this_ptr.inner }.forwarding_fee_proportional_millionths = val;
+}
+/// Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
+/// excess of [`forwarding_fee_proportional_millionths`].
+/// This may be allowed to change at runtime in a later update, however doing so must result in
+/// update messages sent to notify all nodes of our updated relay fee.
+///
+/// The default value of a single satoshi roughly matches the market rate on many routing nodes
+/// as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
+/// this node.
+///
+/// Default value: 1000.
+///
+/// [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
+#[no_mangle]
+pub extern "C" fn ChannelConfig_get_forwarding_fee_base_msat(this_ptr: &ChannelConfig) -> u32 {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.forwarding_fee_base_msat;
+       *inner_val
+}
+/// Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
+/// excess of [`forwarding_fee_proportional_millionths`].
+/// This may be allowed to change at runtime in a later update, however doing so must result in
+/// update messages sent to notify all nodes of our updated relay fee.
+///
+/// The default value of a single satoshi roughly matches the market rate on many routing nodes
+/// as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
+/// this node.
+///
+/// Default value: 1000.
+///
+/// [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
+#[no_mangle]
+pub extern "C" fn ChannelConfig_set_forwarding_fee_base_msat(this_ptr: &mut ChannelConfig, mut val: u32) {
+       unsafe { &mut *this_ptr.inner }.forwarding_fee_base_msat = val;
 }
 /// The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
 /// the channel this config applies to.
@@ -556,7 +550,7 @@ pub extern "C" fn ChannelConfig_set_fee_proportional_millionths(this_ptr: &mut C
 #[no_mangle]
 pub extern "C" fn ChannelConfig_get_cltv_expiry_delta(this_ptr: &ChannelConfig) -> u16 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry_delta;
-       (*inner_val)
+       *inner_val
 }
 /// The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
 /// the channel this config applies to.
@@ -587,7 +581,7 @@ pub extern "C" fn ChannelConfig_set_cltv_expiry_delta(this_ptr: &mut ChannelConf
 /// 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_preferences is set.
+/// channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
 ///
 /// This cannot be changed after the initial channel handshake.
 ///
@@ -595,7 +589,7 @@ pub extern "C" fn ChannelConfig_set_cltv_expiry_delta(this_ptr: &mut ChannelConf
 #[no_mangle]
 pub extern "C" fn ChannelConfig_get_announced_channel(this_ptr: &ChannelConfig) -> bool {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.announced_channel;
-       (*inner_val)
+       *inner_val
 }
 /// Set to announce the channel publicly and notify all nodes that they can route via this
 /// channel.
@@ -603,7 +597,7 @@ pub extern "C" fn ChannelConfig_get_announced_channel(this_ptr: &ChannelConfig)
 /// 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_preferences is set.
+/// channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
 ///
 /// This cannot be changed after the initial channel handshake.
 ///
@@ -626,7 +620,7 @@ pub extern "C" fn ChannelConfig_set_announced_channel(this_ptr: &mut ChannelConf
 #[no_mangle]
 pub extern "C" fn ChannelConfig_get_commit_upfront_shutdown_pubkey(this_ptr: &ChannelConfig) -> bool {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.commit_upfront_shutdown_pubkey;
-       (*inner_val)
+       *inner_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
@@ -646,9 +640,10 @@ pub extern "C" fn ChannelConfig_set_commit_upfront_shutdown_pubkey(this_ptr: &mu
 /// Constructs a new ChannelConfig given each field
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelConfig_new(mut fee_proportional_millionths_arg: u32, mut cltv_expiry_delta_arg: u16, mut announced_channel_arg: bool, mut commit_upfront_shutdown_pubkey_arg: bool) -> ChannelConfig {
+pub extern "C" fn ChannelConfig_new(mut forwarding_fee_proportional_millionths_arg: u32, mut forwarding_fee_base_msat_arg: u32, mut cltv_expiry_delta_arg: u16, mut announced_channel_arg: bool, mut commit_upfront_shutdown_pubkey_arg: bool) -> ChannelConfig {
        ChannelConfig { inner: Box::into_raw(Box::new(nativeChannelConfig {
-               fee_proportional_millionths: fee_proportional_millionths_arg,
+               forwarding_fee_proportional_millionths: forwarding_fee_proportional_millionths_arg,
+               forwarding_fee_base_msat: forwarding_fee_base_msat_arg,
                cltv_expiry_delta: cltv_expiry_delta_arg,
                announced_channel: announced_channel_arg,
                commit_upfront_shutdown_pubkey: commit_upfront_shutdown_pubkey_arg,
@@ -747,7 +742,7 @@ impl UserConfig {
 #[no_mangle]
 pub extern "C" fn UserConfig_get_own_channel_config(this_ptr: &UserConfig) -> crate::lightning::util::config::ChannelHandshakeConfig {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.own_channel_config;
-       crate::lightning::util::config::ChannelHandshakeConfig { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::util::config::ChannelHandshakeConfig { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
 }
 /// Channel config that we propose to our counterparty.
 #[no_mangle]
@@ -758,7 +753,7 @@ pub extern "C" fn UserConfig_set_own_channel_config(this_ptr: &mut UserConfig, m
 #[no_mangle]
 pub extern "C" fn UserConfig_get_peer_channel_config_limits(this_ptr: &UserConfig) -> crate::lightning::util::config::ChannelHandshakeLimits {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.peer_channel_config_limits;
-       crate::lightning::util::config::ChannelHandshakeLimits { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::util::config::ChannelHandshakeLimits { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
 }
 /// Limits applied to our counterparty's proposed channel config settings.
 #[no_mangle]
@@ -769,21 +764,63 @@ pub extern "C" fn UserConfig_set_peer_channel_config_limits(this_ptr: &mut UserC
 #[no_mangle]
 pub extern "C" fn UserConfig_get_channel_options(this_ptr: &UserConfig) -> crate::lightning::util::config::ChannelConfig {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_options;
-       crate::lightning::util::config::ChannelConfig { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::util::config::ChannelConfig { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
 }
 /// Channel config which affects behavior during channel lifetime.
 #[no_mangle]
 pub extern "C" fn UserConfig_set_channel_options(this_ptr: &mut UserConfig, mut val: crate::lightning::util::config::ChannelConfig) {
        unsafe { &mut *this_ptr.inner }.channel_options = *unsafe { Box::from_raw(val.take_inner()) };
 }
+/// If this is set to false, we will reject any HTLCs which were to be forwarded over private
+/// channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
+/// node which is not online reliably.
+///
+/// For nodes which are not online reliably, you should set all channels to *not* be announced
+/// (using [`ChannelConfig::announced_channel`] and
+/// [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
+/// ensure you are not exposed to any forwarding risk.
+///
+/// Note that because you cannot change a channel's announced state after creation, there is no
+/// way to disable forwarding on public channels retroactively. Thus, in order to change a node
+/// from a publicly-announced forwarding node to a private non-forwarding node you must close
+/// all your channels and open new ones. For privacy, you should also change your node_id
+/// (swapping all private and public key material for new ones) at that time.
+///
+/// Default value: false.
+#[no_mangle]
+pub extern "C" fn UserConfig_get_accept_forwards_to_priv_channels(this_ptr: &UserConfig) -> bool {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.accept_forwards_to_priv_channels;
+       *inner_val
+}
+/// If this is set to false, we will reject any HTLCs which were to be forwarded over private
+/// channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
+/// node which is not online reliably.
+///
+/// For nodes which are not online reliably, you should set all channels to *not* be announced
+/// (using [`ChannelConfig::announced_channel`] and
+/// [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
+/// ensure you are not exposed to any forwarding risk.
+///
+/// Note that because you cannot change a channel's announced state after creation, there is no
+/// way to disable forwarding on public channels retroactively. Thus, in order to change a node
+/// from a publicly-announced forwarding node to a private non-forwarding node you must close
+/// all your channels and open new ones. For privacy, you should also change your node_id
+/// (swapping all private and public key material for new ones) at that time.
+///
+/// Default value: false.
+#[no_mangle]
+pub extern "C" fn UserConfig_set_accept_forwards_to_priv_channels(this_ptr: &mut UserConfig, mut val: bool) {
+       unsafe { &mut *this_ptr.inner }.accept_forwards_to_priv_channels = val;
+}
 /// Constructs a new UserConfig given each field
 #[must_use]
 #[no_mangle]
-pub extern "C" fn UserConfig_new(mut own_channel_config_arg: crate::lightning::util::config::ChannelHandshakeConfig, mut peer_channel_config_limits_arg: crate::lightning::util::config::ChannelHandshakeLimits, mut channel_options_arg: crate::lightning::util::config::ChannelConfig) -> UserConfig {
+pub extern "C" fn UserConfig_new(mut own_channel_config_arg: crate::lightning::util::config::ChannelHandshakeConfig, mut peer_channel_config_limits_arg: crate::lightning::util::config::ChannelHandshakeLimits, mut channel_options_arg: crate::lightning::util::config::ChannelConfig, mut accept_forwards_to_priv_channels_arg: bool) -> UserConfig {
        UserConfig { inner: Box::into_raw(Box::new(nativeUserConfig {
                own_channel_config: *unsafe { Box::from_raw(own_channel_config_arg.take_inner()) },
                peer_channel_config_limits: *unsafe { Box::from_raw(peer_channel_config_limits_arg.take_inner()) },
                channel_options: *unsafe { Box::from_raw(channel_options_arg.take_inner()) },
+               accept_forwards_to_priv_channels: accept_forwards_to_priv_channels_arg,
        })), is_owned: true }
 }
 impl Clone for UserConfig {