+impl Clone for OpenChannelV2 {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeOpenChannelV2>::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 OpenChannelV2_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOpenChannelV2)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the OpenChannelV2
+pub extern "C" fn OpenChannelV2_clone(orig: &OpenChannelV2) -> OpenChannelV2 {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a OpenChannelV2 object
+pub extern "C" fn OpenChannelV2_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::OpenChannelV2 }).into()}
+/// Generates a non-cryptographic 64-bit hash of the OpenChannelV2.
+#[no_mangle]
+pub extern "C" fn OpenChannelV2_hash(o: &OpenChannelV2) -> 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 OpenChannelV2s 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 OpenChannelV2_eq(a: &OpenChannelV2, b: &OpenChannelV2) -> 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::CommonAcceptChannelFields as nativeCommonAcceptChannelFieldsImport;
+pub(crate) type nativeCommonAcceptChannelFields = nativeCommonAcceptChannelFieldsImport;
+
+/// Contains fields that are both common to [`accept_channel`] and `accept_channel2` messages.
+///
+/// [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message
+#[must_use]
+#[repr(C)]
+pub struct CommonAcceptChannelFields {
+ /// 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 nativeCommonAcceptChannelFields,
+ /// 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 CommonAcceptChannelFields {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeCommonAcceptChannelFields>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the CommonAcceptChannelFields, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_free(this_obj: CommonAcceptChannelFields) { }
+#[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_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCommonAcceptChannelFields) };
+}
+#[allow(unused)]
+impl CommonAcceptChannelFields {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeCommonAcceptChannelFields {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeCommonAcceptChannelFields {
+ 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 nativeCommonAcceptChannelFields {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message.
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_get_temporary_channel_id(this_ptr: &CommonAcceptChannelFields) -> 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 }
+}
+/// The same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message.
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_set_temporary_channel_id(this_ptr: &mut CommonAcceptChannelFields, 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 threshold below which outputs on transactions broadcast by the channel acceptor will be
+/// omitted
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_get_dust_limit_satoshis(this_ptr: &CommonAcceptChannelFields) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().dust_limit_satoshis;
+ *inner_val
+}
+/// The threshold below which outputs on transactions broadcast by the channel acceptor will be
+/// omitted
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_set_dust_limit_satoshis(this_ptr: &mut CommonAcceptChannelFields, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.dust_limit_satoshis = val;
+}
+/// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(this_ptr: &CommonAcceptChannelFields) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().max_htlc_value_in_flight_msat;
+ *inner_val
+}
+/// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(this_ptr: &mut CommonAcceptChannelFields, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_htlc_value_in_flight_msat = val;
+}
+/// The minimum HTLC size incoming to channel acceptor, in milli-satoshi
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_get_htlc_minimum_msat(this_ptr: &CommonAcceptChannelFields) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_minimum_msat;
+ *inner_val
+}
+/// The minimum HTLC size incoming to channel acceptor, in milli-satoshi
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_set_htlc_minimum_msat(this_ptr: &mut CommonAcceptChannelFields, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_minimum_msat = val;
+}
+/// Minimum depth of the funding transaction before the channel is considered open
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_get_minimum_depth(this_ptr: &CommonAcceptChannelFields) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().minimum_depth;
+ *inner_val
+}
+/// Minimum depth of the funding transaction before the channel is considered open
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_set_minimum_depth(this_ptr: &mut CommonAcceptChannelFields, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.minimum_depth = val;
+}
+/// The number of blocks which the counterparty will have to wait to claim on-chain funds if they
+/// broadcast a commitment transaction
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_get_to_self_delay(this_ptr: &CommonAcceptChannelFields) -> u16 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().to_self_delay;
+ *inner_val
+}
+/// The number of blocks which the counterparty will have to wait to claim on-chain funds if they
+/// broadcast a commitment transaction
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_set_to_self_delay(this_ptr: &mut CommonAcceptChannelFields, mut val: u16) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.to_self_delay = val;
+}
+/// The maximum number of inbound HTLCs towards channel acceptor
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_get_max_accepted_htlcs(this_ptr: &CommonAcceptChannelFields) -> u16 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().max_accepted_htlcs;
+ *inner_val
+}
+/// The maximum number of inbound HTLCs towards channel acceptor
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_set_max_accepted_htlcs(this_ptr: &mut CommonAcceptChannelFields, mut val: u16) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_accepted_htlcs = val;
+}
+/// The channel acceptor's key controlling the funding transaction
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_get_funding_pubkey(this_ptr: &CommonAcceptChannelFields) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_pubkey;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// The channel acceptor's key controlling the funding transaction
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_set_funding_pubkey(this_ptr: &mut CommonAcceptChannelFields, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_pubkey = val.into_rust();
+}
+/// Used to derive a revocation key for transactions broadcast by counterparty
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_get_revocation_basepoint(this_ptr: &CommonAcceptChannelFields) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().revocation_basepoint;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// Used to derive a revocation key for transactions broadcast by counterparty
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_set_revocation_basepoint(this_ptr: &mut CommonAcceptChannelFields, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.revocation_basepoint = val.into_rust();
+}
+/// A payment key to channel acceptor for transactions broadcast by counterparty
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_get_payment_basepoint(this_ptr: &CommonAcceptChannelFields) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_basepoint;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// A payment key to channel acceptor for transactions broadcast by counterparty
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_set_payment_basepoint(this_ptr: &mut CommonAcceptChannelFields, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_basepoint = val.into_rust();
+}
+/// Used to derive a payment key to channel acceptor for transactions broadcast by channel
+/// acceptor
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_get_delayed_payment_basepoint(this_ptr: &CommonAcceptChannelFields) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().delayed_payment_basepoint;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// Used to derive a payment key to channel acceptor for transactions broadcast by channel
+/// acceptor
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_set_delayed_payment_basepoint(this_ptr: &mut CommonAcceptChannelFields, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.delayed_payment_basepoint = val.into_rust();
+}
+/// Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_get_htlc_basepoint(this_ptr: &CommonAcceptChannelFields) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_basepoint;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_set_htlc_basepoint(this_ptr: &mut CommonAcceptChannelFields, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_basepoint = val.into_rust();
+}
+/// The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_get_first_per_commitment_point(this_ptr: &CommonAcceptChannelFields) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().first_per_commitment_point;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_set_first_per_commitment_point(this_ptr: &mut CommonAcceptChannelFields, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.first_per_commitment_point = val.into_rust();
+}
+/// Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
+/// collaboratively close
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_get_shutdown_scriptpubkey(this_ptr: &CommonAcceptChannelFields) -> crate::c_types::derived::COption_CVec_u8ZZ {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().shutdown_scriptpubkey;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option<Enum> is otherwise un-expressable. */ { (*inner_val.as_ref().unwrap()).clone().to_bytes().into() }) };
+ local_inner_val
+}
+/// Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
+/// collaboratively close
+#[no_mangle]
+pub extern "C" fn CommonAcceptChannelFields_set_shutdown_scriptpubkey(this_ptr: &mut CommonAcceptChannelFields, mut val: crate::c_types::derived::COption_CVec_u8ZZ) {
+ let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::bitcoin::blockdata::script::ScriptBuf::from({ val_opt.take() }.into_rust()) }})} };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.shutdown_scriptpubkey = local_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 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::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 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::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;
+}
+/// 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::ln::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::blockdata::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 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
+ }
+}
+/// 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 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
+ }
+}
+/// 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 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
+ }
+}
+/// 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 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
+ }
+}
+/// 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 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
+ }
+}
+/// 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 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
+ }
+}
+/// The channel ID where quiescence is intended
+#[no_mangle]
+pub extern "C" fn Stfu_get_channel_id(this_ptr: &Stfu) -> 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 where quiescence is intended
+#[no_mangle]
+pub extern "C" fn Stfu_set_channel_id(this_ptr: &mut Stfu, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// Initiator flag, 1 if initiating, 0 if replying to an stfu.
+#[no_mangle]
+pub extern "C" fn Stfu_get_initiator(this_ptr: &Stfu) -> u8 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().initiator;
+ *inner_val
+}
+/// Initiator flag, 1 if initiating, 0 if replying to an stfu.
+#[no_mangle]
+pub extern "C" fn Stfu_set_initiator(this_ptr: &mut Stfu, mut val: u8) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.initiator = val;
+}
+/// Constructs a new Stfu given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Stfu_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut initiator_arg: u8) -> Stfu {
+ Stfu { inner: ObjOps::heap_alloc(nativeStfu {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ initiator: initiator_arg,
+ }), is_owned: true }
+}
+impl Clone for Stfu {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeStfu>::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 Stfu_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeStfu)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the Stfu
+pub extern "C" fn Stfu_clone(orig: &Stfu) -> Stfu {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a Stfu object
+pub extern "C" fn Stfu_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::Stfu }).into()}
+/// Checks if two Stfus 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 Stfu_eq(a: &Stfu, b: &Stfu) -> 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::Splice as nativeSpliceImport;
+pub(crate) type nativeSplice = nativeSpliceImport;
+
+/// A splice message to be sent by or received from the stfu initiator (splice initiator).
+#[must_use]
+#[repr(C)]
+pub struct Splice {
+ /// 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 nativeSplice,
+ /// 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 Splice {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeSplice>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the Splice, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn Splice_free(this_obj: Splice) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Splice_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeSplice) };
+}
+#[allow(unused)]
+impl Splice {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeSplice {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeSplice {
+ 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 nativeSplice {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID where splicing is intended
+#[no_mangle]
+pub extern "C" fn Splice_get_channel_id(this_ptr: &Splice) -> 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 where splicing is intended
+#[no_mangle]
+pub extern "C" fn Splice_set_channel_id(this_ptr: &mut Splice, 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 genesis hash of the blockchain where the channel is intended to be spliced
+#[no_mangle]
+pub extern "C" fn Splice_get_chain_hash(this_ptr: &Splice) -> *const [u8; 32] {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash;
+ inner_val.as_ref()
+}
+/// The genesis hash of the blockchain where the channel is intended to be spliced
+#[no_mangle]
+pub extern "C" fn Splice_set_chain_hash(this_ptr: &mut Splice, mut val: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::blockdata::constants::ChainHash::from(&val.data);
+}
+/// The intended change in channel capacity: the amount to be added (positive value)
+/// or removed (negative value) by the sender (splice initiator) by splicing into/from the channel.
+#[no_mangle]
+pub extern "C" fn Splice_get_relative_satoshis(this_ptr: &Splice) -> i64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().relative_satoshis;
+ *inner_val
+}
+/// The intended change in channel capacity: the amount to be added (positive value)
+/// or removed (negative value) by the sender (splice initiator) by splicing into/from the channel.
+#[no_mangle]
+pub extern "C" fn Splice_set_relative_satoshis(this_ptr: &mut Splice, mut val: i64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.relative_satoshis = val;
+}
+/// The feerate for the new funding transaction, set by the splice initiator
+#[no_mangle]
+pub extern "C" fn Splice_get_funding_feerate_perkw(this_ptr: &Splice) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_feerate_perkw;
+ *inner_val
+}
+/// The feerate for the new funding transaction, set by the splice initiator
+#[no_mangle]
+pub extern "C" fn Splice_set_funding_feerate_perkw(this_ptr: &mut Splice, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_feerate_perkw = val;
+}
+/// The locktime for the new funding transaction
+#[no_mangle]
+pub extern "C" fn Splice_get_locktime(this_ptr: &Splice) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().locktime;
+ *inner_val
+}
+/// The locktime for the new funding transaction
+#[no_mangle]
+pub extern "C" fn Splice_set_locktime(this_ptr: &mut Splice, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.locktime = val;
+}
+/// The key of the sender (splice initiator) controlling the new funding transaction
+#[no_mangle]
+pub extern "C" fn Splice_get_funding_pubkey(this_ptr: &Splice) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_pubkey;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// The key of the sender (splice initiator) controlling the new funding transaction
+#[no_mangle]
+pub extern "C" fn Splice_set_funding_pubkey(this_ptr: &mut Splice, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_pubkey = val.into_rust();
+}
+/// Constructs a new Splice given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Splice_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut relative_satoshis_arg: i64, mut funding_feerate_perkw_arg: u32, mut locktime_arg: u32, mut funding_pubkey_arg: crate::c_types::PublicKey) -> Splice {
+ Splice { inner: ObjOps::heap_alloc(nativeSplice {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ chain_hash: ::bitcoin::blockdata::constants::ChainHash::from(&chain_hash_arg.data),
+ relative_satoshis: relative_satoshis_arg,
+ funding_feerate_perkw: funding_feerate_perkw_arg,
+ locktime: locktime_arg,
+ funding_pubkey: funding_pubkey_arg.into_rust(),
+ }), is_owned: true }
+}
+impl Clone for Splice {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeSplice>::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 Splice_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeSplice)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the Splice
+pub extern "C" fn Splice_clone(orig: &Splice) -> Splice {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a Splice object
+pub extern "C" fn Splice_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::Splice }).into()}
+/// Checks if two Splices 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 Splice_eq(a: &Splice, b: &Splice) -> 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::SpliceAck as nativeSpliceAckImport;
+pub(crate) type nativeSpliceAck = nativeSpliceAckImport;
+
+/// A splice_ack message to be received by or sent to the splice initiator.
+///
+#[must_use]
+#[repr(C)]
+pub struct SpliceAck {
+ /// 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 nativeSpliceAck,
+ /// 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 SpliceAck {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeSpliceAck>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the SpliceAck, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn SpliceAck_free(this_obj: SpliceAck) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SpliceAck_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeSpliceAck) };
+}
+#[allow(unused)]
+impl SpliceAck {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeSpliceAck {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeSpliceAck {
+ 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 nativeSpliceAck {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID where splicing is intended
+#[no_mangle]
+pub extern "C" fn SpliceAck_get_channel_id(this_ptr: &SpliceAck) -> 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 where splicing is intended
+#[no_mangle]
+pub extern "C" fn SpliceAck_set_channel_id(this_ptr: &mut SpliceAck, 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 genesis hash of the blockchain where the channel is intended to be spliced
+#[no_mangle]
+pub extern "C" fn SpliceAck_get_chain_hash(this_ptr: &SpliceAck) -> *const [u8; 32] {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash;
+ inner_val.as_ref()
+}
+/// The genesis hash of the blockchain where the channel is intended to be spliced
+#[no_mangle]
+pub extern "C" fn SpliceAck_set_chain_hash(this_ptr: &mut SpliceAck, mut val: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::blockdata::constants::ChainHash::from(&val.data);
+}
+/// The intended change in channel capacity: the amount to be added (positive value)
+/// or removed (negative value) by the sender (splice acceptor) by splicing into/from the channel.
+#[no_mangle]
+pub extern "C" fn SpliceAck_get_relative_satoshis(this_ptr: &SpliceAck) -> i64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().relative_satoshis;
+ *inner_val
+}
+/// The intended change in channel capacity: the amount to be added (positive value)
+/// or removed (negative value) by the sender (splice acceptor) by splicing into/from the channel.
+#[no_mangle]
+pub extern "C" fn SpliceAck_set_relative_satoshis(this_ptr: &mut SpliceAck, mut val: i64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.relative_satoshis = val;
+}
+/// The key of the sender (splice acceptor) controlling the new funding transaction
+#[no_mangle]
+pub extern "C" fn SpliceAck_get_funding_pubkey(this_ptr: &SpliceAck) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_pubkey;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// The key of the sender (splice acceptor) controlling the new funding transaction
+#[no_mangle]
+pub extern "C" fn SpliceAck_set_funding_pubkey(this_ptr: &mut SpliceAck, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_pubkey = val.into_rust();
+}
+/// Constructs a new SpliceAck given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn SpliceAck_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut relative_satoshis_arg: i64, mut funding_pubkey_arg: crate::c_types::PublicKey) -> SpliceAck {
+ SpliceAck { inner: ObjOps::heap_alloc(nativeSpliceAck {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ chain_hash: ::bitcoin::blockdata::constants::ChainHash::from(&chain_hash_arg.data),
+ relative_satoshis: relative_satoshis_arg,
+ funding_pubkey: funding_pubkey_arg.into_rust(),
+ }), is_owned: true }
+}
+impl Clone for SpliceAck {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeSpliceAck>::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 SpliceAck_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeSpliceAck)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the SpliceAck
+pub extern "C" fn SpliceAck_clone(orig: &SpliceAck) -> SpliceAck {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a SpliceAck object
+pub extern "C" fn SpliceAck_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::SpliceAck }).into()}
+/// Checks if two SpliceAcks 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 SpliceAck_eq(a: &SpliceAck, b: &SpliceAck) -> 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::SpliceLocked as nativeSpliceLockedImport;
+pub(crate) type nativeSpliceLocked = nativeSpliceLockedImport;
+
+/// A splice_locked message to be sent to or received from a peer.
+///
+#[must_use]
+#[repr(C)]
+pub struct SpliceLocked {
+ /// 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 nativeSpliceLocked,
+ /// 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 SpliceLocked {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeSpliceLocked>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the SpliceLocked, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn SpliceLocked_free(this_obj: SpliceLocked) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SpliceLocked_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeSpliceLocked) };
+}
+#[allow(unused)]
+impl SpliceLocked {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeSpliceLocked {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeSpliceLocked {
+ 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 nativeSpliceLocked {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn SpliceLocked_get_channel_id(this_ptr: &SpliceLocked) -> 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 SpliceLocked_set_channel_id(this_ptr: &mut SpliceLocked, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// Constructs a new SpliceLocked given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn SpliceLocked_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId) -> SpliceLocked {
+ SpliceLocked { inner: ObjOps::heap_alloc(nativeSpliceLocked {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ }), is_owned: true }
+}
+impl Clone for SpliceLocked {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeSpliceLocked>::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 SpliceLocked_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeSpliceLocked)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the SpliceLocked
+pub extern "C" fn SpliceLocked_clone(orig: &SpliceLocked) -> SpliceLocked {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a SpliceLocked object
+pub extern "C" fn SpliceLocked_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::SpliceLocked }).into()}
+/// Checks if two SpliceLockeds 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 SpliceLocked_eq(a: &SpliceLocked, b: &SpliceLocked) -> 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::TxAddInput as nativeTxAddInputImport;
+pub(crate) type nativeTxAddInput = nativeTxAddInputImport;
+
+/// A tx_add_input message for adding an input during interactive transaction construction
+///
+#[must_use]
+#[repr(C)]
+pub struct TxAddInput {
+ /// 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 nativeTxAddInput,
+ /// 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 TxAddInput {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeTxAddInput>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the TxAddInput, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn TxAddInput_free(this_obj: TxAddInput) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxAddInput_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTxAddInput) };
+}
+#[allow(unused)]
+impl TxAddInput {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeTxAddInput {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTxAddInput {
+ 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 nativeTxAddInput {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxAddInput_get_channel_id(this_ptr: &TxAddInput) -> 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 TxAddInput_set_channel_id(this_ptr: &mut TxAddInput, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// A randomly chosen unique identifier for this input, which is even for initiators and odd for
+/// non-initiators.
+#[no_mangle]
+pub extern "C" fn TxAddInput_get_serial_id(this_ptr: &TxAddInput) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().serial_id;
+ *inner_val
+}
+/// A randomly chosen unique identifier for this input, which is even for initiators and odd for
+/// non-initiators.
+#[no_mangle]
+pub extern "C" fn TxAddInput_set_serial_id(this_ptr: &mut TxAddInput, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.serial_id = val;
+}
+/// Serialized transaction that contains the output this input spends to verify that it is non
+/// malleable.
+#[no_mangle]
+pub extern "C" fn TxAddInput_get_prevtx(this_ptr: &TxAddInput) -> crate::lightning::util::ser::TransactionU16LenLimited {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().prevtx;
+ crate::lightning::util::ser::TransactionU16LenLimited { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::util::ser::TransactionU16LenLimited<>) as *mut _) }, is_owned: false }
+}
+/// Serialized transaction that contains the output this input spends to verify that it is non
+/// malleable.
+#[no_mangle]
+pub extern "C" fn TxAddInput_set_prevtx(this_ptr: &mut TxAddInput, mut val: crate::lightning::util::ser::TransactionU16LenLimited) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.prevtx = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The index of the output being spent
+#[no_mangle]
+pub extern "C" fn TxAddInput_get_prevtx_out(this_ptr: &TxAddInput) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().prevtx_out;
+ *inner_val
+}
+/// The index of the output being spent
+#[no_mangle]
+pub extern "C" fn TxAddInput_set_prevtx_out(this_ptr: &mut TxAddInput, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.prevtx_out = val;
+}
+/// The sequence number of this input
+#[no_mangle]
+pub extern "C" fn TxAddInput_get_sequence(this_ptr: &TxAddInput) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().sequence;
+ *inner_val
+}
+/// The sequence number of this input
+#[no_mangle]
+pub extern "C" fn TxAddInput_set_sequence(this_ptr: &mut TxAddInput, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.sequence = val;
+}
+/// Constructs a new TxAddInput given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn TxAddInput_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut serial_id_arg: u64, mut prevtx_arg: crate::lightning::util::ser::TransactionU16LenLimited, mut prevtx_out_arg: u32, mut sequence_arg: u32) -> TxAddInput {
+ TxAddInput { inner: ObjOps::heap_alloc(nativeTxAddInput {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ serial_id: serial_id_arg,
+ prevtx: *unsafe { Box::from_raw(prevtx_arg.take_inner()) },
+ prevtx_out: prevtx_out_arg,
+ sequence: sequence_arg,
+ }), is_owned: true }
+}
+impl Clone for TxAddInput {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeTxAddInput>::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 TxAddInput_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxAddInput)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the TxAddInput
+pub extern "C" fn TxAddInput_clone(orig: &TxAddInput) -> TxAddInput {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a TxAddInput object
+pub extern "C" fn TxAddInput_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::TxAddInput }).into()}
+/// Generates a non-cryptographic 64-bit hash of the TxAddInput.
+#[no_mangle]
+pub extern "C" fn TxAddInput_hash(o: &TxAddInput) -> 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 TxAddInputs 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 TxAddInput_eq(a: &TxAddInput, b: &TxAddInput) -> 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::TxAddOutput as nativeTxAddOutputImport;
+pub(crate) type nativeTxAddOutput = nativeTxAddOutputImport;
+
+/// A tx_add_output message for adding an output during interactive transaction construction.
+///
+#[must_use]
+#[repr(C)]
+pub struct TxAddOutput {
+ /// 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 nativeTxAddOutput,
+ /// 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 TxAddOutput {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeTxAddOutput>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the TxAddOutput, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn TxAddOutput_free(this_obj: TxAddOutput) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxAddOutput_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTxAddOutput) };
+}
+#[allow(unused)]
+impl TxAddOutput {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeTxAddOutput {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTxAddOutput {
+ 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 nativeTxAddOutput {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxAddOutput_get_channel_id(this_ptr: &TxAddOutput) -> 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 TxAddOutput_set_channel_id(this_ptr: &mut TxAddOutput, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// A randomly chosen unique identifier for this output, which is even for initiators and odd for
+/// non-initiators.
+#[no_mangle]
+pub extern "C" fn TxAddOutput_get_serial_id(this_ptr: &TxAddOutput) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().serial_id;
+ *inner_val
+}
+/// A randomly chosen unique identifier for this output, which is even for initiators and odd for
+/// non-initiators.
+#[no_mangle]
+pub extern "C" fn TxAddOutput_set_serial_id(this_ptr: &mut TxAddOutput, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.serial_id = val;
+}
+/// The satoshi value of the output
+#[no_mangle]
+pub extern "C" fn TxAddOutput_get_sats(this_ptr: &TxAddOutput) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().sats;
+ *inner_val
+}
+/// The satoshi value of the output
+#[no_mangle]
+pub extern "C" fn TxAddOutput_set_sats(this_ptr: &mut TxAddOutput, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.sats = val;
+}
+/// The scriptPubKey for the output
+#[no_mangle]
+pub extern "C" fn TxAddOutput_get_script(this_ptr: &TxAddOutput) -> crate::c_types::derived::CVec_u8Z {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().script;
+ inner_val.as_bytes().to_vec().into()
+}
+/// The scriptPubKey for the output
+#[no_mangle]
+pub extern "C" fn TxAddOutput_set_script(this_ptr: &mut TxAddOutput, mut val: crate::c_types::derived::CVec_u8Z) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.script = ::bitcoin::blockdata::script::ScriptBuf::from(val.into_rust());
+}
+/// Constructs a new TxAddOutput given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn TxAddOutput_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut serial_id_arg: u64, mut sats_arg: u64, mut script_arg: crate::c_types::derived::CVec_u8Z) -> TxAddOutput {
+ TxAddOutput { inner: ObjOps::heap_alloc(nativeTxAddOutput {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ serial_id: serial_id_arg,
+ sats: sats_arg,
+ script: ::bitcoin::blockdata::script::ScriptBuf::from(script_arg.into_rust()),
+ }), is_owned: true }
+}
+impl Clone for TxAddOutput {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeTxAddOutput>::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 TxAddOutput_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxAddOutput)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the TxAddOutput
+pub extern "C" fn TxAddOutput_clone(orig: &TxAddOutput) -> TxAddOutput {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a TxAddOutput object
+pub extern "C" fn TxAddOutput_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::TxAddOutput }).into()}
+/// Generates a non-cryptographic 64-bit hash of the TxAddOutput.
+#[no_mangle]
+pub extern "C" fn TxAddOutput_hash(o: &TxAddOutput) -> 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 TxAddOutputs 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 TxAddOutput_eq(a: &TxAddOutput, b: &TxAddOutput) -> 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::TxRemoveInput as nativeTxRemoveInputImport;
+pub(crate) type nativeTxRemoveInput = nativeTxRemoveInputImport;
+
+/// A tx_remove_input message for removing an input during interactive transaction construction.
+///
+#[must_use]
+#[repr(C)]
+pub struct TxRemoveInput {
+ /// 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 nativeTxRemoveInput,
+ /// 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 TxRemoveInput {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeTxRemoveInput>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the TxRemoveInput, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn TxRemoveInput_free(this_obj: TxRemoveInput) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxRemoveInput_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTxRemoveInput) };
+}
+#[allow(unused)]
+impl TxRemoveInput {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeTxRemoveInput {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTxRemoveInput {
+ 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 nativeTxRemoveInput {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxRemoveInput_get_channel_id(this_ptr: &TxRemoveInput) -> 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 TxRemoveInput_set_channel_id(this_ptr: &mut TxRemoveInput, 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 serial ID of the input to be removed
+#[no_mangle]
+pub extern "C" fn TxRemoveInput_get_serial_id(this_ptr: &TxRemoveInput) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().serial_id;
+ *inner_val
+}
+/// The serial ID of the input to be removed
+#[no_mangle]
+pub extern "C" fn TxRemoveInput_set_serial_id(this_ptr: &mut TxRemoveInput, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.serial_id = val;
+}
+/// Constructs a new TxRemoveInput given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn TxRemoveInput_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut serial_id_arg: u64) -> TxRemoveInput {
+ TxRemoveInput { inner: ObjOps::heap_alloc(nativeTxRemoveInput {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ serial_id: serial_id_arg,
+ }), is_owned: true }
+}
+impl Clone for TxRemoveInput {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeTxRemoveInput>::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 TxRemoveInput_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxRemoveInput)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the TxRemoveInput
+pub extern "C" fn TxRemoveInput_clone(orig: &TxRemoveInput) -> TxRemoveInput {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a TxRemoveInput object
+pub extern "C" fn TxRemoveInput_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::TxRemoveInput }).into()}
+/// Generates a non-cryptographic 64-bit hash of the TxRemoveInput.
+#[no_mangle]
+pub extern "C" fn TxRemoveInput_hash(o: &TxRemoveInput) -> 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 TxRemoveInputs 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 TxRemoveInput_eq(a: &TxRemoveInput, b: &TxRemoveInput) -> 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::TxRemoveOutput as nativeTxRemoveOutputImport;
+pub(crate) type nativeTxRemoveOutput = nativeTxRemoveOutputImport;
+
+/// A tx_remove_output message for removing an output during interactive transaction construction.
+///
+#[must_use]
+#[repr(C)]
+pub struct TxRemoveOutput {
+ /// 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 nativeTxRemoveOutput,
+ /// 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 TxRemoveOutput {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeTxRemoveOutput>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the TxRemoveOutput, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn TxRemoveOutput_free(this_obj: TxRemoveOutput) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxRemoveOutput_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTxRemoveOutput) };
+}
+#[allow(unused)]
+impl TxRemoveOutput {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeTxRemoveOutput {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTxRemoveOutput {
+ 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 nativeTxRemoveOutput {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxRemoveOutput_get_channel_id(this_ptr: &TxRemoveOutput) -> 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 TxRemoveOutput_set_channel_id(this_ptr: &mut TxRemoveOutput, 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 serial ID of the output to be removed
+#[no_mangle]
+pub extern "C" fn TxRemoveOutput_get_serial_id(this_ptr: &TxRemoveOutput) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().serial_id;
+ *inner_val
+}
+/// The serial ID of the output to be removed
+#[no_mangle]
+pub extern "C" fn TxRemoveOutput_set_serial_id(this_ptr: &mut TxRemoveOutput, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.serial_id = val;
+}
+/// Constructs a new TxRemoveOutput given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn TxRemoveOutput_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut serial_id_arg: u64) -> TxRemoveOutput {
+ TxRemoveOutput { inner: ObjOps::heap_alloc(nativeTxRemoveOutput {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ serial_id: serial_id_arg,
+ }), is_owned: true }
+}
+impl Clone for TxRemoveOutput {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeTxRemoveOutput>::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 TxRemoveOutput_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxRemoveOutput)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the TxRemoveOutput
+pub extern "C" fn TxRemoveOutput_clone(orig: &TxRemoveOutput) -> TxRemoveOutput {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a TxRemoveOutput object
+pub extern "C" fn TxRemoveOutput_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::TxRemoveOutput }).into()}
+/// Generates a non-cryptographic 64-bit hash of the TxRemoveOutput.
+#[no_mangle]
+pub extern "C" fn TxRemoveOutput_hash(o: &TxRemoveOutput) -> 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 TxRemoveOutputs 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 TxRemoveOutput_eq(a: &TxRemoveOutput, b: &TxRemoveOutput) -> 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::TxComplete as nativeTxCompleteImport;
+pub(crate) type nativeTxComplete = nativeTxCompleteImport;
+
+/// A tx_complete message signalling the conclusion of a peer's transaction contributions during
+/// interactive transaction construction.
+///
+#[must_use]
+#[repr(C)]
+pub struct TxComplete {
+ /// 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 nativeTxComplete,
+ /// 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 TxComplete {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeTxComplete>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the TxComplete, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn TxComplete_free(this_obj: TxComplete) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxComplete_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTxComplete) };
+}
+#[allow(unused)]
+impl TxComplete {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeTxComplete {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTxComplete {
+ 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 nativeTxComplete {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxComplete_get_channel_id(this_ptr: &TxComplete) -> 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 TxComplete_set_channel_id(this_ptr: &mut TxComplete, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// Constructs a new TxComplete given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn TxComplete_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId) -> TxComplete {
+ TxComplete { inner: ObjOps::heap_alloc(nativeTxComplete {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ }), is_owned: true }
+}
+impl Clone for TxComplete {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeTxComplete>::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 TxComplete_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxComplete)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the TxComplete
+pub extern "C" fn TxComplete_clone(orig: &TxComplete) -> TxComplete {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a TxComplete object
+pub extern "C" fn TxComplete_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::TxComplete }).into()}
+/// Generates a non-cryptographic 64-bit hash of the TxComplete.
+#[no_mangle]
+pub extern "C" fn TxComplete_hash(o: &TxComplete) -> 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 TxCompletes 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 TxComplete_eq(a: &TxComplete, b: &TxComplete) -> 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::TxSignatures as nativeTxSignaturesImport;
+pub(crate) type nativeTxSignatures = nativeTxSignaturesImport;
+
+/// A tx_signatures message containing the sender's signatures for a transaction constructed with
+/// interactive transaction construction.