//! applies for you.
use alloc::str::FromStr;
+use alloc::string::String;
use core::ffi::c_void;
use core::convert::Infallible;
use bitcoin::hashes::Hash;
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelHandshakeConfig_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelHandshakeConfig)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelHandshakeConfig)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelHandshakeConfig
pub extern "C" fn ChannelHandshakeConfig_clone(orig: &ChannelHandshakeConfig) -> ChannelHandshakeConfig {
orig.clone()
}
+/// Get a string which allows debug introspection of a ChannelHandshakeConfig object
+pub extern "C" fn ChannelHandshakeConfig_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::util::config::ChannelHandshakeConfig }).into()}
/// Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
#[must_use]
#[no_mangle]
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelHandshakeLimits_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelHandshakeLimits)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelHandshakeLimits)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelHandshakeLimits
pub extern "C" fn ChannelHandshakeLimits_clone(orig: &ChannelHandshakeLimits) -> ChannelHandshakeLimits {
orig.clone()
}
+/// Get a string which allows debug introspection of a ChannelHandshakeLimits object
+pub extern "C" fn ChannelHandshakeLimits_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::util::config::ChannelHandshakeLimits }).into()}
/// Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
#[must_use]
#[no_mangle]
}
}
#[allow(unused)]
- pub(crate) fn from_native(native: &nativeMaxDustHTLCExposure) -> Self {
+ pub(crate) fn from_native(native: &MaxDustHTLCExposureImport) -> Self {
+ let native = unsafe { &*(native as *const _ as *const c_void as *const nativeMaxDustHTLCExposure) };
match native {
nativeMaxDustHTLCExposure::FixedLimitMsat (ref a, ) => {
let mut a_nonref = Clone::clone(a);
pub extern "C" fn MaxDustHTLCExposure_clone(orig: &MaxDustHTLCExposure) -> MaxDustHTLCExposure {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn MaxDustHTLCExposure_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const MaxDustHTLCExposure)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn MaxDustHTLCExposure_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut MaxDustHTLCExposure) };
+}
#[no_mangle]
/// Utility method to constructs a new FixedLimitMsat-variant MaxDustHTLCExposure
pub extern "C" fn MaxDustHTLCExposure_fixed_limit_msat(a: u64) -> MaxDustHTLCExposure {
pub extern "C" fn MaxDustHTLCExposure_fee_rate_multiplier(a: u64) -> MaxDustHTLCExposure {
MaxDustHTLCExposure::FeeRateMultiplier(a, )
}
+/// Get a string which allows debug introspection of a MaxDustHTLCExposure object
+pub extern "C" fn MaxDustHTLCExposure_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::util::config::MaxDustHTLCExposure }).into()}
/// Checks if two MaxDustHTLCExposures contain equal inner contents.
/// This ignores pointers and is_owned flags and looks at the values in fields.
#[no_mangle]
pub extern "C" fn MaxDustHTLCExposure_write(obj: &crate::lightning::util::config::MaxDustHTLCExposure) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn MaxDustHTLCExposure_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ MaxDustHTLCExposure_write(unsafe { &*(obj as *const MaxDustHTLCExposure) })
+}
#[no_mangle]
/// Read a MaxDustHTLCExposure from a byte array, created by MaxDustHTLCExposure_write
pub extern "C" fn MaxDustHTLCExposure_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_MaxDustHTLCExposureDecodeErrorZ {
/// 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
#[no_mangle]
pub extern "C" fn ChannelConfig_get_force_close_avoidance_max_fee_satoshis(this_ptr: &ChannelConfig) -> u64 {
let mut inner_val = &mut this_ptr.get_native_mut_ref().force_close_avoidance_max_fee_satoshis;
/// 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
#[no_mangle]
pub extern "C" fn ChannelConfig_set_force_close_avoidance_max_fee_satoshis(this_ptr: &mut ChannelConfig, mut val: u64) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.force_close_avoidance_max_fee_satoshis = val;
/// - 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.
+/// actual forward amounts is their fee. See
+/// <https://github.com/BitcoinAndLightningLayerSpecs/lsp/tree/main/LSPS2#flow-lsp-trusts-client-model>
+/// for how this feature may be used in the LSP use case.
///
/// # Note
/// It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is
/// - 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.
+/// actual forward amounts is their fee. See
+/// <https://github.com/BitcoinAndLightningLayerSpecs/lsp/tree/main/LSPS2#flow-lsp-trusts-client-model>
+/// for how this feature may be used in the LSP use case.
///
/// # Note
/// It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelConfig_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelConfig)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelConfig)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelConfig
pub extern "C" fn ChannelConfig_clone(orig: &ChannelConfig) -> ChannelConfig {
orig.clone()
}
+/// Get a string which allows debug introspection of a ChannelConfig object
+pub extern "C" fn ChannelConfig_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::util::config::ChannelConfig }).into()}
/// Checks if two ChannelConfigs contain equal inner contents.
/// This ignores pointers and is_owned flags and looks at the values in fields.
/// Two objects with NULL inner values will be considered "equal" here.
pub extern "C" fn ChannelConfig_write(obj: &crate::lightning::util::config::ChannelConfig) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelConfig_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelConfig) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn UserConfig_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUserConfig)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUserConfig)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the UserConfig
pub extern "C" fn UserConfig_clone(orig: &UserConfig) -> UserConfig {
orig.clone()
}
+/// Get a string which allows debug introspection of a UserConfig object
+pub extern "C" fn UserConfig_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::util::config::UserConfig }).into()}
/// Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
#[must_use]
#[no_mangle]