-
-use lightning::ln::channelmanager::CounterpartyForwardingInfo as nativeCounterpartyForwardingInfoImport;
-pub(crate) type nativeCounterpartyForwardingInfo = nativeCounterpartyForwardingInfoImport;
-
-/// Information needed for constructing an invoice route hint for this channel.
-#[must_use]
-#[repr(C)]
-pub struct CounterpartyForwardingInfo {
- /// A pointer to the opaque Rust object.
-
- /// Nearly everywhere, inner must be non-null, however in places where
- /// the Rust equivalent takes an Option, it may be set to null to indicate None.
- pub inner: *mut nativeCounterpartyForwardingInfo,
- /// Indicates that this is the only struct which contains the same pointer.
-
- /// Rust functions which take ownership of an object provided via an argument require
- /// this to be true and invalidate the object pointed to by inner.
- pub is_owned: bool,
-}
-
-impl Drop for CounterpartyForwardingInfo {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeCounterpartyForwardingInfo>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn CounterpartyForwardingInfo_free(this_obj: CounterpartyForwardingInfo) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn CounterpartyForwardingInfo_free_void(this_ptr: *mut c_void) {
- let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCounterpartyForwardingInfo) };
-}
-#[allow(unused)]
-impl CounterpartyForwardingInfo {
- pub(crate) fn get_native_ref(&self) -> &'static nativeCounterpartyForwardingInfo {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeCounterpartyForwardingInfo {
- unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
- }
- /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
- pub(crate) fn take_inner(mut self) -> *mut nativeCounterpartyForwardingInfo {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
-}
-/// Base routing fee in millisatoshis.
-#[no_mangle]
-pub extern "C" fn CounterpartyForwardingInfo_get_fee_base_msat(this_ptr: &CounterpartyForwardingInfo) -> u32 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_base_msat;
- *inner_val
-}
-/// Base routing fee in millisatoshis.
-#[no_mangle]
-pub extern "C" fn CounterpartyForwardingInfo_set_fee_base_msat(this_ptr: &mut CounterpartyForwardingInfo, mut val: u32) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_base_msat = val;
-}
-/// Amount in millionths of a satoshi the channel will charge per transferred satoshi.
-#[no_mangle]
-pub extern "C" fn CounterpartyForwardingInfo_get_fee_proportional_millionths(this_ptr: &CounterpartyForwardingInfo) -> u32 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_proportional_millionths;
- *inner_val
-}
-/// Amount in millionths of a satoshi the channel will charge per transferred satoshi.
-#[no_mangle]
-pub extern "C" fn CounterpartyForwardingInfo_set_fee_proportional_millionths(this_ptr: &mut CounterpartyForwardingInfo, mut val: u32) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_proportional_millionths = val;
-}
-/// The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
-/// such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
-/// `cltv_expiry_delta` for more details.
-#[no_mangle]
-pub extern "C" fn CounterpartyForwardingInfo_get_cltv_expiry_delta(this_ptr: &CounterpartyForwardingInfo) -> u16 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta;
- *inner_val
-}
-/// The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
-/// such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
-/// `cltv_expiry_delta` for more details.
-#[no_mangle]
-pub extern "C" fn CounterpartyForwardingInfo_set_cltv_expiry_delta(this_ptr: &mut CounterpartyForwardingInfo, mut val: u16) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry_delta = val;
-}
-/// Constructs a new CounterpartyForwardingInfo given each field
-#[must_use]
-#[no_mangle]
-pub extern "C" fn CounterpartyForwardingInfo_new(mut fee_base_msat_arg: u32, mut fee_proportional_millionths_arg: u32, mut cltv_expiry_delta_arg: u16) -> CounterpartyForwardingInfo {
- CounterpartyForwardingInfo { inner: ObjOps::heap_alloc(nativeCounterpartyForwardingInfo {
- fee_base_msat: fee_base_msat_arg,
- fee_proportional_millionths: fee_proportional_millionths_arg,
- cltv_expiry_delta: cltv_expiry_delta_arg,
- }), is_owned: true }
-}
-impl Clone for CounterpartyForwardingInfo {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeCounterpartyForwardingInfo>::is_null(self.inner) { core::ptr::null_mut() } else {
- ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
- is_owned: true,
- }
- }
-}
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn CounterpartyForwardingInfo_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCounterpartyForwardingInfo)).clone() })) as *mut c_void
-}
-#[no_mangle]
-/// Creates a copy of the CounterpartyForwardingInfo
-pub extern "C" fn CounterpartyForwardingInfo_clone(orig: &CounterpartyForwardingInfo) -> CounterpartyForwardingInfo {
- orig.clone()
-}
-/// Get a string which allows debug introspection of a CounterpartyForwardingInfo object
-pub extern "C" fn CounterpartyForwardingInfo_debug_str_void(o: *const c_void) -> Str {
- alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channelmanager::CounterpartyForwardingInfo }).into()}
-
-use lightning::ln::channelmanager::ChannelCounterparty as nativeChannelCounterpartyImport;
-pub(crate) type nativeChannelCounterparty = nativeChannelCounterpartyImport;
-
-/// Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
-/// to better separate parameters.
-#[must_use]
-#[repr(C)]
-pub struct ChannelCounterparty {
- /// A pointer to the opaque Rust object.
-
- /// Nearly everywhere, inner must be non-null, however in places where
- /// the Rust equivalent takes an Option, it may be set to null to indicate None.
- pub inner: *mut nativeChannelCounterparty,
- /// Indicates that this is the only struct which contains the same pointer.
-
- /// Rust functions which take ownership of an object provided via an argument require
- /// this to be true and invalidate the object pointed to by inner.
- pub is_owned: bool,
-}
-
-impl Drop for ChannelCounterparty {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeChannelCounterparty>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn ChannelCounterparty_free(this_obj: ChannelCounterparty) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn ChannelCounterparty_free_void(this_ptr: *mut c_void) {
- let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelCounterparty) };
-}
-#[allow(unused)]
-impl ChannelCounterparty {
- pub(crate) fn get_native_ref(&self) -> &'static nativeChannelCounterparty {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelCounterparty {
- unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
- }
- /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
- pub(crate) fn take_inner(mut self) -> *mut nativeChannelCounterparty {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
-}
-/// The node_id of our counterparty
-#[no_mangle]
-pub extern "C" fn ChannelCounterparty_get_node_id(this_ptr: &ChannelCounterparty) -> crate::c_types::PublicKey {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().node_id;
- crate::c_types::PublicKey::from_rust(&inner_val)
-}
-/// The node_id of our counterparty
-#[no_mangle]
-pub extern "C" fn ChannelCounterparty_set_node_id(this_ptr: &mut ChannelCounterparty, mut val: crate::c_types::PublicKey) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_id = val.into_rust();
-}
-/// The Features the channel counterparty provided upon last connection.
-/// Useful for routing as it is the most up-to-date copy of the counterparty's features and
-/// many routing-relevant features are present in the init context.
-#[no_mangle]
-pub extern "C" fn ChannelCounterparty_get_features(this_ptr: &ChannelCounterparty) -> crate::lightning::ln::features::InitFeatures {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().features;
- crate::lightning::ln::features::InitFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::InitFeatures<>) as *mut _) }, is_owned: false }
-}
-/// The Features the channel counterparty provided upon last connection.
-/// Useful for routing as it is the most up-to-date copy of the counterparty's features and
-/// many routing-relevant features are present in the init context.
-#[no_mangle]
-pub extern "C" fn ChannelCounterparty_set_features(this_ptr: &mut ChannelCounterparty, mut val: crate::lightning::ln::features::InitFeatures) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.features = *unsafe { Box::from_raw(val.take_inner()) };
-}
-/// The value, in satoshis, that must always be held in the channel for our counterparty. This
-/// value ensures that if our counterparty broadcasts a revoked state, we can punish them by
-/// claiming at least this value on chain.
-///
-/// This value is not included in [`inbound_capacity_msat`] as it can never be spent.
-///
-/// [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
-#[no_mangle]
-pub extern "C" fn ChannelCounterparty_get_unspendable_punishment_reserve(this_ptr: &ChannelCounterparty) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().unspendable_punishment_reserve;
- *inner_val
-}
-/// The value, in satoshis, that must always be held in the channel for our counterparty. This
-/// value ensures that if our counterparty broadcasts a revoked state, we can punish them by
-/// claiming at least this value on chain.
-///
-/// This value is not included in [`inbound_capacity_msat`] as it can never be spent.
-///
-/// [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
-#[no_mangle]
-pub extern "C" fn ChannelCounterparty_set_unspendable_punishment_reserve(this_ptr: &mut ChannelCounterparty, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.unspendable_punishment_reserve = val;
-}
-/// Information on the fees and requirements that the counterparty requires when forwarding
-/// payments to us through this channel.
-///
-/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelCounterparty_get_forwarding_info(this_ptr: &ChannelCounterparty) -> crate::lightning::ln::channelmanager::CounterpartyForwardingInfo {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().forwarding_info;
- let mut local_inner_val = crate::lightning::ln::channelmanager::CounterpartyForwardingInfo { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::channelmanager::CounterpartyForwardingInfo<>) as *mut _ }, is_owned: false };
- local_inner_val
-}
-/// Information on the fees and requirements that the counterparty requires when forwarding
-/// payments to us through this channel.
-///
-/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelCounterparty_set_forwarding_info(this_ptr: &mut ChannelCounterparty, mut val: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) {
- let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.forwarding_info = local_val;
-}
-/// The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
-/// is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
-/// from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
-#[no_mangle]
-pub extern "C" fn ChannelCounterparty_get_outbound_htlc_minimum_msat(this_ptr: &ChannelCounterparty) -> crate::c_types::derived::COption_u64Z {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_htlc_minimum_msat;
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
- local_inner_val
-}
-/// The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
-/// is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
-/// from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
-#[no_mangle]
-pub extern "C" fn ChannelCounterparty_set_outbound_htlc_minimum_msat(this_ptr: &mut ChannelCounterparty, mut val: crate::c_types::derived::COption_u64Z) {
- let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.outbound_htlc_minimum_msat = local_val;
-}
-/// The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
-#[no_mangle]
-pub extern "C" fn ChannelCounterparty_get_outbound_htlc_maximum_msat(this_ptr: &ChannelCounterparty) -> crate::c_types::derived::COption_u64Z {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_htlc_maximum_msat;
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
- local_inner_val
-}
-/// The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
-#[no_mangle]
-pub extern "C" fn ChannelCounterparty_set_outbound_htlc_maximum_msat(this_ptr: &mut ChannelCounterparty, mut val: crate::c_types::derived::COption_u64Z) {
- let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.outbound_htlc_maximum_msat = local_val;
-}
-/// Constructs a new ChannelCounterparty given each field
-///
-/// Note that forwarding_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelCounterparty_new(mut node_id_arg: crate::c_types::PublicKey, mut features_arg: crate::lightning::ln::features::InitFeatures, mut unspendable_punishment_reserve_arg: u64, mut forwarding_info_arg: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, mut outbound_htlc_minimum_msat_arg: crate::c_types::derived::COption_u64Z, mut outbound_htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z) -> ChannelCounterparty {
- let mut local_forwarding_info_arg = if forwarding_info_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(forwarding_info_arg.take_inner()) } }) };
- let mut local_outbound_htlc_minimum_msat_arg = if outbound_htlc_minimum_msat_arg.is_some() { Some( { outbound_htlc_minimum_msat_arg.take() }) } else { None };
- let mut local_outbound_htlc_maximum_msat_arg = if outbound_htlc_maximum_msat_arg.is_some() { Some( { outbound_htlc_maximum_msat_arg.take() }) } else { None };
- ChannelCounterparty { inner: ObjOps::heap_alloc(nativeChannelCounterparty {
- node_id: node_id_arg.into_rust(),
- features: *unsafe { Box::from_raw(features_arg.take_inner()) },
- unspendable_punishment_reserve: unspendable_punishment_reserve_arg,
- forwarding_info: local_forwarding_info_arg,
- outbound_htlc_minimum_msat: local_outbound_htlc_minimum_msat_arg,
- outbound_htlc_maximum_msat: local_outbound_htlc_maximum_msat_arg,
- }), is_owned: true }
-}
-impl Clone for ChannelCounterparty {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeChannelCounterparty>::is_null(self.inner) { core::ptr::null_mut() } else {
- ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
- is_owned: true,
- }
- }
-}
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn ChannelCounterparty_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelCounterparty)).clone() })) as *mut c_void
-}
-#[no_mangle]
-/// Creates a copy of the ChannelCounterparty
-pub extern "C" fn ChannelCounterparty_clone(orig: &ChannelCounterparty) -> ChannelCounterparty {
- orig.clone()
-}
-/// Get a string which allows debug introspection of a ChannelCounterparty object
-pub extern "C" fn ChannelCounterparty_debug_str_void(o: *const c_void) -> Str {
- alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channelmanager::ChannelCounterparty }).into()}
-
-use lightning::ln::channelmanager::ChannelDetails as nativeChannelDetailsImport;
-pub(crate) type nativeChannelDetails = nativeChannelDetailsImport;
-
-/// Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`]
-#[must_use]
-#[repr(C)]
-pub struct ChannelDetails {
- /// A pointer to the opaque Rust object.
-
- /// Nearly everywhere, inner must be non-null, however in places where
- /// the Rust equivalent takes an Option, it may be set to null to indicate None.
- pub inner: *mut nativeChannelDetails,
- /// Indicates that this is the only struct which contains the same pointer.
-
- /// Rust functions which take ownership of an object provided via an argument require
- /// this to be true and invalidate the object pointed to by inner.
- pub is_owned: bool,
-}
-
-impl Drop for ChannelDetails {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeChannelDetails>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_free(this_obj: ChannelDetails) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn ChannelDetails_free_void(this_ptr: *mut c_void) {
- let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelDetails) };
-}
-#[allow(unused)]
-impl ChannelDetails {
- pub(crate) fn get_native_ref(&self) -> &'static nativeChannelDetails {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelDetails {
- unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
- }
- /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
- pub(crate) fn take_inner(mut self) -> *mut nativeChannelDetails {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
-}
-/// The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
-/// thereafter this is the txid of the funding transaction xor the funding transaction output).
-/// Note that this means this value is *not* persistent - it can change once during the
-/// lifetime of the channel.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_channel_id(this_ptr: &ChannelDetails) -> crate::lightning::ln::types::ChannelId {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
- crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
-}
-/// The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
-/// thereafter this is the txid of the funding transaction xor the funding transaction output).
-/// Note that this means this value is *not* persistent - it can change once during the
-/// lifetime of the channel.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_channel_id(this_ptr: &mut ChannelDetails, mut val: crate::lightning::ln::types::ChannelId) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
-}
-/// Parameters which apply to our counterparty. See individual fields for more information.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_counterparty(this_ptr: &ChannelDetails) -> crate::lightning::ln::channelmanager::ChannelCounterparty {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().counterparty;
- crate::lightning::ln::channelmanager::ChannelCounterparty { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channelmanager::ChannelCounterparty<>) as *mut _) }, is_owned: false }
-}
-/// Parameters which apply to our counterparty. See individual fields for more information.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_counterparty(this_ptr: &mut ChannelDetails, mut val: crate::lightning::ln::channelmanager::ChannelCounterparty) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.counterparty = *unsafe { Box::from_raw(val.take_inner()) };
-}
-/// The Channel's funding transaction output, if we've negotiated the funding transaction with
-/// our counterparty already.
-///
-/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_funding_txo(this_ptr: &ChannelDetails) -> crate::lightning::chain::transaction::OutPoint {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_txo;
- let mut local_inner_val = crate::lightning::chain::transaction::OutPoint { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::chain::transaction::OutPoint<>) as *mut _ }, is_owned: false };
- local_inner_val
-}
-/// The Channel's funding transaction output, if we've negotiated the funding transaction with
-/// our counterparty already.
-///
-/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_funding_txo(this_ptr: &mut ChannelDetails, mut val: crate::lightning::chain::transaction::OutPoint) {
- let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_txo = local_val;
-}
-/// The features which this channel operates with. See individual features for more info.
-///
-/// `None` until negotiation completes and the channel type is finalized.
-///
-/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_channel_type(this_ptr: &ChannelDetails) -> crate::lightning::ln::features::ChannelTypeFeatures {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_type;
- let mut local_inner_val = crate::lightning::ln::features::ChannelTypeFeatures { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::features::ChannelTypeFeatures<>) as *mut _ }, is_owned: false };
- local_inner_val
-}
-/// The features which this channel operates with. See individual features for more info.
-///
-/// `None` until negotiation completes and the channel type is finalized.
-///
-/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_channel_type(this_ptr: &mut ChannelDetails, mut val: crate::lightning::ln::features::ChannelTypeFeatures) {
- let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_type = local_val;
-}
-/// The position of the funding transaction in the chain. None if the funding transaction has
-/// not yet been confirmed and the channel fully opened.
-///
-/// Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
-/// payments instead of this. See [`get_inbound_payment_scid`].
-///
-/// For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
-/// be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
-///
-/// [`inbound_scid_alias`]: Self::inbound_scid_alias
-/// [`outbound_scid_alias`]: Self::outbound_scid_alias
-/// [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
-/// [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
-/// [`confirmations_required`]: Self::confirmations_required
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_short_channel_id(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id;
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
- local_inner_val
-}
-/// The position of the funding transaction in the chain. None if the funding transaction has
-/// not yet been confirmed and the channel fully opened.
-///
-/// Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
-/// payments instead of this. See [`get_inbound_payment_scid`].
-///
-/// For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
-/// be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
-///
-/// [`inbound_scid_alias`]: Self::inbound_scid_alias
-/// [`outbound_scid_alias`]: Self::outbound_scid_alias
-/// [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
-/// [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
-/// [`confirmations_required`]: Self::confirmations_required
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_short_channel_id(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u64Z) {
- let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.short_channel_id = local_val;
-}
-/// An optional [`short_channel_id`] alias for this channel, randomly generated by us and
-/// usable in place of [`short_channel_id`] to reference the channel in outbound routes when
-/// the channel has not yet been confirmed (as long as [`confirmations_required`] is
-/// `Some(0)`).
-///
-/// This will be `None` as long as the channel is not available for routing outbound payments.
-///
-/// [`short_channel_id`]: Self::short_channel_id
-/// [`confirmations_required`]: Self::confirmations_required
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_outbound_scid_alias(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_scid_alias;
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
- local_inner_val
-}
-/// An optional [`short_channel_id`] alias for this channel, randomly generated by us and
-/// usable in place of [`short_channel_id`] to reference the channel in outbound routes when
-/// the channel has not yet been confirmed (as long as [`confirmations_required`] is
-/// `Some(0)`).
-///
-/// This will be `None` as long as the channel is not available for routing outbound payments.
-///
-/// [`short_channel_id`]: Self::short_channel_id
-/// [`confirmations_required`]: Self::confirmations_required
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_outbound_scid_alias(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u64Z) {
- let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.outbound_scid_alias = local_val;
-}
-/// An optional [`short_channel_id`] alias for this channel, randomly generated by our
-/// counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
-/// counterparty will recognize the alias provided here in place of the [`short_channel_id`]
-/// when they see a payment to be routed to us.
-///
-/// Our counterparty may choose to rotate this value at any time, though will always recognize
-/// previous values for inbound payment forwarding.
-///
-/// [`short_channel_id`]: Self::short_channel_id
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_inbound_scid_alias(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_scid_alias;
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
- local_inner_val
-}
-/// An optional [`short_channel_id`] alias for this channel, randomly generated by our
-/// counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
-/// counterparty will recognize the alias provided here in place of the [`short_channel_id`]
-/// when they see a payment to be routed to us.
-///
-/// Our counterparty may choose to rotate this value at any time, though will always recognize
-/// previous values for inbound payment forwarding.
-///
-/// [`short_channel_id`]: Self::short_channel_id
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_inbound_scid_alias(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u64Z) {
- let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.inbound_scid_alias = local_val;
-}
-/// The value, in satoshis, of this channel as appears in the funding output
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_channel_value_satoshis(this_ptr: &ChannelDetails) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_value_satoshis;
- *inner_val
-}
-/// The value, in satoshis, of this channel as appears in the funding output
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_channel_value_satoshis(this_ptr: &mut ChannelDetails, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_value_satoshis = val;
-}
-/// The value, in satoshis, that must always be held in the channel for us. This value ensures
-/// that if we broadcast a revoked state, our counterparty can punish us by claiming at least
-/// this value on chain.
-///
-/// This value is not included in [`outbound_capacity_msat`] as it can never be spent.
-///
-/// This value will be `None` for outbound channels until the counterparty accepts the channel.
-///
-/// [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_unspendable_punishment_reserve(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().unspendable_punishment_reserve;
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
- local_inner_val
-}
-/// The value, in satoshis, that must always be held in the channel for us. This value ensures
-/// that if we broadcast a revoked state, our counterparty can punish us by claiming at least
-/// this value on chain.
-///
-/// This value is not included in [`outbound_capacity_msat`] as it can never be spent.
-///
-/// This value will be `None` for outbound channels until the counterparty accepts the channel.
-///
-/// [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_unspendable_punishment_reserve(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u64Z) {
- let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.unspendable_punishment_reserve = local_val;
-}
-/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
-/// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
-/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
-/// `user_channel_id` will be randomized for an inbound channel. This may be zero for objects
-/// serialized with LDK versions prior to 0.0.113.
-///
-/// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
-/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
-/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_user_channel_id(this_ptr: &ChannelDetails) -> crate::c_types::U128 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().user_channel_id;
- inner_val.into()
-}
-/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
-/// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
-/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
-/// `user_channel_id` will be randomized for an inbound channel. This may be zero for objects
-/// serialized with LDK versions prior to 0.0.113.
-///
-/// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
-/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
-/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_user_channel_id(this_ptr: &mut ChannelDetails, mut val: crate::c_types::U128) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.user_channel_id = val.into();
-}
-/// The currently negotiated fee rate denominated in satoshi per 1000 weight units,
-/// which is applied to commitment and HTLC transactions.
-///
-/// This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_feerate_sat_per_1000_weight(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u32Z {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().feerate_sat_per_1000_weight;
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { inner_val.unwrap() }) };
- local_inner_val
-}
-/// The currently negotiated fee rate denominated in satoshi per 1000 weight units,
-/// which is applied to commitment and HTLC transactions.
-///
-/// This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_feerate_sat_per_1000_weight(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u32Z) {
- let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.feerate_sat_per_1000_weight = local_val;
-}
-/// Our total balance. This is the amount we would get if we close the channel.
-/// This value is not exact. Due to various in-flight changes and feerate changes, exactly this
-/// amount is not likely to be recoverable on close.
-///
-/// This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
-/// balance is not available for inclusion in new outbound HTLCs). This further does not include
-/// any pending outgoing HTLCs which are awaiting some other resolution to be sent.
-/// This does not consider any on-chain fees.
-///
-/// See also [`ChannelDetails::outbound_capacity_msat`]
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_balance_msat(this_ptr: &ChannelDetails) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().balance_msat;
- *inner_val
-}
-/// Our total balance. This is the amount we would get if we close the channel.
-/// This value is not exact. Due to various in-flight changes and feerate changes, exactly this
-/// amount is not likely to be recoverable on close.
-///
-/// This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
-/// balance is not available for inclusion in new outbound HTLCs). This further does not include
-/// any pending outgoing HTLCs which are awaiting some other resolution to be sent.
-/// This does not consider any on-chain fees.
-///
-/// See also [`ChannelDetails::outbound_capacity_msat`]
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_balance_msat(this_ptr: &mut ChannelDetails, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.balance_msat = val;
-}
-/// The available outbound capacity for sending HTLCs to the remote peer. This does not include
-/// any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
-/// available for inclusion in new outbound HTLCs). This further does not include any pending
-/// outgoing HTLCs which are awaiting some other resolution to be sent.
-///
-/// See also [`ChannelDetails::balance_msat`]
-///
-/// This value is not exact. Due to various in-flight changes, feerate changes, and our
-/// conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
-/// should be able to spend nearly this amount.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_outbound_capacity_msat(this_ptr: &ChannelDetails) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_capacity_msat;
- *inner_val
-}
-/// The available outbound capacity for sending HTLCs to the remote peer. This does not include
-/// any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
-/// available for inclusion in new outbound HTLCs). This further does not include any pending
-/// outgoing HTLCs which are awaiting some other resolution to be sent.
-///
-/// See also [`ChannelDetails::balance_msat`]
-///
-/// This value is not exact. Due to various in-flight changes, feerate changes, and our
-/// conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
-/// should be able to spend nearly this amount.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_outbound_capacity_msat(this_ptr: &mut ChannelDetails, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.outbound_capacity_msat = val;
-}
-/// The available outbound capacity for sending a single HTLC to the remote peer. This is
-/// similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
-/// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
-/// to use a limit as close as possible to the HTLC limit we can currently send.
-///
-/// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
-/// [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`].
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_next_outbound_htlc_limit_msat(this_ptr: &ChannelDetails) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().next_outbound_htlc_limit_msat;
- *inner_val
-}
-/// The available outbound capacity for sending a single HTLC to the remote peer. This is
-/// similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
-/// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
-/// to use a limit as close as possible to the HTLC limit we can currently send.
-///
-/// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
-/// [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`].
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_next_outbound_htlc_limit_msat(this_ptr: &mut ChannelDetails, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_outbound_htlc_limit_msat = val;
-}
-/// The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
-/// [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
-/// an upper-bound. This is intended for use when routing, allowing us to ensure we pick a
-/// route which is valid.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_next_outbound_htlc_minimum_msat(this_ptr: &ChannelDetails) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().next_outbound_htlc_minimum_msat;
- *inner_val
-}
-/// The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
-/// [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
-/// an upper-bound. This is intended for use when routing, allowing us to ensure we pick a
-/// route which is valid.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_next_outbound_htlc_minimum_msat(this_ptr: &mut ChannelDetails, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_outbound_htlc_minimum_msat = val;
-}
-/// The available inbound capacity for the remote peer to send HTLCs to us. This does not
-/// include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
-/// available for inclusion in new inbound HTLCs).
-/// Note that there are some corner cases not fully handled here, so the actual available
-/// inbound capacity may be slightly higher than this.
-///
-/// This value is not exact. Due to various in-flight changes, feerate changes, and our
-/// counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
-/// However, our counterparty should be able to spend nearly this amount.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_inbound_capacity_msat(this_ptr: &ChannelDetails) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_capacity_msat;
- *inner_val
-}
-/// The available inbound capacity for the remote peer to send HTLCs to us. This does not
-/// include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
-/// available for inclusion in new inbound HTLCs).
-/// Note that there are some corner cases not fully handled here, so the actual available
-/// inbound capacity may be slightly higher than this.
-///
-/// This value is not exact. Due to various in-flight changes, feerate changes, and our
-/// counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
-/// However, our counterparty should be able to spend nearly this amount.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_inbound_capacity_msat(this_ptr: &mut ChannelDetails, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.inbound_capacity_msat = val;
-}
-/// The number of required confirmations on the funding transaction before the funding will be
-/// considered \"locked\". This number is selected by the channel fundee (i.e. us if
-/// [`is_outbound`] is *not* set), and can be selected for inbound channels with
-/// [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
-/// [`ChannelHandshakeLimits::max_minimum_depth`].
-///
-/// This value will be `None` for outbound channels until the counterparty accepts the channel.
-///
-/// [`is_outbound`]: ChannelDetails::is_outbound
-/// [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
-/// [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_confirmations_required(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u32Z {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().confirmations_required;
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { inner_val.unwrap() }) };
- local_inner_val
-}
-/// The number of required confirmations on the funding transaction before the funding will be
-/// considered \"locked\". This number is selected by the channel fundee (i.e. us if
-/// [`is_outbound`] is *not* set), and can be selected for inbound channels with
-/// [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
-/// [`ChannelHandshakeLimits::max_minimum_depth`].
-///
-/// This value will be `None` for outbound channels until the counterparty accepts the channel.
-///
-/// [`is_outbound`]: ChannelDetails::is_outbound
-/// [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
-/// [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_confirmations_required(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u32Z) {
- let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.confirmations_required = local_val;
-}
-/// The current number of confirmations on the funding transaction.
-///
-/// This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_confirmations(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u32Z {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().confirmations;
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { inner_val.unwrap() }) };
- local_inner_val
-}
-/// The current number of confirmations on the funding transaction.
-///
-/// This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_confirmations(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u32Z) {
- let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.confirmations = local_val;
-}
-/// The number of blocks (after our commitment transaction confirms) that we will need to wait
-/// until we can claim our funds after we force-close the channel. During this time our
-/// counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
-/// force-closes the channel and broadcasts a commitment transaction we do not have to wait any
-/// time to claim our non-HTLC-encumbered funds.
-///
-/// This value will be `None` for outbound channels until the counterparty accepts the channel.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_force_close_spend_delay(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u16Z {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().force_close_spend_delay;
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u16Z::None } else { crate::c_types::derived::COption_u16Z::Some( { inner_val.unwrap() }) };
- local_inner_val
-}
-/// The number of blocks (after our commitment transaction confirms) that we will need to wait
-/// until we can claim our funds after we force-close the channel. During this time our
-/// counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
-/// force-closes the channel and broadcasts a commitment transaction we do not have to wait any
-/// time to claim our non-HTLC-encumbered funds.
-///
-/// This value will be `None` for outbound channels until the counterparty accepts the channel.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_force_close_spend_delay(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u16Z) {
- let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.force_close_spend_delay = local_val;
-}
-/// True if the channel was initiated (and thus funded) by us.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_is_outbound(this_ptr: &ChannelDetails) -> bool {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().is_outbound;
- *inner_val
-}
-/// True if the channel was initiated (and thus funded) by us.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_is_outbound(this_ptr: &mut ChannelDetails, mut val: bool) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_outbound = val;
-}
-/// True if the channel is confirmed, channel_ready messages have been exchanged, and the
-/// channel is not currently being shut down. `channel_ready` message exchange implies the
-/// required confirmation count has been reached (and we were connected to the peer at some
-/// point after the funding transaction received enough confirmations). The required
-/// confirmation count is provided in [`confirmations_required`].
-///
-/// [`confirmations_required`]: ChannelDetails::confirmations_required
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_is_channel_ready(this_ptr: &ChannelDetails) -> bool {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().is_channel_ready;
- *inner_val
-}
-/// True if the channel is confirmed, channel_ready messages have been exchanged, and the
-/// channel is not currently being shut down. `channel_ready` message exchange implies the
-/// required confirmation count has been reached (and we were connected to the peer at some
-/// point after the funding transaction received enough confirmations). The required
-/// confirmation count is provided in [`confirmations_required`].
-///
-/// [`confirmations_required`]: ChannelDetails::confirmations_required
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_is_channel_ready(this_ptr: &mut ChannelDetails, mut val: bool) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_channel_ready = val;
-}
-/// The stage of the channel's shutdown.
-/// `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116.
-///
-/// Returns a copy of the field.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_channel_shutdown_state(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_ChannelShutdownStateZ {
- let mut inner_val = this_ptr.get_native_mut_ref().channel_shutdown_state.clone();
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ChannelShutdownStateZ::None } else { crate::c_types::derived::COption_ChannelShutdownStateZ::Some( { crate::lightning::ln::channelmanager::ChannelShutdownState::native_into(inner_val.unwrap()) }) };
- local_inner_val
-}
-/// The stage of the channel's shutdown.
-/// `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_channel_shutdown_state(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_ChannelShutdownStateZ) {
- let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_native() }})} };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_shutdown_state = local_val;
-}
-/// True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
-/// the peer is connected, and (c) the channel is not currently negotiating a shutdown.
-///
-/// This is a strict superset of `is_channel_ready`.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_is_usable(this_ptr: &ChannelDetails) -> bool {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().is_usable;
- *inner_val
-}
-/// True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
-/// the peer is connected, and (c) the channel is not currently negotiating a shutdown.
-///
-/// This is a strict superset of `is_channel_ready`.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_is_usable(this_ptr: &mut ChannelDetails, mut val: bool) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_usable = val;
-}
-/// True if this channel is (or will be) publicly-announced.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_is_public(this_ptr: &ChannelDetails) -> bool {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().is_public;
- *inner_val
-}
-/// True if this channel is (or will be) publicly-announced.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_is_public(this_ptr: &mut ChannelDetails, mut val: bool) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_public = val;
-}
-/// The smallest value HTLC (in msat) we will accept, for this channel. This field
-/// is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_inbound_htlc_minimum_msat(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_htlc_minimum_msat;
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
- local_inner_val
-}
-/// The smallest value HTLC (in msat) we will accept, for this channel. This field
-/// is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_inbound_htlc_minimum_msat(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u64Z) {
- let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.inbound_htlc_minimum_msat = local_val;
-}
-/// The largest value HTLC (in msat) we currently will accept, for this channel.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_inbound_htlc_maximum_msat(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_htlc_maximum_msat;
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
- local_inner_val
-}
-/// The largest value HTLC (in msat) we currently will accept, for this channel.
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_inbound_htlc_maximum_msat(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u64Z) {
- let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.inbound_htlc_maximum_msat = local_val;
-}
-/// Set of configurable parameters that affect channel operation.
-///
-/// This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
-///
-/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_config(this_ptr: &ChannelDetails) -> crate::lightning::util::config::ChannelConfig {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().config;
- let mut local_inner_val = crate::lightning::util::config::ChannelConfig { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::util::config::ChannelConfig<>) as *mut _ }, is_owned: false };
- local_inner_val
-}
-/// Set of configurable parameters that affect channel operation.
-///
-/// This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
-///
-/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
-#[no_mangle]
-pub extern "C" fn ChannelDetails_set_config(this_ptr: &mut ChannelDetails, mut val: crate::lightning::util::config::ChannelConfig) {
- let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.config = local_val;
-}
-impl Clone for ChannelDetails {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeChannelDetails>::is_null(self.inner) { core::ptr::null_mut() } else {
- ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
- is_owned: true,
- }
- }
-}
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn ChannelDetails_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelDetails)).clone() })) as *mut c_void
-}
-#[no_mangle]
-/// Creates a copy of the ChannelDetails
-pub extern "C" fn ChannelDetails_clone(orig: &ChannelDetails) -> ChannelDetails {
- orig.clone()
-}
-/// Get a string which allows debug introspection of a ChannelDetails object
-pub extern "C" fn ChannelDetails_debug_str_void(o: *const c_void) -> Str {
- alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channelmanager::ChannelDetails }).into()}
-/// Gets the current SCID which should be used to identify this channel for inbound payments.
-/// This should be used for providing invoice hints or in any other context where our
-/// counterparty will forward a payment to us.
-///
-/// This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
-/// [`ChannelDetails::short_channel_id`]. See those for more information.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_inbound_payment_scid(this_arg: &crate::lightning::ln::channelmanager::ChannelDetails) -> crate::c_types::derived::COption_u64Z {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_inbound_payment_scid();
- let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { ret.unwrap() }) };
- local_ret
-}
-
-/// Gets the current SCID which should be used to identify this channel for outbound payments.
-/// This should be used in [`Route`]s to describe the first hop or in other contexts where
-/// we're sending or forwarding a payment outbound over this channel.
-///
-/// This is either the [`ChannelDetails::short_channel_id`], if set, or the
-/// [`ChannelDetails::outbound_scid_alias`]. See those for more information.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelDetails_get_outbound_payment_scid(this_arg: &crate::lightning::ln::channelmanager::ChannelDetails) -> crate::c_types::derived::COption_u64Z {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_outbound_payment_scid();
- let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { ret.unwrap() }) };
- local_ret
-}
-
-/// Further information on the details of the channel shutdown.
-/// Upon channels being forced closed (i.e. commitment transaction confirmation detected
-/// by `ChainMonitor`), ChannelShutdownState will be set to `ShutdownComplete` or
-/// the channel will be removed shortly.
-/// Also note, that in normal operation, peers could disconnect at any of these states
-/// and require peer re-connection before making progress onto other states
-#[derive(Clone)]
-#[must_use]
-#[repr(C)]
-pub enum ChannelShutdownState {
- /// Channel has not sent or received a shutdown message.
- NotShuttingDown,
- /// Local node has sent a shutdown message for this channel.
- ShutdownInitiated,
- /// Shutdown message exchanges have concluded and the channels are in the midst of
- /// resolving all existing open HTLCs before closing can continue.
- ResolvingHTLCs,
- /// All HTLCs have been resolved, nodes are currently negotiating channel close onchain fee rates.
- NegotiatingClosingFee,
- /// We've successfully negotiated a closing_signed dance. At this point `ChannelManager` is about
- /// to drop the channel.
- ShutdownComplete,
-}
-use lightning::ln::channelmanager::ChannelShutdownState as ChannelShutdownStateImport;
-pub(crate) type nativeChannelShutdownState = ChannelShutdownStateImport;
-
-impl ChannelShutdownState {
- #[allow(unused)]
- pub(crate) fn to_native(&self) -> nativeChannelShutdownState {
- match self {
- ChannelShutdownState::NotShuttingDown => nativeChannelShutdownState::NotShuttingDown,
- ChannelShutdownState::ShutdownInitiated => nativeChannelShutdownState::ShutdownInitiated,
- ChannelShutdownState::ResolvingHTLCs => nativeChannelShutdownState::ResolvingHTLCs,
- ChannelShutdownState::NegotiatingClosingFee => nativeChannelShutdownState::NegotiatingClosingFee,
- ChannelShutdownState::ShutdownComplete => nativeChannelShutdownState::ShutdownComplete,
- }
- }
- #[allow(unused)]
- pub(crate) fn into_native(self) -> nativeChannelShutdownState {
- match self {
- ChannelShutdownState::NotShuttingDown => nativeChannelShutdownState::NotShuttingDown,
- ChannelShutdownState::ShutdownInitiated => nativeChannelShutdownState::ShutdownInitiated,
- ChannelShutdownState::ResolvingHTLCs => nativeChannelShutdownState::ResolvingHTLCs,
- ChannelShutdownState::NegotiatingClosingFee => nativeChannelShutdownState::NegotiatingClosingFee,
- ChannelShutdownState::ShutdownComplete => nativeChannelShutdownState::ShutdownComplete,
- }
- }
- #[allow(unused)]
- pub(crate) fn from_native(native: &ChannelShutdownStateImport) -> Self {
- let native = unsafe { &*(native as *const _ as *const c_void as *const nativeChannelShutdownState) };
- match native {
- nativeChannelShutdownState::NotShuttingDown => ChannelShutdownState::NotShuttingDown,
- nativeChannelShutdownState::ShutdownInitiated => ChannelShutdownState::ShutdownInitiated,
- nativeChannelShutdownState::ResolvingHTLCs => ChannelShutdownState::ResolvingHTLCs,
- nativeChannelShutdownState::NegotiatingClosingFee => ChannelShutdownState::NegotiatingClosingFee,
- nativeChannelShutdownState::ShutdownComplete => ChannelShutdownState::ShutdownComplete,
- }
- }
- #[allow(unused)]
- pub(crate) fn native_into(native: nativeChannelShutdownState) -> Self {
- match native {
- nativeChannelShutdownState::NotShuttingDown => ChannelShutdownState::NotShuttingDown,
- nativeChannelShutdownState::ShutdownInitiated => ChannelShutdownState::ShutdownInitiated,
- nativeChannelShutdownState::ResolvingHTLCs => ChannelShutdownState::ResolvingHTLCs,
- nativeChannelShutdownState::NegotiatingClosingFee => ChannelShutdownState::NegotiatingClosingFee,
- nativeChannelShutdownState::ShutdownComplete => ChannelShutdownState::ShutdownComplete,
- }
- }
-}
-/// Creates a copy of the ChannelShutdownState
-#[no_mangle]
-pub extern "C" fn ChannelShutdownState_clone(orig: &ChannelShutdownState) -> ChannelShutdownState {
- 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 ChannelShutdownState_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ChannelShutdownState)).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 ChannelShutdownState_free_void(this_ptr: *mut c_void) {
- let _ = unsafe { Box::from_raw(this_ptr as *mut ChannelShutdownState) };
-}
-#[no_mangle]
-/// Utility method to constructs a new NotShuttingDown-variant ChannelShutdownState
-pub extern "C" fn ChannelShutdownState_not_shutting_down() -> ChannelShutdownState {
- ChannelShutdownState::NotShuttingDown}
-#[no_mangle]
-/// Utility method to constructs a new ShutdownInitiated-variant ChannelShutdownState
-pub extern "C" fn ChannelShutdownState_shutdown_initiated() -> ChannelShutdownState {
- ChannelShutdownState::ShutdownInitiated}
-#[no_mangle]
-/// Utility method to constructs a new ResolvingHTLCs-variant ChannelShutdownState
-pub extern "C" fn ChannelShutdownState_resolving_htlcs() -> ChannelShutdownState {
- ChannelShutdownState::ResolvingHTLCs}
-#[no_mangle]
-/// Utility method to constructs a new NegotiatingClosingFee-variant ChannelShutdownState
-pub extern "C" fn ChannelShutdownState_negotiating_closing_fee() -> ChannelShutdownState {
- ChannelShutdownState::NegotiatingClosingFee}
-#[no_mangle]
-/// Utility method to constructs a new ShutdownComplete-variant ChannelShutdownState
-pub extern "C" fn ChannelShutdownState_shutdown_complete() -> ChannelShutdownState {
- ChannelShutdownState::ShutdownComplete}
-/// Get a string which allows debug introspection of a ChannelShutdownState object
-pub extern "C" fn ChannelShutdownState_debug_str_void(o: *const c_void) -> Str {
- alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channelmanager::ChannelShutdownState }).into()}
-/// Checks if two ChannelShutdownStates contain equal inner contents.
-/// This ignores pointers and is_owned flags and looks at the values in fields.
-#[no_mangle]
-pub extern "C" fn ChannelShutdownState_eq(a: &ChannelShutdownState, b: &ChannelShutdownState) -> bool {
- if &a.to_native() == &b.to_native() { true } else { false }
-}