1 // This file is Copyright its original authors, visible in version control
2 // history and in the source files from which this was generated.
4 // This file is licensed under the license available in the LICENSE or LICENSE.md
5 // file in the root of this repository or, if no such file exists, the same
6 // license as that which applies to the original source files from which this
7 // source was automatically generated.
9 //! Various user-configurable channel limits and settings which ChannelManager
12 use std::str::FromStr;
14 use bitcoin::hashes::Hash;
15 use crate::c_types::*;
18 use lightning::util::config::ChannelHandshakeConfig as nativeChannelHandshakeConfigImport;
19 type nativeChannelHandshakeConfig = nativeChannelHandshakeConfigImport;
21 /// Configuration we set when applicable.
23 /// Default::default() provides sane defaults.
26 pub struct ChannelHandshakeConfig {
27 /// A pointer to the opaque Rust object.
29 /// Nearly everywhere, inner must be non-null, however in places where
30 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
31 pub inner: *mut nativeChannelHandshakeConfig,
32 /// Indicates that this is the only struct which contains the same pointer.
34 /// Rust functions which take ownership of an object provided via an argument require
35 /// this to be true and invalidate the object pointed to by inner.
39 impl Drop for ChannelHandshakeConfig {
41 if self.is_owned && !<*mut nativeChannelHandshakeConfig>::is_null(self.inner) {
42 let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
46 /// Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
48 pub extern "C" fn ChannelHandshakeConfig_free(this_obj: ChannelHandshakeConfig) { }
50 /// Used only if an object of this type is returned as a trait impl by a method
51 extern "C" fn ChannelHandshakeConfig_free_void(this_ptr: *mut c_void) {
52 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelHandshakeConfig); }
55 impl ChannelHandshakeConfig {
56 pub(crate) fn get_native_ref(&self) -> &'static nativeChannelHandshakeConfig {
57 unsafe { &*ObjOps::untweak_ptr(self.inner) }
59 pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelHandshakeConfig {
60 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
62 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
63 pub(crate) fn take_inner(mut self) -> *mut nativeChannelHandshakeConfig {
64 assert!(self.is_owned);
65 let ret = ObjOps::untweak_ptr(self.inner);
66 self.inner = std::ptr::null_mut();
70 /// Confirmations we will wait for before considering the channel locked in.
71 /// Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
72 /// equivalent limit applied to outbound channels).
76 pub extern "C" fn ChannelHandshakeConfig_get_minimum_depth(this_ptr: &ChannelHandshakeConfig) -> u32 {
77 let mut inner_val = &mut this_ptr.get_native_mut_ref().minimum_depth;
80 /// Confirmations we will wait for before considering the channel locked in.
81 /// Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
82 /// equivalent limit applied to outbound channels).
86 pub extern "C" fn ChannelHandshakeConfig_set_minimum_depth(this_ptr: &mut ChannelHandshakeConfig, mut val: u32) {
87 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.minimum_depth = val;
89 /// Set to the number of blocks we require our counterparty to wait to claim their money (ie
90 /// the number of blocks we have to punish our counterparty if they broadcast a revoked
93 /// This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
94 /// be online to check for revoked transactions on-chain at least once every our_to_self_delay
95 /// blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
96 /// possibly with time in between to RBF the spending transaction).
98 /// Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
99 /// case of an honest unilateral channel close, which implicitly decrease the economic value of
102 /// Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
103 /// can tweak config to ask for more security, not less.
105 pub extern "C" fn ChannelHandshakeConfig_get_our_to_self_delay(this_ptr: &ChannelHandshakeConfig) -> u16 {
106 let mut inner_val = &mut this_ptr.get_native_mut_ref().our_to_self_delay;
109 /// Set to the number of blocks we require our counterparty to wait to claim their money (ie
110 /// the number of blocks we have to punish our counterparty if they broadcast a revoked
113 /// This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
114 /// be online to check for revoked transactions on-chain at least once every our_to_self_delay
115 /// blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
116 /// possibly with time in between to RBF the spending transaction).
118 /// Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
119 /// case of an honest unilateral channel close, which implicitly decrease the economic value of
122 /// Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
123 /// can tweak config to ask for more security, not less.
125 pub extern "C" fn ChannelHandshakeConfig_set_our_to_self_delay(this_ptr: &mut ChannelHandshakeConfig, mut val: u16) {
126 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.our_to_self_delay = val;
128 /// Set to the smallest value HTLC we will accept to process.
130 /// This value is sent to our counterparty on channel-open and we close the channel any time
131 /// our counterparty misbehaves by sending us an HTLC with a value smaller than this.
133 /// Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
136 pub extern "C" fn ChannelHandshakeConfig_get_our_htlc_minimum_msat(this_ptr: &ChannelHandshakeConfig) -> u64 {
137 let mut inner_val = &mut this_ptr.get_native_mut_ref().our_htlc_minimum_msat;
140 /// Set to the smallest value HTLC we will accept to process.
142 /// This value is sent to our counterparty on channel-open and we close the channel any time
143 /// our counterparty misbehaves by sending us an HTLC with a value smaller than this.
145 /// Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
148 pub extern "C" fn ChannelHandshakeConfig_set_our_htlc_minimum_msat(this_ptr: &mut ChannelHandshakeConfig, mut val: u64) {
149 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.our_htlc_minimum_msat = val;
151 /// Constructs a new ChannelHandshakeConfig given each field
154 pub extern "C" fn ChannelHandshakeConfig_new(mut minimum_depth_arg: u32, mut our_to_self_delay_arg: u16, mut our_htlc_minimum_msat_arg: u64) -> ChannelHandshakeConfig {
155 ChannelHandshakeConfig { inner: ObjOps::heap_alloc(nativeChannelHandshakeConfig {
156 minimum_depth: minimum_depth_arg,
157 our_to_self_delay: our_to_self_delay_arg,
158 our_htlc_minimum_msat: our_htlc_minimum_msat_arg,
161 impl Clone for ChannelHandshakeConfig {
162 fn clone(&self) -> Self {
164 inner: if <*mut nativeChannelHandshakeConfig>::is_null(self.inner) { std::ptr::null_mut() } else {
165 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
171 /// Used only if an object of this type is returned as a trait impl by a method
172 pub(crate) extern "C" fn ChannelHandshakeConfig_clone_void(this_ptr: *const c_void) -> *mut c_void {
173 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelHandshakeConfig)).clone() })) as *mut c_void
176 /// Creates a copy of the ChannelHandshakeConfig
177 pub extern "C" fn ChannelHandshakeConfig_clone(orig: &ChannelHandshakeConfig) -> ChannelHandshakeConfig {
180 /// Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
183 pub extern "C" fn ChannelHandshakeConfig_default() -> ChannelHandshakeConfig {
184 ChannelHandshakeConfig { inner: ObjOps::heap_alloc(Default::default()), is_owned: true }
187 use lightning::util::config::ChannelHandshakeLimits as nativeChannelHandshakeLimitsImport;
188 type nativeChannelHandshakeLimits = nativeChannelHandshakeLimitsImport;
190 /// Optional channel limits which are applied during channel creation.
192 /// These limits are only applied to our counterparty's limits, not our own.
194 /// Use 0/<type>::max_value() as appropriate to skip checking.
196 /// Provides sane defaults for most configurations.
198 /// Most additional limits are disabled except those with which specify a default in individual
199 /// field documentation. Note that this may result in barely-usable channels, but since they
200 /// are applied mostly only to incoming channels that's not much of a problem.
203 pub struct ChannelHandshakeLimits {
204 /// A pointer to the opaque Rust object.
206 /// Nearly everywhere, inner must be non-null, however in places where
207 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
208 pub inner: *mut nativeChannelHandshakeLimits,
209 /// Indicates that this is the only struct which contains the same pointer.
211 /// Rust functions which take ownership of an object provided via an argument require
212 /// this to be true and invalidate the object pointed to by inner.
216 impl Drop for ChannelHandshakeLimits {
218 if self.is_owned && !<*mut nativeChannelHandshakeLimits>::is_null(self.inner) {
219 let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
223 /// Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
225 pub extern "C" fn ChannelHandshakeLimits_free(this_obj: ChannelHandshakeLimits) { }
227 /// Used only if an object of this type is returned as a trait impl by a method
228 extern "C" fn ChannelHandshakeLimits_free_void(this_ptr: *mut c_void) {
229 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelHandshakeLimits); }
232 impl ChannelHandshakeLimits {
233 pub(crate) fn get_native_ref(&self) -> &'static nativeChannelHandshakeLimits {
234 unsafe { &*ObjOps::untweak_ptr(self.inner) }
236 pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelHandshakeLimits {
237 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
239 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
240 pub(crate) fn take_inner(mut self) -> *mut nativeChannelHandshakeLimits {
241 assert!(self.is_owned);
242 let ret = ObjOps::untweak_ptr(self.inner);
243 self.inner = std::ptr::null_mut();
247 /// Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
248 /// only applies to inbound channels.
250 /// Default value: 0.
252 pub extern "C" fn ChannelHandshakeLimits_get_min_funding_satoshis(this_ptr: &ChannelHandshakeLimits) -> u64 {
253 let mut inner_val = &mut this_ptr.get_native_mut_ref().min_funding_satoshis;
256 /// Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
257 /// only applies to inbound channels.
259 /// Default value: 0.
261 pub extern "C" fn ChannelHandshakeLimits_set_min_funding_satoshis(this_ptr: &mut ChannelHandshakeLimits, mut val: u64) {
262 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_funding_satoshis = val;
264 /// The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
265 /// you to limit the maximum minimum-size they can require.
267 /// Default value: u64::max_value.
269 pub extern "C" fn ChannelHandshakeLimits_get_max_htlc_minimum_msat(this_ptr: &ChannelHandshakeLimits) -> u64 {
270 let mut inner_val = &mut this_ptr.get_native_mut_ref().max_htlc_minimum_msat;
273 /// The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
274 /// you to limit the maximum minimum-size they can require.
276 /// Default value: u64::max_value.
278 pub extern "C" fn ChannelHandshakeLimits_set_max_htlc_minimum_msat(this_ptr: &mut ChannelHandshakeLimits, mut val: u64) {
279 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_htlc_minimum_msat = val;
281 /// The remote node sets a limit on the maximum value of pending HTLCs to them at any given
282 /// time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
284 /// Default value: 0.
286 pub extern "C" fn ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(this_ptr: &ChannelHandshakeLimits) -> u64 {
287 let mut inner_val = &mut this_ptr.get_native_mut_ref().min_max_htlc_value_in_flight_msat;
290 /// The remote node sets a limit on the maximum value of pending HTLCs to them at any given
291 /// time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
293 /// Default value: 0.
295 pub extern "C" fn ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(this_ptr: &mut ChannelHandshakeLimits, mut val: u64) {
296 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_max_htlc_value_in_flight_msat = val;
298 /// The remote node will require we keep a certain amount in direct payment to ourselves at all
299 /// time, ensuring that we are able to be punished if we broadcast an old state. This allows to
300 /// you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
302 /// Default value: u64::max_value.
304 pub extern "C" fn ChannelHandshakeLimits_get_max_channel_reserve_satoshis(this_ptr: &ChannelHandshakeLimits) -> u64 {
305 let mut inner_val = &mut this_ptr.get_native_mut_ref().max_channel_reserve_satoshis;
308 /// The remote node will require we keep a certain amount in direct payment to ourselves at all
309 /// time, ensuring that we are able to be punished if we broadcast an old state. This allows to
310 /// you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
312 /// Default value: u64::max_value.
314 pub extern "C" fn ChannelHandshakeLimits_set_max_channel_reserve_satoshis(this_ptr: &mut ChannelHandshakeLimits, mut val: u64) {
315 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_channel_reserve_satoshis = val;
317 /// The remote node sets a limit on the maximum number of pending HTLCs to them at any given
318 /// time. This allows you to set a minimum such value.
320 /// Default value: 0.
322 pub extern "C" fn ChannelHandshakeLimits_get_min_max_accepted_htlcs(this_ptr: &ChannelHandshakeLimits) -> u16 {
323 let mut inner_val = &mut this_ptr.get_native_mut_ref().min_max_accepted_htlcs;
326 /// The remote node sets a limit on the maximum number of pending HTLCs to them at any given
327 /// time. This allows you to set a minimum such value.
329 /// Default value: 0.
331 pub extern "C" fn ChannelHandshakeLimits_set_min_max_accepted_htlcs(this_ptr: &mut ChannelHandshakeLimits, mut val: u16) {
332 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_max_accepted_htlcs = val;
334 /// Before a channel is usable the funding transaction will need to be confirmed by at least a
335 /// certain number of blocks, specified by the node which is not the funder (as the funder can
336 /// assume they aren't going to double-spend themselves).
337 /// This config allows you to set a limit on the maximum amount of time to wait.
339 /// Default value: 144, or roughly one day and only applies to outbound channels.
341 pub extern "C" fn ChannelHandshakeLimits_get_max_minimum_depth(this_ptr: &ChannelHandshakeLimits) -> u32 {
342 let mut inner_val = &mut this_ptr.get_native_mut_ref().max_minimum_depth;
345 /// Before a channel is usable the funding transaction will need to be confirmed by at least a
346 /// certain number of blocks, specified by the node which is not the funder (as the funder can
347 /// assume they aren't going to double-spend themselves).
348 /// This config allows you to set a limit on the maximum amount of time to wait.
350 /// Default value: 144, or roughly one day and only applies to outbound channels.
352 pub extern "C" fn ChannelHandshakeLimits_set_max_minimum_depth(this_ptr: &mut ChannelHandshakeLimits, mut val: u32) {
353 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_minimum_depth = val;
355 /// Set to force an incoming channel to match our announced channel preference in
356 /// [`ChannelConfig::announced_channel`].
358 /// For a node which is not online reliably, this should be set to true and
359 /// [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
360 /// channels will ever be opened.
362 /// Default value: true.
364 pub extern "C" fn ChannelHandshakeLimits_get_force_announced_channel_preference(this_ptr: &ChannelHandshakeLimits) -> bool {
365 let mut inner_val = &mut this_ptr.get_native_mut_ref().force_announced_channel_preference;
368 /// Set to force an incoming channel to match our announced channel preference in
369 /// [`ChannelConfig::announced_channel`].
371 /// For a node which is not online reliably, this should be set to true and
372 /// [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
373 /// channels will ever be opened.
375 /// Default value: true.
377 pub extern "C" fn ChannelHandshakeLimits_set_force_announced_channel_preference(this_ptr: &mut ChannelHandshakeLimits, mut val: bool) {
378 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.force_announced_channel_preference = val;
380 /// Set to the amount of time we're willing to wait to claim money back to us.
382 /// Not checking this value would be a security issue, as our peer would be able to set it to
383 /// max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
385 /// Default value: 2016, which we also enforce as a maximum value so you can tweak config to
386 /// reduce the loss of having useless locked funds (if your peer accepts)
388 pub extern "C" fn ChannelHandshakeLimits_get_their_to_self_delay(this_ptr: &ChannelHandshakeLimits) -> u16 {
389 let mut inner_val = &mut this_ptr.get_native_mut_ref().their_to_self_delay;
392 /// Set to the amount of time we're willing to wait to claim money back to us.
394 /// Not checking this value would be a security issue, as our peer would be able to set it to
395 /// max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
397 /// Default value: 2016, which we also enforce as a maximum value so you can tweak config to
398 /// reduce the loss of having useless locked funds (if your peer accepts)
400 pub extern "C" fn ChannelHandshakeLimits_set_their_to_self_delay(this_ptr: &mut ChannelHandshakeLimits, mut val: u16) {
401 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.their_to_self_delay = val;
403 /// Constructs a new ChannelHandshakeLimits given each field
406 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 {
407 ChannelHandshakeLimits { inner: ObjOps::heap_alloc(nativeChannelHandshakeLimits {
408 min_funding_satoshis: min_funding_satoshis_arg,
409 max_htlc_minimum_msat: max_htlc_minimum_msat_arg,
410 min_max_htlc_value_in_flight_msat: min_max_htlc_value_in_flight_msat_arg,
411 max_channel_reserve_satoshis: max_channel_reserve_satoshis_arg,
412 min_max_accepted_htlcs: min_max_accepted_htlcs_arg,
413 max_minimum_depth: max_minimum_depth_arg,
414 force_announced_channel_preference: force_announced_channel_preference_arg,
415 their_to_self_delay: their_to_self_delay_arg,
418 impl Clone for ChannelHandshakeLimits {
419 fn clone(&self) -> Self {
421 inner: if <*mut nativeChannelHandshakeLimits>::is_null(self.inner) { std::ptr::null_mut() } else {
422 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
428 /// Used only if an object of this type is returned as a trait impl by a method
429 pub(crate) extern "C" fn ChannelHandshakeLimits_clone_void(this_ptr: *const c_void) -> *mut c_void {
430 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelHandshakeLimits)).clone() })) as *mut c_void
433 /// Creates a copy of the ChannelHandshakeLimits
434 pub extern "C" fn ChannelHandshakeLimits_clone(orig: &ChannelHandshakeLimits) -> ChannelHandshakeLimits {
437 /// Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
440 pub extern "C" fn ChannelHandshakeLimits_default() -> ChannelHandshakeLimits {
441 ChannelHandshakeLimits { inner: ObjOps::heap_alloc(Default::default()), is_owned: true }
444 use lightning::util::config::ChannelConfig as nativeChannelConfigImport;
445 type nativeChannelConfig = nativeChannelConfigImport;
447 /// Options which apply on a per-channel basis and may change at runtime or based on negotiation
448 /// with our counterparty.
451 pub struct ChannelConfig {
452 /// A pointer to the opaque Rust object.
454 /// Nearly everywhere, inner must be non-null, however in places where
455 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
456 pub inner: *mut nativeChannelConfig,
457 /// Indicates that this is the only struct which contains the same pointer.
459 /// Rust functions which take ownership of an object provided via an argument require
460 /// this to be true and invalidate the object pointed to by inner.
464 impl Drop for ChannelConfig {
466 if self.is_owned && !<*mut nativeChannelConfig>::is_null(self.inner) {
467 let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
471 /// Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
473 pub extern "C" fn ChannelConfig_free(this_obj: ChannelConfig) { }
475 /// Used only if an object of this type is returned as a trait impl by a method
476 extern "C" fn ChannelConfig_free_void(this_ptr: *mut c_void) {
477 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelConfig); }
481 pub(crate) fn get_native_ref(&self) -> &'static nativeChannelConfig {
482 unsafe { &*ObjOps::untweak_ptr(self.inner) }
484 pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelConfig {
485 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
487 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
488 pub(crate) fn take_inner(mut self) -> *mut nativeChannelConfig {
489 assert!(self.is_owned);
490 let ret = ObjOps::untweak_ptr(self.inner);
491 self.inner = std::ptr::null_mut();
495 /// Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
496 /// over the channel.
497 /// This may be allowed to change at runtime in a later update, however doing so must result in
498 /// update messages sent to notify all nodes of our updated relay fee.
500 /// Default value: 0.
502 pub extern "C" fn ChannelConfig_get_forwarding_fee_proportional_millionths(this_ptr: &ChannelConfig) -> u32 {
503 let mut inner_val = &mut this_ptr.get_native_mut_ref().forwarding_fee_proportional_millionths;
506 /// Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
507 /// over the channel.
508 /// This may be allowed to change at runtime in a later update, however doing so must result in
509 /// update messages sent to notify all nodes of our updated relay fee.
511 /// Default value: 0.
513 pub extern "C" fn ChannelConfig_set_forwarding_fee_proportional_millionths(this_ptr: &mut ChannelConfig, mut val: u32) {
514 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.forwarding_fee_proportional_millionths = val;
516 /// Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
517 /// excess of [`forwarding_fee_proportional_millionths`].
518 /// This may be allowed to change at runtime in a later update, however doing so must result in
519 /// update messages sent to notify all nodes of our updated relay fee.
521 /// The default value of a single satoshi roughly matches the market rate on many routing nodes
522 /// as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
525 /// Default value: 1000.
527 /// [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
529 pub extern "C" fn ChannelConfig_get_forwarding_fee_base_msat(this_ptr: &ChannelConfig) -> u32 {
530 let mut inner_val = &mut this_ptr.get_native_mut_ref().forwarding_fee_base_msat;
533 /// Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
534 /// excess of [`forwarding_fee_proportional_millionths`].
535 /// This may be allowed to change at runtime in a later update, however doing so must result in
536 /// update messages sent to notify all nodes of our updated relay fee.
538 /// The default value of a single satoshi roughly matches the market rate on many routing nodes
539 /// as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
542 /// Default value: 1000.
544 /// [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
546 pub extern "C" fn ChannelConfig_set_forwarding_fee_base_msat(this_ptr: &mut ChannelConfig, mut val: u32) {
547 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.forwarding_fee_base_msat = val;
549 /// The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
550 /// the channel this config applies to.
552 /// This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
553 /// HTLC balance when a channel appears on-chain whereas
554 /// [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
555 /// (non-HTLC-encumbered) balance.
557 /// Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
558 /// we (or one of our watchtowers) MUST be online to check for broadcast of the current
559 /// commitment transaction at least once per this many blocks (minus some margin to allow us
560 /// enough time to broadcast and confirm a transaction, possibly with time in between to RBF
561 /// the spending transaction).
563 /// Default value: 72 (12 hours at an average of 6 blocks/hour).
564 /// Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
565 /// [`MIN_CLTV_EXPIRY_DELTA`] instead.
567 /// [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
569 pub extern "C" fn ChannelConfig_get_cltv_expiry_delta(this_ptr: &ChannelConfig) -> u16 {
570 let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta;
573 /// The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
574 /// the channel this config applies to.
576 /// This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
577 /// HTLC balance when a channel appears on-chain whereas
578 /// [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
579 /// (non-HTLC-encumbered) balance.
581 /// Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
582 /// we (or one of our watchtowers) MUST be online to check for broadcast of the current
583 /// commitment transaction at least once per this many blocks (minus some margin to allow us
584 /// enough time to broadcast and confirm a transaction, possibly with time in between to RBF
585 /// the spending transaction).
587 /// Default value: 72 (12 hours at an average of 6 blocks/hour).
588 /// Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
589 /// [`MIN_CLTV_EXPIRY_DELTA`] instead.
591 /// [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
593 pub extern "C" fn ChannelConfig_set_cltv_expiry_delta(this_ptr: &mut ChannelConfig, mut val: u16) {
594 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry_delta = val;
596 /// Set to announce the channel publicly and notify all nodes that they can route via this
599 /// This should only be set to true for nodes which expect to be online reliably.
601 /// As the node which funds a channel picks this value this will only apply for new outbound
602 /// channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
604 /// This cannot be changed after the initial channel handshake.
606 /// Default value: false.
608 pub extern "C" fn ChannelConfig_get_announced_channel(this_ptr: &ChannelConfig) -> bool {
609 let mut inner_val = &mut this_ptr.get_native_mut_ref().announced_channel;
612 /// Set to announce the channel publicly and notify all nodes that they can route via this
615 /// This should only be set to true for nodes which expect to be online reliably.
617 /// As the node which funds a channel picks this value this will only apply for new outbound
618 /// channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
620 /// This cannot be changed after the initial channel handshake.
622 /// Default value: false.
624 pub extern "C" fn ChannelConfig_set_announced_channel(this_ptr: &mut ChannelConfig, mut val: bool) {
625 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.announced_channel = val;
627 /// When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
628 /// supports it, they will then enforce the mutual-close output to us matches what we provided
629 /// at intialization, preventing us from closing to an alternate pubkey.
631 /// This is set to true by default to provide a slight increase in security, though ultimately
632 /// any attacker who is able to take control of a channel can just as easily send the funds via
633 /// lightning payments, so we never require that our counterparties support this option.
635 /// This cannot be changed after a channel has been initialized.
637 /// Default value: true.
639 pub extern "C" fn ChannelConfig_get_commit_upfront_shutdown_pubkey(this_ptr: &ChannelConfig) -> bool {
640 let mut inner_val = &mut this_ptr.get_native_mut_ref().commit_upfront_shutdown_pubkey;
643 /// When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
644 /// supports it, they will then enforce the mutual-close output to us matches what we provided
645 /// at intialization, preventing us from closing to an alternate pubkey.
647 /// This is set to true by default to provide a slight increase in security, though ultimately
648 /// any attacker who is able to take control of a channel can just as easily send the funds via
649 /// lightning payments, so we never require that our counterparties support this option.
651 /// This cannot be changed after a channel has been initialized.
653 /// Default value: true.
655 pub extern "C" fn ChannelConfig_set_commit_upfront_shutdown_pubkey(this_ptr: &mut ChannelConfig, mut val: bool) {
656 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.commit_upfront_shutdown_pubkey = val;
658 /// Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
659 /// small to claim on-chain.
661 /// When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
662 /// not be claimable on-chain, instead being turned into additional miner fees if either
663 /// party force-closes the channel. Because the threshold is per-HTLC, our total exposure
664 /// to such payments may be sustantial if there are many dust HTLCs present when the
665 /// channel is force-closed.
667 /// This limit is applied for sent, forwarded, and received HTLCs and limits the total
668 /// exposure across all three types per-channel. Setting this too low may prevent the
669 /// sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
670 /// important to prevent stealing of dust HTLCs by miners.
672 /// Default value: 5_000_000 msat.
674 pub extern "C" fn ChannelConfig_get_max_dust_htlc_exposure_msat(this_ptr: &ChannelConfig) -> u64 {
675 let mut inner_val = &mut this_ptr.get_native_mut_ref().max_dust_htlc_exposure_msat;
678 /// Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
679 /// small to claim on-chain.
681 /// When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
682 /// not be claimable on-chain, instead being turned into additional miner fees if either
683 /// party force-closes the channel. Because the threshold is per-HTLC, our total exposure
684 /// to such payments may be sustantial if there are many dust HTLCs present when the
685 /// channel is force-closed.
687 /// This limit is applied for sent, forwarded, and received HTLCs and limits the total
688 /// exposure across all three types per-channel. Setting this too low may prevent the
689 /// sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
690 /// important to prevent stealing of dust HTLCs by miners.
692 /// Default value: 5_000_000 msat.
694 pub extern "C" fn ChannelConfig_set_max_dust_htlc_exposure_msat(this_ptr: &mut ChannelConfig, mut val: u64) {
695 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_dust_htlc_exposure_msat = val;
697 /// The additional fee we're willing to pay to avoid waiting for the counterparty's
698 /// `to_self_delay` to reclaim funds.
700 /// When we close a channel cooperatively with our counterparty, we negotiate a fee for the
701 /// closing transaction which both sides find acceptable, ultimately paid by the channel
702 /// funder/initiator.
704 /// When we are the funder, because we have to pay the channel closing fee, we bound the
705 /// acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
706 /// this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
707 /// [`Normal`] feerate during normal operation, this value represents the additional fee we're
708 /// willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
711 /// When we are not the funder, we require the closing transaction fee pay at least our
712 /// [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
713 /// Thus, this value is ignored when we are not the funder.
715 /// Default value: 1000 satoshis.
717 /// [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
718 /// [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
720 pub extern "C" fn ChannelConfig_get_force_close_avoidance_max_fee_satoshis(this_ptr: &ChannelConfig) -> u64 {
721 let mut inner_val = &mut this_ptr.get_native_mut_ref().force_close_avoidance_max_fee_satoshis;
724 /// The additional fee we're willing to pay to avoid waiting for the counterparty's
725 /// `to_self_delay` to reclaim funds.
727 /// When we close a channel cooperatively with our counterparty, we negotiate a fee for the
728 /// closing transaction which both sides find acceptable, ultimately paid by the channel
729 /// funder/initiator.
731 /// When we are the funder, because we have to pay the channel closing fee, we bound the
732 /// acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
733 /// this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
734 /// [`Normal`] feerate during normal operation, this value represents the additional fee we're
735 /// willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
738 /// When we are not the funder, we require the closing transaction fee pay at least our
739 /// [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
740 /// Thus, this value is ignored when we are not the funder.
742 /// Default value: 1000 satoshis.
744 /// [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
745 /// [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
747 pub extern "C" fn ChannelConfig_set_force_close_avoidance_max_fee_satoshis(this_ptr: &mut ChannelConfig, mut val: u64) {
748 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.force_close_avoidance_max_fee_satoshis = val;
750 /// Constructs a new ChannelConfig given each field
753 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, mut max_dust_htlc_exposure_msat_arg: u64, mut force_close_avoidance_max_fee_satoshis_arg: u64) -> ChannelConfig {
754 ChannelConfig { inner: ObjOps::heap_alloc(nativeChannelConfig {
755 forwarding_fee_proportional_millionths: forwarding_fee_proportional_millionths_arg,
756 forwarding_fee_base_msat: forwarding_fee_base_msat_arg,
757 cltv_expiry_delta: cltv_expiry_delta_arg,
758 announced_channel: announced_channel_arg,
759 commit_upfront_shutdown_pubkey: commit_upfront_shutdown_pubkey_arg,
760 max_dust_htlc_exposure_msat: max_dust_htlc_exposure_msat_arg,
761 force_close_avoidance_max_fee_satoshis: force_close_avoidance_max_fee_satoshis_arg,
764 impl Clone for ChannelConfig {
765 fn clone(&self) -> Self {
767 inner: if <*mut nativeChannelConfig>::is_null(self.inner) { std::ptr::null_mut() } else {
768 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
774 /// Used only if an object of this type is returned as a trait impl by a method
775 pub(crate) extern "C" fn ChannelConfig_clone_void(this_ptr: *const c_void) -> *mut c_void {
776 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelConfig)).clone() })) as *mut c_void
779 /// Creates a copy of the ChannelConfig
780 pub extern "C" fn ChannelConfig_clone(orig: &ChannelConfig) -> ChannelConfig {
783 /// Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
786 pub extern "C" fn ChannelConfig_default() -> ChannelConfig {
787 ChannelConfig { inner: ObjOps::heap_alloc(Default::default()), is_owned: true }
790 /// Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
791 pub extern "C" fn ChannelConfig_write(obj: &ChannelConfig) -> crate::c_types::derived::CVec_u8Z {
792 crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
795 pub(crate) extern "C" fn ChannelConfig_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
796 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelConfig) })
799 /// Read a ChannelConfig from a byte array, created by ChannelConfig_write
800 pub extern "C" fn ChannelConfig_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelConfigDecodeErrorZ {
801 let res = crate::c_types::deserialize_obj(ser);
802 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::util::config::ChannelConfig { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
806 use lightning::util::config::UserConfig as nativeUserConfigImport;
807 type nativeUserConfig = nativeUserConfigImport;
809 /// Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
811 /// Default::default() provides sane defaults for most configurations
812 /// (but currently with 0 relay fees!)
815 pub struct UserConfig {
816 /// A pointer to the opaque Rust object.
818 /// Nearly everywhere, inner must be non-null, however in places where
819 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
820 pub inner: *mut nativeUserConfig,
821 /// Indicates that this is the only struct which contains the same pointer.
823 /// Rust functions which take ownership of an object provided via an argument require
824 /// this to be true and invalidate the object pointed to by inner.
828 impl Drop for UserConfig {
830 if self.is_owned && !<*mut nativeUserConfig>::is_null(self.inner) {
831 let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
835 /// Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
837 pub extern "C" fn UserConfig_free(this_obj: UserConfig) { }
839 /// Used only if an object of this type is returned as a trait impl by a method
840 extern "C" fn UserConfig_free_void(this_ptr: *mut c_void) {
841 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUserConfig); }
845 pub(crate) fn get_native_ref(&self) -> &'static nativeUserConfig {
846 unsafe { &*ObjOps::untweak_ptr(self.inner) }
848 pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUserConfig {
849 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
851 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
852 pub(crate) fn take_inner(mut self) -> *mut nativeUserConfig {
853 assert!(self.is_owned);
854 let ret = ObjOps::untweak_ptr(self.inner);
855 self.inner = std::ptr::null_mut();
859 /// Channel config that we propose to our counterparty.
861 pub extern "C" fn UserConfig_get_own_channel_config(this_ptr: &UserConfig) -> crate::lightning::util::config::ChannelHandshakeConfig {
862 let mut inner_val = &mut this_ptr.get_native_mut_ref().own_channel_config;
863 crate::lightning::util::config::ChannelHandshakeConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
865 /// Channel config that we propose to our counterparty.
867 pub extern "C" fn UserConfig_set_own_channel_config(this_ptr: &mut UserConfig, mut val: crate::lightning::util::config::ChannelHandshakeConfig) {
868 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.own_channel_config = *unsafe { Box::from_raw(val.take_inner()) };
870 /// Limits applied to our counterparty's proposed channel config settings.
872 pub extern "C" fn UserConfig_get_peer_channel_config_limits(this_ptr: &UserConfig) -> crate::lightning::util::config::ChannelHandshakeLimits {
873 let mut inner_val = &mut this_ptr.get_native_mut_ref().peer_channel_config_limits;
874 crate::lightning::util::config::ChannelHandshakeLimits { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
876 /// Limits applied to our counterparty's proposed channel config settings.
878 pub extern "C" fn UserConfig_set_peer_channel_config_limits(this_ptr: &mut UserConfig, mut val: crate::lightning::util::config::ChannelHandshakeLimits) {
879 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.peer_channel_config_limits = *unsafe { Box::from_raw(val.take_inner()) };
881 /// Channel config which affects behavior during channel lifetime.
883 pub extern "C" fn UserConfig_get_channel_options(this_ptr: &UserConfig) -> crate::lightning::util::config::ChannelConfig {
884 let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_options;
885 crate::lightning::util::config::ChannelConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const _) as *mut _) }, is_owned: false }
887 /// Channel config which affects behavior during channel lifetime.
889 pub extern "C" fn UserConfig_set_channel_options(this_ptr: &mut UserConfig, mut val: crate::lightning::util::config::ChannelConfig) {
890 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_options = *unsafe { Box::from_raw(val.take_inner()) };
892 /// If this is set to false, we will reject any HTLCs which were to be forwarded over private
893 /// channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
894 /// node which is not online reliably.
896 /// For nodes which are not online reliably, you should set all channels to *not* be announced
897 /// (using [`ChannelConfig::announced_channel`] and
898 /// [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
899 /// ensure you are not exposed to any forwarding risk.
901 /// Note that because you cannot change a channel's announced state after creation, there is no
902 /// way to disable forwarding on public channels retroactively. Thus, in order to change a node
903 /// from a publicly-announced forwarding node to a private non-forwarding node you must close
904 /// all your channels and open new ones. For privacy, you should also change your node_id
905 /// (swapping all private and public key material for new ones) at that time.
907 /// Default value: false.
909 pub extern "C" fn UserConfig_get_accept_forwards_to_priv_channels(this_ptr: &UserConfig) -> bool {
910 let mut inner_val = &mut this_ptr.get_native_mut_ref().accept_forwards_to_priv_channels;
913 /// If this is set to false, we will reject any HTLCs which were to be forwarded over private
914 /// channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
915 /// node which is not online reliably.
917 /// For nodes which are not online reliably, you should set all channels to *not* be announced
918 /// (using [`ChannelConfig::announced_channel`] and
919 /// [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
920 /// ensure you are not exposed to any forwarding risk.
922 /// Note that because you cannot change a channel's announced state after creation, there is no
923 /// way to disable forwarding on public channels retroactively. Thus, in order to change a node
924 /// from a publicly-announced forwarding node to a private non-forwarding node you must close
925 /// all your channels and open new ones. For privacy, you should also change your node_id
926 /// (swapping all private and public key material for new ones) at that time.
928 /// Default value: false.
930 pub extern "C" fn UserConfig_set_accept_forwards_to_priv_channels(this_ptr: &mut UserConfig, mut val: bool) {
931 unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.accept_forwards_to_priv_channels = val;
933 /// Constructs a new UserConfig given each field
936 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 {
937 UserConfig { inner: ObjOps::heap_alloc(nativeUserConfig {
938 own_channel_config: *unsafe { Box::from_raw(own_channel_config_arg.take_inner()) },
939 peer_channel_config_limits: *unsafe { Box::from_raw(peer_channel_config_limits_arg.take_inner()) },
940 channel_options: *unsafe { Box::from_raw(channel_options_arg.take_inner()) },
941 accept_forwards_to_priv_channels: accept_forwards_to_priv_channels_arg,
944 impl Clone for UserConfig {
945 fn clone(&self) -> Self {
947 inner: if <*mut nativeUserConfig>::is_null(self.inner) { std::ptr::null_mut() } else {
948 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
954 /// Used only if an object of this type is returned as a trait impl by a method
955 pub(crate) extern "C" fn UserConfig_clone_void(this_ptr: *const c_void) -> *mut c_void {
956 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUserConfig)).clone() })) as *mut c_void
959 /// Creates a copy of the UserConfig
960 pub extern "C" fn UserConfig_clone(orig: &UserConfig) -> UserConfig {
963 /// Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
966 pub extern "C" fn UserConfig_default() -> UserConfig {
967 UserConfig { inner: ObjOps::heap_alloc(Default::default()), is_owned: true }