+/// The channel type that this channel will represent. If none is set, we derive the channel
+/// type from the intersection of our feature bits with our counterparty's feature bits from
+/// the Init message.
+///
+/// This is required to match the equivalent field in [`OpenChannel`] or [`OpenChannelV2`]'s
+/// [`CommonOpenChannelFields::channel_type`].
+///
+/// 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 CommonAcceptChannelFields_get_channel_type(this_ptr: &CommonAcceptChannelFields) -> crate::lightning_types::features::ChannelTypeFeatures {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_type;
+ let mut local_inner_val = crate::lightning_types::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_types::features::ChannelTypeFeatures<>) as *mut _ }, is_owned: false };
+ local_inner_val
+}
+/// The channel type that this channel will represent. If none is set, we derive the channel
+/// type from the intersection of our feature bits with our counterparty's feature bits from
+/// the Init message.
+///
+/// This is required to match the equivalent field in [`OpenChannel`] or [`OpenChannelV2`]'s
+/// [`CommonOpenChannelFields::channel_type`].
+///
+/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_set_channel_type(this_ptr: &mut CommonAcceptChannelFields, mut val: crate::lightning_types::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;
+}
+/// Constructs a new CommonAcceptChannelFields given each field
+///
+/// Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[must_use]
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_new(mut temporary_channel_id_arg: crate::lightning::ln::types::ChannelId, mut dust_limit_satoshis_arg: u64, mut max_htlc_value_in_flight_msat_arg: u64, mut htlc_minimum_msat_arg: u64, mut minimum_depth_arg: u32, mut to_self_delay_arg: u16, mut max_accepted_htlcs_arg: u16, mut funding_pubkey_arg: crate::c_types::PublicKey, mut revocation_basepoint_arg: crate::c_types::PublicKey, mut payment_basepoint_arg: crate::c_types::PublicKey, mut delayed_payment_basepoint_arg: crate::c_types::PublicKey, mut htlc_basepoint_arg: crate::c_types::PublicKey, mut first_per_commitment_point_arg: crate::c_types::PublicKey, mut shutdown_scriptpubkey_arg: crate::c_types::derived::COption_CVec_u8ZZ, mut channel_type_arg: crate::lightning_types::features::ChannelTypeFeatures) -> CommonAcceptChannelFields {
+ let mut local_shutdown_scriptpubkey_arg = { /*shutdown_scriptpubkey_arg*/ let shutdown_scriptpubkey_arg_opt = shutdown_scriptpubkey_arg; if shutdown_scriptpubkey_arg_opt.is_none() { None } else { Some({ { ::bitcoin::script::ScriptBuf::from({ shutdown_scriptpubkey_arg_opt.take() }.into_rust()) }})} };
+ let mut local_channel_type_arg = if channel_type_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_type_arg.take_inner()) } }) };
+ CommonAcceptChannelFields { inner: ObjOps::heap_alloc(nativeCommonAcceptChannelFields {
+ temporary_channel_id: *unsafe { Box::from_raw(temporary_channel_id_arg.take_inner()) },
+ dust_limit_satoshis: dust_limit_satoshis_arg,
+ max_htlc_value_in_flight_msat: max_htlc_value_in_flight_msat_arg,
+ htlc_minimum_msat: htlc_minimum_msat_arg,
+ minimum_depth: minimum_depth_arg,
+ to_self_delay: to_self_delay_arg,
+ max_accepted_htlcs: max_accepted_htlcs_arg,
+ funding_pubkey: funding_pubkey_arg.into_rust(),
+ revocation_basepoint: revocation_basepoint_arg.into_rust(),
+ payment_basepoint: payment_basepoint_arg.into_rust(),
+ delayed_payment_basepoint: delayed_payment_basepoint_arg.into_rust(),
+ htlc_basepoint: htlc_basepoint_arg.into_rust(),
+ first_per_commitment_point: first_per_commitment_point_arg.into_rust(),
+ shutdown_scriptpubkey: local_shutdown_scriptpubkey_arg,
+ channel_type: local_channel_type_arg,
+ }), is_owned: true }
+}
+impl Clone for CommonAcceptChannelFields {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeCommonAcceptChannelFields>::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 CommonAcceptChannelFields_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCommonAcceptChannelFields)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the CommonAcceptChannelFields
+pub extern "C" fn CommonAcceptChannelFields_clone(orig: &CommonAcceptChannelFields) -> CommonAcceptChannelFields {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a CommonAcceptChannelFields object
+pub extern "C" fn CommonAcceptChannelFields_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::CommonAcceptChannelFields }).into()}
+/// Generates a non-cryptographic 64-bit hash of the CommonAcceptChannelFields.
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_hash(o: &CommonAcceptChannelFields) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two CommonAcceptChannelFieldss 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.
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_eq(a: &CommonAcceptChannelFields, b: &CommonAcceptChannelFields) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::AcceptChannel as nativeAcceptChannelImport;
+pub(crate) type nativeAcceptChannel = nativeAcceptChannelImport;
+
+/// An [`accept_channel`] message to be sent to or received from a peer.
+///
+/// Used in V1 channel establishment
+///
+/// [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message
+#[must_use]
+#[repr(C)]
+pub struct AcceptChannel {
+ /// 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 nativeAcceptChannel,
+ /// 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 core::ops::Deref for AcceptChannel {
+ type Target = nativeAcceptChannel;
+ fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for AcceptChannel { }
+unsafe impl core::marker::Sync for AcceptChannel { }
+impl Drop for AcceptChannel {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeAcceptChannel>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn AcceptChannel_free(this_obj: AcceptChannel) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn AcceptChannel_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeAcceptChannel) };
+}
+#[allow(unused)]
+impl AcceptChannel {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeAcceptChannel {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeAcceptChannel {
+ 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 nativeAcceptChannel {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+ pub(crate) fn as_ref_to(&self) -> Self {
+ Self { inner: self.inner, is_owned: false }
+ }
+}
+/// Common fields of `accept_channel(2)`-like messages
+#[no_mangle]
+pub extern "C" fn AcceptChannel_get_common_fields(this_ptr: &AcceptChannel) -> crate::lightning::ln::msgs::CommonAcceptChannelFields {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().common_fields;
+ crate::lightning::ln::msgs::CommonAcceptChannelFields { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::CommonAcceptChannelFields<>) as *mut _) }, is_owned: false }
+}
+/// Common fields of `accept_channel(2)`-like messages
+#[no_mangle]
+pub extern "C" fn AcceptChannel_set_common_fields(this_ptr: &mut AcceptChannel, mut val: crate::lightning::ln::msgs::CommonAcceptChannelFields) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.common_fields = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
+#[no_mangle]
+pub extern "C" fn AcceptChannel_get_channel_reserve_satoshis(this_ptr: &AcceptChannel) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_reserve_satoshis;
+ *inner_val
+}
+/// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
+#[no_mangle]
+pub extern "C" fn AcceptChannel_set_channel_reserve_satoshis(this_ptr: &mut AcceptChannel, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_reserve_satoshis = val;
+}
+/// Constructs a new AcceptChannel given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn AcceptChannel_new(mut common_fields_arg: crate::lightning::ln::msgs::CommonAcceptChannelFields, mut channel_reserve_satoshis_arg: u64) -> AcceptChannel {
+ AcceptChannel { inner: ObjOps::heap_alloc(nativeAcceptChannel {
+ common_fields: *unsafe { Box::from_raw(common_fields_arg.take_inner()) },
+ channel_reserve_satoshis: channel_reserve_satoshis_arg,
+ }), is_owned: true }
+}
+impl Clone for AcceptChannel {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeAcceptChannel>::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 AcceptChannel_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeAcceptChannel)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the AcceptChannel
+pub extern "C" fn AcceptChannel_clone(orig: &AcceptChannel) -> AcceptChannel {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a AcceptChannel object
+pub extern "C" fn AcceptChannel_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::AcceptChannel }).into()}
+/// Generates a non-cryptographic 64-bit hash of the AcceptChannel.
+#[no_mangle]
+pub extern "C" fn AcceptChannel_hash(o: &AcceptChannel) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two AcceptChannels 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.
+#[no_mangle]
+pub extern "C" fn AcceptChannel_eq(a: &AcceptChannel, b: &AcceptChannel) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::AcceptChannelV2 as nativeAcceptChannelV2Import;
+pub(crate) type nativeAcceptChannelV2 = nativeAcceptChannelV2Import;
+
+/// An accept_channel2 message to be sent by or received from the channel accepter.
+///
+/// Used in V2 channel establishment
+///
+#[must_use]
+#[repr(C)]
+pub struct AcceptChannelV2 {
+ /// 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 nativeAcceptChannelV2,
+ /// 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 core::ops::Deref for AcceptChannelV2 {
+ type Target = nativeAcceptChannelV2;
+ fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for AcceptChannelV2 { }
+unsafe impl core::marker::Sync for AcceptChannelV2 { }
+impl Drop for AcceptChannelV2 {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeAcceptChannelV2>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the AcceptChannelV2, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn AcceptChannelV2_free(this_obj: AcceptChannelV2) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn AcceptChannelV2_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeAcceptChannelV2) };
+}
+#[allow(unused)]
+impl AcceptChannelV2 {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeAcceptChannelV2 {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeAcceptChannelV2 {
+ 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 nativeAcceptChannelV2 {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+ pub(crate) fn as_ref_to(&self) -> Self {
+ Self { inner: self.inner, is_owned: false }
+ }
+}
+/// Common fields of `accept_channel(2)`-like messages
+#[no_mangle]
+pub extern "C" fn AcceptChannelV2_get_common_fields(this_ptr: &AcceptChannelV2) -> crate::lightning::ln::msgs::CommonAcceptChannelFields {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().common_fields;
+ crate::lightning::ln::msgs::CommonAcceptChannelFields { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::CommonAcceptChannelFields<>) as *mut _) }, is_owned: false }
+}
+/// Common fields of `accept_channel(2)`-like messages
+#[no_mangle]
+pub extern "C" fn AcceptChannelV2_set_common_fields(this_ptr: &mut AcceptChannelV2, mut val: crate::lightning::ln::msgs::CommonAcceptChannelFields) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.common_fields = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// Part of the channel value contributed by the channel acceptor
+#[no_mangle]
+pub extern "C" fn AcceptChannelV2_get_funding_satoshis(this_ptr: &AcceptChannelV2) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_satoshis;
+ *inner_val
+}
+/// Part of the channel value contributed by the channel acceptor
+#[no_mangle]
+pub extern "C" fn AcceptChannelV2_set_funding_satoshis(this_ptr: &mut AcceptChannelV2, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_satoshis = val;
+}
+/// The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
+#[no_mangle]
+pub extern "C" fn AcceptChannelV2_get_second_per_commitment_point(this_ptr: &AcceptChannelV2) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().second_per_commitment_point;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
+#[no_mangle]
+pub extern "C" fn AcceptChannelV2_set_second_per_commitment_point(this_ptr: &mut AcceptChannelV2, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.second_per_commitment_point = val.into_rust();
+}
+/// Optionally, a requirement that only confirmed inputs can be added
+#[no_mangle]
+pub extern "C" fn AcceptChannelV2_get_require_confirmed_inputs(this_ptr: &AcceptChannelV2) -> crate::c_types::derived::COption_NoneZ {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().require_confirmed_inputs;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_NoneZ::None } else { crate::c_types::derived::COption_NoneZ::Some /* { () /**/ } */ };
+ local_inner_val
+}
+/// Optionally, a requirement that only confirmed inputs can be added
+#[no_mangle]
+pub extern "C" fn AcceptChannelV2_set_require_confirmed_inputs(this_ptr: &mut AcceptChannelV2, mut val: crate::c_types::derived::COption_NoneZ) {
+ let mut local_val = if val.is_some() { Some( { () /*val.take()*/ }) } else { None };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.require_confirmed_inputs = local_val;
+}
+/// Constructs a new AcceptChannelV2 given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn AcceptChannelV2_new(mut common_fields_arg: crate::lightning::ln::msgs::CommonAcceptChannelFields, mut funding_satoshis_arg: u64, mut second_per_commitment_point_arg: crate::c_types::PublicKey, mut require_confirmed_inputs_arg: crate::c_types::derived::COption_NoneZ) -> AcceptChannelV2 {
+ let mut local_require_confirmed_inputs_arg = if require_confirmed_inputs_arg.is_some() { Some( { () /*require_confirmed_inputs_arg.take()*/ }) } else { None };
+ AcceptChannelV2 { inner: ObjOps::heap_alloc(nativeAcceptChannelV2 {
+ common_fields: *unsafe { Box::from_raw(common_fields_arg.take_inner()) },
+ funding_satoshis: funding_satoshis_arg,
+ second_per_commitment_point: second_per_commitment_point_arg.into_rust(),
+ require_confirmed_inputs: local_require_confirmed_inputs_arg,
+ }), is_owned: true }
+}
+impl Clone for AcceptChannelV2 {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeAcceptChannelV2>::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 AcceptChannelV2_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeAcceptChannelV2)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the AcceptChannelV2
+pub extern "C" fn AcceptChannelV2_clone(orig: &AcceptChannelV2) -> AcceptChannelV2 {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a AcceptChannelV2 object
+pub extern "C" fn AcceptChannelV2_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::AcceptChannelV2 }).into()}
+/// Generates a non-cryptographic 64-bit hash of the AcceptChannelV2.
+#[no_mangle]
+pub extern "C" fn AcceptChannelV2_hash(o: &AcceptChannelV2) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two AcceptChannelV2s 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.
+#[no_mangle]
+pub extern "C" fn AcceptChannelV2_eq(a: &AcceptChannelV2, b: &AcceptChannelV2) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::FundingCreated as nativeFundingCreatedImport;
+pub(crate) type nativeFundingCreated = nativeFundingCreatedImport;
+
+/// A [`funding_created`] message to be sent to or received from a peer.
+///
+/// Used in V1 channel establishment
+///
+/// [`funding_created`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_created-message
+#[must_use]
+#[repr(C)]
+pub struct FundingCreated {
+ /// 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 nativeFundingCreated,
+ /// 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 core::ops::Deref for FundingCreated {
+ type Target = nativeFundingCreated;
+ fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for FundingCreated { }
+unsafe impl core::marker::Sync for FundingCreated { }
+impl Drop for FundingCreated {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeFundingCreated>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn FundingCreated_free(this_obj: FundingCreated) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn FundingCreated_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeFundingCreated) };
+}
+#[allow(unused)]
+impl FundingCreated {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeFundingCreated {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeFundingCreated {
+ 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 nativeFundingCreated {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+ pub(crate) fn as_ref_to(&self) -> Self {
+ Self { inner: self.inner, is_owned: false }
+ }
+}
+/// A temporary channel ID, until the funding is established
+#[no_mangle]
+pub extern "C" fn FundingCreated_get_temporary_channel_id(this_ptr: &FundingCreated) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().temporary_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 }
+}
+/// A temporary channel ID, until the funding is established
+#[no_mangle]
+pub extern "C" fn FundingCreated_set_temporary_channel_id(this_ptr: &mut FundingCreated, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.temporary_channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The funding transaction ID
+#[no_mangle]
+pub extern "C" fn FundingCreated_get_funding_txid(this_ptr: &FundingCreated) -> *const [u8; 32] {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_txid;
+ inner_val.as_ref()
+}
+/// The funding transaction ID
+#[no_mangle]
+pub extern "C" fn FundingCreated_set_funding_txid(this_ptr: &mut FundingCreated, mut val: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_txid = ::bitcoin::hash_types::Txid::from_slice(&val.data[..]).unwrap();
+}
+/// The specific output index funding this channel
+#[no_mangle]
+pub extern "C" fn FundingCreated_get_funding_output_index(this_ptr: &FundingCreated) -> u16 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_output_index;
+ *inner_val
+}
+/// The specific output index funding this channel
+#[no_mangle]
+pub extern "C" fn FundingCreated_set_funding_output_index(this_ptr: &mut FundingCreated, mut val: u16) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_output_index = val;
+}
+/// The signature of the channel initiator (funder) on the initial commitment transaction
+#[no_mangle]
+pub extern "C" fn FundingCreated_get_signature(this_ptr: &FundingCreated) -> crate::c_types::ECDSASignature {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().signature;
+ crate::c_types::ECDSASignature::from_rust(&inner_val)
+}
+/// The signature of the channel initiator (funder) on the initial commitment transaction
+#[no_mangle]
+pub extern "C" fn FundingCreated_set_signature(this_ptr: &mut FundingCreated, mut val: crate::c_types::ECDSASignature) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.signature = val.into_rust();
+}
+/// Constructs a new FundingCreated given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn FundingCreated_new(mut temporary_channel_id_arg: crate::lightning::ln::types::ChannelId, mut funding_txid_arg: crate::c_types::ThirtyTwoBytes, mut funding_output_index_arg: u16, mut signature_arg: crate::c_types::ECDSASignature) -> FundingCreated {
+ FundingCreated { inner: ObjOps::heap_alloc(nativeFundingCreated {
+ temporary_channel_id: *unsafe { Box::from_raw(temporary_channel_id_arg.take_inner()) },
+ funding_txid: ::bitcoin::hash_types::Txid::from_slice(&funding_txid_arg.data[..]).unwrap(),
+ funding_output_index: funding_output_index_arg,
+ signature: signature_arg.into_rust(),
+ }), is_owned: true }
+}
+impl Clone for FundingCreated {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeFundingCreated>::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 FundingCreated_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeFundingCreated)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the FundingCreated
+pub extern "C" fn FundingCreated_clone(orig: &FundingCreated) -> FundingCreated {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a FundingCreated object
+pub extern "C" fn FundingCreated_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::FundingCreated }).into()}
+/// Generates a non-cryptographic 64-bit hash of the FundingCreated.
+#[no_mangle]
+pub extern "C" fn FundingCreated_hash(o: &FundingCreated) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two FundingCreateds 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.
+#[no_mangle]
+pub extern "C" fn FundingCreated_eq(a: &FundingCreated, b: &FundingCreated) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::FundingSigned as nativeFundingSignedImport;
+pub(crate) type nativeFundingSigned = nativeFundingSignedImport;
+
+/// A [`funding_signed`] message to be sent to or received from a peer.
+///
+/// Used in V1 channel establishment
+///
+/// [`funding_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_signed-message
+#[must_use]
+#[repr(C)]
+pub struct FundingSigned {
+ /// 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 nativeFundingSigned,
+ /// 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 core::ops::Deref for FundingSigned {
+ type Target = nativeFundingSigned;
+ fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for FundingSigned { }
+unsafe impl core::marker::Sync for FundingSigned { }
+impl Drop for FundingSigned {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeFundingSigned>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn FundingSigned_free(this_obj: FundingSigned) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn FundingSigned_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeFundingSigned) };
+}
+#[allow(unused)]
+impl FundingSigned {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeFundingSigned {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeFundingSigned {
+ 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 nativeFundingSigned {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+ pub(crate) fn as_ref_to(&self) -> Self {
+ Self { inner: self.inner, is_owned: false }
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn FundingSigned_get_channel_id(this_ptr: &FundingSigned) -> 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 ID
+#[no_mangle]
+pub extern "C" fn FundingSigned_set_channel_id(this_ptr: &mut FundingSigned, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The signature of the channel acceptor (fundee) on the initial commitment transaction
+#[no_mangle]
+pub extern "C" fn FundingSigned_get_signature(this_ptr: &FundingSigned) -> crate::c_types::ECDSASignature {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().signature;
+ crate::c_types::ECDSASignature::from_rust(&inner_val)
+}
+/// The signature of the channel acceptor (fundee) on the initial commitment transaction
+#[no_mangle]
+pub extern "C" fn FundingSigned_set_signature(this_ptr: &mut FundingSigned, mut val: crate::c_types::ECDSASignature) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.signature = val.into_rust();
+}
+/// Constructs a new FundingSigned given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn FundingSigned_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut signature_arg: crate::c_types::ECDSASignature) -> FundingSigned {
+ FundingSigned { inner: ObjOps::heap_alloc(nativeFundingSigned {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ signature: signature_arg.into_rust(),
+ }), is_owned: true }
+}
+impl Clone for FundingSigned {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeFundingSigned>::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 FundingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeFundingSigned)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the FundingSigned
+pub extern "C" fn FundingSigned_clone(orig: &FundingSigned) -> FundingSigned {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a FundingSigned object
+pub extern "C" fn FundingSigned_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::FundingSigned }).into()}
+/// Generates a non-cryptographic 64-bit hash of the FundingSigned.
+#[no_mangle]
+pub extern "C" fn FundingSigned_hash(o: &FundingSigned) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two FundingSigneds 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.
+#[no_mangle]
+pub extern "C" fn FundingSigned_eq(a: &FundingSigned, b: &FundingSigned) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::ChannelReady as nativeChannelReadyImport;
+pub(crate) type nativeChannelReady = nativeChannelReadyImport;
+
+/// A [`channel_ready`] message to be sent to or received from a peer.
+///
+/// [`channel_ready`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-channel_ready-message
+#[must_use]
+#[repr(C)]
+pub struct ChannelReady {
+ /// 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 nativeChannelReady,
+ /// 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 core::ops::Deref for ChannelReady {
+ type Target = nativeChannelReady;
+ fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for ChannelReady { }
+unsafe impl core::marker::Sync for ChannelReady { }
+impl Drop for ChannelReady {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeChannelReady>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn ChannelReady_free(this_obj: ChannelReady) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ChannelReady_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelReady) };
+}
+#[allow(unused)]
+impl ChannelReady {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeChannelReady {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelReady {
+ 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 nativeChannelReady {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+ pub(crate) fn as_ref_to(&self) -> Self {
+ Self { inner: self.inner, is_owned: false }
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn ChannelReady_get_channel_id(this_ptr: &ChannelReady) -> 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 ID
+#[no_mangle]
+pub extern "C" fn ChannelReady_set_channel_id(this_ptr: &mut ChannelReady, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The per-commitment point of the second commitment transaction
+#[no_mangle]
+pub extern "C" fn ChannelReady_get_next_per_commitment_point(this_ptr: &ChannelReady) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().next_per_commitment_point;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// The per-commitment point of the second commitment transaction
+#[no_mangle]
+pub extern "C" fn ChannelReady_set_next_per_commitment_point(this_ptr: &mut ChannelReady, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_per_commitment_point = val.into_rust();
+}
+/// If set, provides a `short_channel_id` alias for this channel.
+///
+/// The sender will accept payments to be forwarded over this SCID and forward them to this
+/// messages' recipient.
+#[no_mangle]
+pub extern "C" fn ChannelReady_get_short_channel_id_alias(this_ptr: &ChannelReady) -> crate::c_types::derived::COption_u64Z {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id_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
+}
+/// If set, provides a `short_channel_id` alias for this channel.
+///
+/// The sender will accept payments to be forwarded over this SCID and forward them to this
+/// messages' recipient.
+#[no_mangle]
+pub extern "C" fn ChannelReady_set_short_channel_id_alias(this_ptr: &mut ChannelReady, 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_alias = local_val;
+}
+/// Constructs a new ChannelReady given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelReady_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut next_per_commitment_point_arg: crate::c_types::PublicKey, mut short_channel_id_alias_arg: crate::c_types::derived::COption_u64Z) -> ChannelReady {
+ let mut local_short_channel_id_alias_arg = if short_channel_id_alias_arg.is_some() { Some( { short_channel_id_alias_arg.take() }) } else { None };
+ ChannelReady { inner: ObjOps::heap_alloc(nativeChannelReady {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ next_per_commitment_point: next_per_commitment_point_arg.into_rust(),
+ short_channel_id_alias: local_short_channel_id_alias_arg,
+ }), is_owned: true }
+}
+impl Clone for ChannelReady {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeChannelReady>::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 ChannelReady_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelReady)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the ChannelReady
+pub extern "C" fn ChannelReady_clone(orig: &ChannelReady) -> ChannelReady {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a ChannelReady object
+pub extern "C" fn ChannelReady_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ChannelReady }).into()}
+/// Generates a non-cryptographic 64-bit hash of the ChannelReady.
+#[no_mangle]
+pub extern "C" fn ChannelReady_hash(o: &ChannelReady) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two ChannelReadys 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.
+#[no_mangle]
+pub extern "C" fn ChannelReady_eq(a: &ChannelReady, b: &ChannelReady) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::Stfu as nativeStfuImport;
+pub(crate) type nativeStfu = nativeStfuImport;
+
+/// An `stfu` (quiescence) message to be sent by or received from the stfu initiator.
+///
+#[must_use]
+#[repr(C)]
+pub struct Stfu {
+ /// 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 nativeStfu,
+ /// 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 core::ops::Deref for Stfu {
+ type Target = nativeStfu;
+ fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for Stfu { }
+unsafe impl core::marker::Sync for Stfu { }
+impl Drop for Stfu {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeStfu>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the Stfu, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn Stfu_free(this_obj: Stfu) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Stfu_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeStfu) };
+}
+#[allow(unused)]
+impl Stfu {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeStfu {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeStfu {
+ 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 nativeStfu {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+ pub(crate) fn as_ref_to(&self) -> Self {
+ Self { inner: self.inner, is_owned: false }
+ }
+}
+/// The channel ID where quiescence is intended