]> git.bitcoin.ninja Git - ldk-c-bindings/blobdiff - lightning-c-bindings/src/lightning/ln/chan_utils.rs
Add missing `rustc` `metadata` override for `lightning_types`
[ldk-c-bindings] / lightning-c-bindings / src / lightning / ln / chan_utils.rs
index 5b57c01e2de18f9cde70d8108ed647c28a7af3ae..a5fa45c99629c24011bba0301391f87e24825657 100644 (file)
@@ -6,7 +6,7 @@
 // license as that which applies to the original source files from which this
 // source was automatically generated.
 
 // license as that which applies to the original source files from which this
 // source was automatically generated.
 
-//! Various utilities for building scripts and deriving keys related to channels. These are
+//! Various utilities for building scripts related to channels. These are
 //! largely of interest for those implementing the traits on [`crate::sign`] by hand.
 
 use alloc::str::FromStr;
 //! largely of interest for those implementing the traits on [`crate::sign`] by hand.
 
 use alloc::str::FromStr;
@@ -52,14 +52,14 @@ pub static HTLC_TIMEOUT_INPUT_ANCHOR_WITNESS_WEIGHT: u64 = lightning::ln::chan_u
 pub static HTLC_SUCCESS_INPUT_ANCHOR_WITNESS_WEIGHT: u64 = lightning::ln::chan_utils::HTLC_SUCCESS_INPUT_ANCHOR_WITNESS_WEIGHT;
 /// Gets the weight for an HTLC-Success transaction.
 #[no_mangle]
 pub static HTLC_SUCCESS_INPUT_ANCHOR_WITNESS_WEIGHT: u64 = lightning::ln::chan_utils::HTLC_SUCCESS_INPUT_ANCHOR_WITNESS_WEIGHT;
 /// Gets the weight for an HTLC-Success transaction.
 #[no_mangle]
-pub extern "C" fn htlc_success_tx_weight(channel_type_features: &crate::lightning::ln::features::ChannelTypeFeatures) -> u64 {
+pub extern "C" fn htlc_success_tx_weight(channel_type_features: &crate::lightning_types::features::ChannelTypeFeatures) -> u64 {
        let mut ret = lightning::ln::chan_utils::htlc_success_tx_weight(channel_type_features.get_native_ref());
        ret
 }
 
 /// Gets the weight for an HTLC-Timeout transaction.
 #[no_mangle]
        let mut ret = lightning::ln::chan_utils::htlc_success_tx_weight(channel_type_features.get_native_ref());
        ret
 }
 
 /// Gets the weight for an HTLC-Timeout transaction.
 #[no_mangle]
-pub extern "C" fn htlc_timeout_tx_weight(channel_type_features: &crate::lightning::ln::features::ChannelTypeFeatures) -> u64 {
+pub extern "C" fn htlc_timeout_tx_weight(channel_type_features: &crate::lightning_types::features::ChannelTypeFeatures) -> u64 {
        let mut ret = lightning::ln::chan_utils::htlc_timeout_tx_weight(channel_type_features.get_native_ref());
        ret
 }
        let mut ret = lightning::ln::chan_utils::htlc_timeout_tx_weight(channel_type_features.get_native_ref());
        ret
 }
@@ -105,7 +105,8 @@ impl HTLCClaim {
                }
        }
        #[allow(unused)]
                }
        }
        #[allow(unused)]
-       pub(crate) fn from_native(native: &nativeHTLCClaim) -> Self {
+       pub(crate) fn from_native(native: &HTLCClaimImport) -> Self {
+               let native = unsafe { &*(native as *const _ as *const c_void as *const nativeHTLCClaim) };
                match native {
                        nativeHTLCClaim::OfferedTimeout => HTLCClaim::OfferedTimeout,
                        nativeHTLCClaim::OfferedPreimage => HTLCClaim::OfferedPreimage,
                match native {
                        nativeHTLCClaim::OfferedTimeout => HTLCClaim::OfferedTimeout,
                        nativeHTLCClaim::OfferedPreimage => HTLCClaim::OfferedPreimage,
@@ -185,7 +186,7 @@ pub extern "C" fn build_commitment_secret(commitment_seed: *const [u8; 32], mut
 /// Build a closing transaction
 #[no_mangle]
 pub extern "C" fn build_closing_transaction(mut to_holder_value_sat: u64, mut to_counterparty_value_sat: u64, mut to_holder_script: crate::c_types::derived::CVec_u8Z, mut to_counterparty_script: crate::c_types::derived::CVec_u8Z, mut funding_outpoint: crate::lightning::chain::transaction::OutPoint) -> crate::c_types::Transaction {
 /// Build a closing transaction
 #[no_mangle]
 pub extern "C" fn build_closing_transaction(mut to_holder_value_sat: u64, mut to_counterparty_value_sat: u64, mut to_holder_script: crate::c_types::derived::CVec_u8Z, mut to_counterparty_script: crate::c_types::derived::CVec_u8Z, mut funding_outpoint: crate::lightning::chain::transaction::OutPoint) -> crate::c_types::Transaction {
-       let mut ret = lightning::ln::chan_utils::build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, ::bitcoin::blockdata::script::Script::from(to_holder_script.into_rust()), ::bitcoin::blockdata::script::Script::from(to_counterparty_script.into_rust()), crate::c_types::C_to_bitcoin_outpoint(funding_outpoint));
+       let mut ret = lightning::ln::chan_utils::build_closing_transaction(::bitcoin::amount::Amount::from_sat(to_holder_value_sat), ::bitcoin::amount::Amount::from_sat(to_counterparty_value_sat), ::bitcoin::script::ScriptBuf::from(to_holder_script.into_rust()), ::bitcoin::script::ScriptBuf::from(to_counterparty_script.into_rust()), crate::c_types::C_to_bitcoin_outpoint(funding_outpoint));
        crate::c_types::Transaction::from_bitcoin(&ret)
 }
 
        crate::c_types::Transaction::from_bitcoin(&ret)
 }
 
@@ -213,6 +214,12 @@ pub struct CounterpartyCommitmentSecrets {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for CounterpartyCommitmentSecrets {
+       type Target = nativeCounterpartyCommitmentSecrets;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for CounterpartyCommitmentSecrets { }
+unsafe impl core::marker::Sync for CounterpartyCommitmentSecrets { }
 impl Drop for CounterpartyCommitmentSecrets {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeCounterpartyCommitmentSecrets>::is_null(self.inner) {
 impl Drop for CounterpartyCommitmentSecrets {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeCounterpartyCommitmentSecrets>::is_null(self.inner) {
@@ -243,6 +250,9 @@ impl CounterpartyCommitmentSecrets {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 impl Clone for CounterpartyCommitmentSecrets {
        fn clone(&self) -> Self {
 }
 impl Clone for CounterpartyCommitmentSecrets {
        fn clone(&self) -> Self {
@@ -309,7 +319,7 @@ pub extern "C" fn CounterpartyCommitmentSecrets_write(obj: &crate::lightning::ln
 }
 #[allow(unused)]
 pub(crate) extern "C" fn CounterpartyCommitmentSecrets_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
 }
 #[allow(unused)]
 pub(crate) extern "C" fn CounterpartyCommitmentSecrets_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeCounterpartyCommitmentSecrets) })
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::chan_utils::nativeCounterpartyCommitmentSecrets) })
 }
 #[no_mangle]
 /// Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
 }
 #[no_mangle]
 /// Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
@@ -326,15 +336,6 @@ pub extern "C" fn derive_private_key(mut per_commitment_point: crate::c_types::P
        crate::c_types::SecretKey::from_rust(ret)
 }
 
        crate::c_types::SecretKey::from_rust(ret)
 }
 
-/// Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
-/// from the base point and the per_commitment_key. This is the public equivalent of
-/// derive_private_key - using only public keys to derive a public key instead of private keys.
-#[no_mangle]
-pub extern "C" fn derive_public_key(mut per_commitment_point: crate::c_types::PublicKey, mut base_point: crate::c_types::PublicKey) -> crate::c_types::PublicKey {
-       let mut ret = lightning::ln::chan_utils::derive_public_key(secp256k1::global::SECP256K1, &per_commitment_point.into_rust(), &base_point.into_rust());
-       crate::c_types::PublicKey::from_rust(&ret)
-}
-
 /// Derives a per-commitment-transaction revocation key from its constituent parts.
 ///
 /// Only the cheating participant owns a valid witness to propagate a revoked
 /// Derives a per-commitment-transaction revocation key from its constituent parts.
 ///
 /// Only the cheating participant owns a valid witness to propagate a revoked
@@ -347,23 +348,6 @@ pub extern "C" fn derive_private_revocation_key(per_commitment_secret: *const [u
        crate::c_types::SecretKey::from_rust(ret)
 }
 
        crate::c_types::SecretKey::from_rust(ret)
 }
 
-/// Derives a per-commitment-transaction revocation public key from its constituent parts. This is
-/// the public equivalend of derive_private_revocation_key - using only public keys to derive a
-/// public key instead of private keys.
-///
-/// Only the cheating participant owns a valid witness to propagate a revoked
-/// commitment transaction, thus per_commitment_point always come from cheater
-/// and revocation_base_point always come from punisher, which is the broadcaster
-/// of the transaction spending with this key knowledge.
-///
-/// Note that this is infallible iff we trust that at least one of the two input keys are randomly
-/// generated (ie our own).
-#[no_mangle]
-pub extern "C" fn derive_public_revocation_key(mut per_commitment_point: crate::c_types::PublicKey, mut countersignatory_revocation_base_point: crate::c_types::PublicKey) -> crate::c_types::PublicKey {
-       let mut ret = lightning::ln::chan_utils::derive_public_revocation_key(secp256k1::global::SECP256K1, &per_commitment_point.into_rust(), &countersignatory_revocation_base_point.into_rust());
-       crate::c_types::PublicKey::from_rust(&ret)
-}
-
 
 use lightning::ln::chan_utils::TxCreationKeys as nativeTxCreationKeysImport;
 pub(crate) type nativeTxCreationKeys = nativeTxCreationKeysImport;
 
 use lightning::ln::chan_utils::TxCreationKeys as nativeTxCreationKeysImport;
 pub(crate) type nativeTxCreationKeys = nativeTxCreationKeysImport;
@@ -394,6 +378,12 @@ pub struct TxCreationKeys {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for TxCreationKeys {
+       type Target = nativeTxCreationKeys;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for TxCreationKeys { }
+unsafe impl core::marker::Sync for TxCreationKeys { }
 impl Drop for TxCreationKeys {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeTxCreationKeys>::is_null(self.inner) {
 impl Drop for TxCreationKeys {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeTxCreationKeys>::is_null(self.inner) {
@@ -424,6 +414,9 @@ impl TxCreationKeys {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 /// The broadcaster's per-commitment public key which was used to derive the other keys.
 #[no_mangle]
 }
 /// The broadcaster's per-commitment public key which was used to derive the other keys.
 #[no_mangle]
@@ -440,60 +433,60 @@ pub extern "C" fn TxCreationKeys_set_per_commitment_point(this_ptr: &mut TxCreat
 /// transaction to provide their counterparty the ability to punish them if they broadcast
 /// an old state.
 #[no_mangle]
 /// transaction to provide their counterparty the ability to punish them if they broadcast
 /// an old state.
 #[no_mangle]
-pub extern "C" fn TxCreationKeys_get_revocation_key(this_ptr: &TxCreationKeys) -> crate::c_types::PublicKey {
+pub extern "C" fn TxCreationKeys_get_revocation_key(this_ptr: &TxCreationKeys) -> crate::lightning::ln::channel_keys::RevocationKey {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().revocation_key;
        let mut inner_val = &mut this_ptr.get_native_mut_ref().revocation_key;
-       crate::c_types::PublicKey::from_rust(&inner_val)
+       crate::lightning::ln::channel_keys::RevocationKey { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_keys::RevocationKey<>) as *mut _) }, is_owned: false }
 }
 /// The revocation key which is used to allow the broadcaster of the commitment
 /// transaction to provide their counterparty the ability to punish them if they broadcast
 /// an old state.
 #[no_mangle]
 }
 /// The revocation key which is used to allow the broadcaster of the commitment
 /// transaction to provide their counterparty the ability to punish them if they broadcast
 /// an old state.
 #[no_mangle]
-pub extern "C" fn TxCreationKeys_set_revocation_key(this_ptr: &mut TxCreationKeys, mut val: crate::c_types::PublicKey) {
-       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.revocation_key = val.into_rust();
+pub extern "C" fn TxCreationKeys_set_revocation_key(this_ptr: &mut TxCreationKeys, mut val: crate::lightning::ln::channel_keys::RevocationKey) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.revocation_key = *unsafe { Box::from_raw(val.take_inner()) };
 }
 /// Broadcaster's HTLC Key
 #[no_mangle]
 }
 /// Broadcaster's HTLC Key
 #[no_mangle]
-pub extern "C" fn TxCreationKeys_get_broadcaster_htlc_key(this_ptr: &TxCreationKeys) -> crate::c_types::PublicKey {
+pub extern "C" fn TxCreationKeys_get_broadcaster_htlc_key(this_ptr: &TxCreationKeys) -> crate::lightning::ln::channel_keys::HtlcKey {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().broadcaster_htlc_key;
        let mut inner_val = &mut this_ptr.get_native_mut_ref().broadcaster_htlc_key;
-       crate::c_types::PublicKey::from_rust(&inner_val)
+       crate::lightning::ln::channel_keys::HtlcKey { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_keys::HtlcKey<>) as *mut _) }, is_owned: false }
 }
 /// Broadcaster's HTLC Key
 #[no_mangle]
 }
 /// Broadcaster's HTLC Key
 #[no_mangle]
-pub extern "C" fn TxCreationKeys_set_broadcaster_htlc_key(this_ptr: &mut TxCreationKeys, mut val: crate::c_types::PublicKey) {
-       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.broadcaster_htlc_key = val.into_rust();
+pub extern "C" fn TxCreationKeys_set_broadcaster_htlc_key(this_ptr: &mut TxCreationKeys, mut val: crate::lightning::ln::channel_keys::HtlcKey) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.broadcaster_htlc_key = *unsafe { Box::from_raw(val.take_inner()) };
 }
 /// Countersignatory's HTLC Key
 #[no_mangle]
 }
 /// Countersignatory's HTLC Key
 #[no_mangle]
-pub extern "C" fn TxCreationKeys_get_countersignatory_htlc_key(this_ptr: &TxCreationKeys) -> crate::c_types::PublicKey {
+pub extern "C" fn TxCreationKeys_get_countersignatory_htlc_key(this_ptr: &TxCreationKeys) -> crate::lightning::ln::channel_keys::HtlcKey {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().countersignatory_htlc_key;
        let mut inner_val = &mut this_ptr.get_native_mut_ref().countersignatory_htlc_key;
-       crate::c_types::PublicKey::from_rust(&inner_val)
+       crate::lightning::ln::channel_keys::HtlcKey { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_keys::HtlcKey<>) as *mut _) }, is_owned: false }
 }
 /// Countersignatory's HTLC Key
 #[no_mangle]
 }
 /// Countersignatory's HTLC Key
 #[no_mangle]
-pub extern "C" fn TxCreationKeys_set_countersignatory_htlc_key(this_ptr: &mut TxCreationKeys, mut val: crate::c_types::PublicKey) {
-       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.countersignatory_htlc_key = val.into_rust();
+pub extern "C" fn TxCreationKeys_set_countersignatory_htlc_key(this_ptr: &mut TxCreationKeys, mut val: crate::lightning::ln::channel_keys::HtlcKey) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.countersignatory_htlc_key = *unsafe { Box::from_raw(val.take_inner()) };
 }
 /// Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
 #[no_mangle]
 }
 /// Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
 #[no_mangle]
-pub extern "C" fn TxCreationKeys_get_broadcaster_delayed_payment_key(this_ptr: &TxCreationKeys) -> crate::c_types::PublicKey {
+pub extern "C" fn TxCreationKeys_get_broadcaster_delayed_payment_key(this_ptr: &TxCreationKeys) -> crate::lightning::ln::channel_keys::DelayedPaymentKey {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().broadcaster_delayed_payment_key;
        let mut inner_val = &mut this_ptr.get_native_mut_ref().broadcaster_delayed_payment_key;
-       crate::c_types::PublicKey::from_rust(&inner_val)
+       crate::lightning::ln::channel_keys::DelayedPaymentKey { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_keys::DelayedPaymentKey<>) as *mut _) }, is_owned: false }
 }
 /// Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
 #[no_mangle]
 }
 /// Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
 #[no_mangle]
-pub extern "C" fn TxCreationKeys_set_broadcaster_delayed_payment_key(this_ptr: &mut TxCreationKeys, mut val: crate::c_types::PublicKey) {
-       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.broadcaster_delayed_payment_key = val.into_rust();
+pub extern "C" fn TxCreationKeys_set_broadcaster_delayed_payment_key(this_ptr: &mut TxCreationKeys, mut val: crate::lightning::ln::channel_keys::DelayedPaymentKey) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.broadcaster_delayed_payment_key = *unsafe { Box::from_raw(val.take_inner()) };
 }
 /// Constructs a new TxCreationKeys given each field
 #[must_use]
 #[no_mangle]
 }
 /// Constructs a new TxCreationKeys given each field
 #[must_use]
 #[no_mangle]
-pub extern "C" fn TxCreationKeys_new(mut per_commitment_point_arg: crate::c_types::PublicKey, mut revocation_key_arg: crate::c_types::PublicKey, mut broadcaster_htlc_key_arg: crate::c_types::PublicKey, mut countersignatory_htlc_key_arg: crate::c_types::PublicKey, mut broadcaster_delayed_payment_key_arg: crate::c_types::PublicKey) -> TxCreationKeys {
+pub extern "C" fn TxCreationKeys_new(mut per_commitment_point_arg: crate::c_types::PublicKey, mut revocation_key_arg: crate::lightning::ln::channel_keys::RevocationKey, mut broadcaster_htlc_key_arg: crate::lightning::ln::channel_keys::HtlcKey, mut countersignatory_htlc_key_arg: crate::lightning::ln::channel_keys::HtlcKey, mut broadcaster_delayed_payment_key_arg: crate::lightning::ln::channel_keys::DelayedPaymentKey) -> TxCreationKeys {
        TxCreationKeys { inner: ObjOps::heap_alloc(nativeTxCreationKeys {
                per_commitment_point: per_commitment_point_arg.into_rust(),
        TxCreationKeys { inner: ObjOps::heap_alloc(nativeTxCreationKeys {
                per_commitment_point: per_commitment_point_arg.into_rust(),
-               revocation_key: revocation_key_arg.into_rust(),
-               broadcaster_htlc_key: broadcaster_htlc_key_arg.into_rust(),
-               countersignatory_htlc_key: countersignatory_htlc_key_arg.into_rust(),
-               broadcaster_delayed_payment_key: broadcaster_delayed_payment_key_arg.into_rust(),
+               revocation_key: *unsafe { Box::from_raw(revocation_key_arg.take_inner()) },
+               broadcaster_htlc_key: *unsafe { Box::from_raw(broadcaster_htlc_key_arg.take_inner()) },
+               countersignatory_htlc_key: *unsafe { Box::from_raw(countersignatory_htlc_key_arg.take_inner()) },
+               broadcaster_delayed_payment_key: *unsafe { Box::from_raw(broadcaster_delayed_payment_key_arg.take_inner()) },
        }), is_owned: true }
 }
 /// Checks if two TxCreationKeyss contain equal inner contents.
        }), is_owned: true }
 }
 /// Checks if two TxCreationKeyss contain equal inner contents.
@@ -524,6 +517,9 @@ pub(crate) extern "C" fn TxCreationKeys_clone_void(this_ptr: *const c_void) -> *
 pub extern "C" fn TxCreationKeys_clone(orig: &TxCreationKeys) -> TxCreationKeys {
        orig.clone()
 }
 pub extern "C" fn TxCreationKeys_clone(orig: &TxCreationKeys) -> TxCreationKeys {
        orig.clone()
 }
+/// Get a string which allows debug introspection of a TxCreationKeys object
+pub extern "C" fn TxCreationKeys_debug_str_void(o: *const c_void) -> Str {
+       alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::chan_utils::TxCreationKeys }).into()}
 #[no_mangle]
 /// Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
 pub extern "C" fn TxCreationKeys_write(obj: &crate::lightning::ln::chan_utils::TxCreationKeys) -> crate::c_types::derived::CVec_u8Z {
 #[no_mangle]
 /// Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
 pub extern "C" fn TxCreationKeys_write(obj: &crate::lightning::ln::chan_utils::TxCreationKeys) -> crate::c_types::derived::CVec_u8Z {
@@ -531,7 +527,7 @@ pub extern "C" fn TxCreationKeys_write(obj: &crate::lightning::ln::chan_utils::T
 }
 #[allow(unused)]
 pub(crate) extern "C" fn TxCreationKeys_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
 }
 #[allow(unused)]
 pub(crate) extern "C" fn TxCreationKeys_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeTxCreationKeys) })
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::chan_utils::nativeTxCreationKeys) })
 }
 #[no_mangle]
 /// Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
 }
 #[no_mangle]
 /// Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
@@ -560,6 +556,12 @@ pub struct ChannelPublicKeys {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for ChannelPublicKeys {
+       type Target = nativeChannelPublicKeys;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for ChannelPublicKeys { }
+unsafe impl core::marker::Sync for ChannelPublicKeys { }
 impl Drop for ChannelPublicKeys {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeChannelPublicKeys>::is_null(self.inner) {
 impl Drop for ChannelPublicKeys {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeChannelPublicKeys>::is_null(self.inner) {
@@ -590,6 +592,9 @@ impl ChannelPublicKeys {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 /// The public key which is used to sign all commitment transactions, as it appears in the
 /// on-chain channel lock-in 2-of-2 multisig output.
 }
 /// The public key which is used to sign all commitment transactions, as it appears in the
 /// on-chain channel lock-in 2-of-2 multisig output.
@@ -604,22 +609,22 @@ pub extern "C" fn ChannelPublicKeys_get_funding_pubkey(this_ptr: &ChannelPublicK
 pub extern "C" fn ChannelPublicKeys_set_funding_pubkey(this_ptr: &mut ChannelPublicKeys, mut val: crate::c_types::PublicKey) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_pubkey = val.into_rust();
 }
 pub extern "C" fn ChannelPublicKeys_set_funding_pubkey(this_ptr: &mut ChannelPublicKeys, mut val: crate::c_types::PublicKey) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_pubkey = val.into_rust();
 }
-/// The base point which is used (with derive_public_revocation_key) to derive per-commitment
+/// The base point which is used (with [`RevocationKey::from_basepoint`]) to derive per-commitment
 /// revocation keys. This is combined with the per-commitment-secret generated by the
 /// counterparty to create a secret which the counterparty can reveal to revoke previous
 /// states.
 #[no_mangle]
 /// revocation keys. This is combined with the per-commitment-secret generated by the
 /// counterparty to create a secret which the counterparty can reveal to revoke previous
 /// states.
 #[no_mangle]
-pub extern "C" fn ChannelPublicKeys_get_revocation_basepoint(this_ptr: &ChannelPublicKeys) -> crate::c_types::PublicKey {
+pub extern "C" fn ChannelPublicKeys_get_revocation_basepoint(this_ptr: &ChannelPublicKeys) -> crate::lightning::ln::channel_keys::RevocationBasepoint {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().revocation_basepoint;
        let mut inner_val = &mut this_ptr.get_native_mut_ref().revocation_basepoint;
-       crate::c_types::PublicKey::from_rust(&inner_val)
+       crate::lightning::ln::channel_keys::RevocationBasepoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_keys::RevocationBasepoint<>) as *mut _) }, is_owned: false }
 }
 }
-/// The base point which is used (with derive_public_revocation_key) to derive per-commitment
+/// The base point which is used (with [`RevocationKey::from_basepoint`]) to derive per-commitment
 /// revocation keys. This is combined with the per-commitment-secret generated by the
 /// counterparty to create a secret which the counterparty can reveal to revoke previous
 /// states.
 #[no_mangle]
 /// revocation keys. This is combined with the per-commitment-secret generated by the
 /// counterparty to create a secret which the counterparty can reveal to revoke previous
 /// states.
 #[no_mangle]
-pub extern "C" fn ChannelPublicKeys_set_revocation_basepoint(this_ptr: &mut ChannelPublicKeys, mut val: crate::c_types::PublicKey) {
-       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.revocation_basepoint = val.into_rust();
+pub extern "C" fn ChannelPublicKeys_set_revocation_basepoint(this_ptr: &mut ChannelPublicKeys, mut val: crate::lightning::ln::channel_keys::RevocationBasepoint) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.revocation_basepoint = *unsafe { Box::from_raw(val.take_inner()) };
 }
 /// The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
 /// spendable primary channel balance on the broadcaster's commitment transaction. This key is
 }
 /// The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
 /// spendable primary channel balance on the broadcaster's commitment transaction. This key is
@@ -640,40 +645,40 @@ pub extern "C" fn ChannelPublicKeys_set_payment_point(this_ptr: &mut ChannelPubl
 /// public key which receives non-HTLC-encumbered funds which are only available for spending
 /// after some delay (or can be claimed via the revocation path).
 #[no_mangle]
 /// public key which receives non-HTLC-encumbered funds which are only available for spending
 /// after some delay (or can be claimed via the revocation path).
 #[no_mangle]
-pub extern "C" fn ChannelPublicKeys_get_delayed_payment_basepoint(this_ptr: &ChannelPublicKeys) -> crate::c_types::PublicKey {
+pub extern "C" fn ChannelPublicKeys_get_delayed_payment_basepoint(this_ptr: &ChannelPublicKeys) -> crate::lightning::ln::channel_keys::DelayedPaymentBasepoint {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().delayed_payment_basepoint;
        let mut inner_val = &mut this_ptr.get_native_mut_ref().delayed_payment_basepoint;
-       crate::c_types::PublicKey::from_rust(&inner_val)
+       crate::lightning::ln::channel_keys::DelayedPaymentBasepoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_keys::DelayedPaymentBasepoint<>) as *mut _) }, is_owned: false }
 }
 /// The base point which is used (with derive_public_key) to derive a per-commitment payment
 /// public key which receives non-HTLC-encumbered funds which are only available for spending
 /// after some delay (or can be claimed via the revocation path).
 #[no_mangle]
 }
 /// The base point which is used (with derive_public_key) to derive a per-commitment payment
 /// public key which receives non-HTLC-encumbered funds which are only available for spending
 /// after some delay (or can be claimed via the revocation path).
 #[no_mangle]
-pub extern "C" fn ChannelPublicKeys_set_delayed_payment_basepoint(this_ptr: &mut ChannelPublicKeys, mut val: crate::c_types::PublicKey) {
-       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.delayed_payment_basepoint = val.into_rust();
+pub extern "C" fn ChannelPublicKeys_set_delayed_payment_basepoint(this_ptr: &mut ChannelPublicKeys, mut val: crate::lightning::ln::channel_keys::DelayedPaymentBasepoint) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.delayed_payment_basepoint = *unsafe { Box::from_raw(val.take_inner()) };
 }
 /// The base point which is used (with derive_public_key) to derive a per-commitment public key
 /// which is used to encumber HTLC-in-flight outputs.
 #[no_mangle]
 }
 /// The base point which is used (with derive_public_key) to derive a per-commitment public key
 /// which is used to encumber HTLC-in-flight outputs.
 #[no_mangle]
-pub extern "C" fn ChannelPublicKeys_get_htlc_basepoint(this_ptr: &ChannelPublicKeys) -> crate::c_types::PublicKey {
+pub extern "C" fn ChannelPublicKeys_get_htlc_basepoint(this_ptr: &ChannelPublicKeys) -> crate::lightning::ln::channel_keys::HtlcBasepoint {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_basepoint;
        let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_basepoint;
-       crate::c_types::PublicKey::from_rust(&inner_val)
+       crate::lightning::ln::channel_keys::HtlcBasepoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_keys::HtlcBasepoint<>) as *mut _) }, is_owned: false }
 }
 /// The base point which is used (with derive_public_key) to derive a per-commitment public key
 /// which is used to encumber HTLC-in-flight outputs.
 #[no_mangle]
 }
 /// The base point which is used (with derive_public_key) to derive a per-commitment public key
 /// which is used to encumber HTLC-in-flight outputs.
 #[no_mangle]
-pub extern "C" fn ChannelPublicKeys_set_htlc_basepoint(this_ptr: &mut ChannelPublicKeys, mut val: crate::c_types::PublicKey) {
-       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_basepoint = val.into_rust();
+pub extern "C" fn ChannelPublicKeys_set_htlc_basepoint(this_ptr: &mut ChannelPublicKeys, mut val: crate::lightning::ln::channel_keys::HtlcBasepoint) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_basepoint = *unsafe { Box::from_raw(val.take_inner()) };
 }
 /// Constructs a new ChannelPublicKeys given each field
 #[must_use]
 #[no_mangle]
 }
 /// Constructs a new ChannelPublicKeys given each field
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelPublicKeys_new(mut funding_pubkey_arg: crate::c_types::PublicKey, mut revocation_basepoint_arg: crate::c_types::PublicKey, mut payment_point_arg: crate::c_types::PublicKey, mut delayed_payment_basepoint_arg: crate::c_types::PublicKey, mut htlc_basepoint_arg: crate::c_types::PublicKey) -> ChannelPublicKeys {
+pub extern "C" fn ChannelPublicKeys_new(mut funding_pubkey_arg: crate::c_types::PublicKey, mut revocation_basepoint_arg: crate::lightning::ln::channel_keys::RevocationBasepoint, mut payment_point_arg: crate::c_types::PublicKey, mut delayed_payment_basepoint_arg: crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, mut htlc_basepoint_arg: crate::lightning::ln::channel_keys::HtlcBasepoint) -> ChannelPublicKeys {
        ChannelPublicKeys { inner: ObjOps::heap_alloc(nativeChannelPublicKeys {
                funding_pubkey: funding_pubkey_arg.into_rust(),
        ChannelPublicKeys { inner: ObjOps::heap_alloc(nativeChannelPublicKeys {
                funding_pubkey: funding_pubkey_arg.into_rust(),
-               revocation_basepoint: revocation_basepoint_arg.into_rust(),
+               revocation_basepoint: *unsafe { Box::from_raw(revocation_basepoint_arg.take_inner()) },
                payment_point: payment_point_arg.into_rust(),
                payment_point: payment_point_arg.into_rust(),
-               delayed_payment_basepoint: delayed_payment_basepoint_arg.into_rust(),
-               htlc_basepoint: htlc_basepoint_arg.into_rust(),
+               delayed_payment_basepoint: *unsafe { Box::from_raw(delayed_payment_basepoint_arg.take_inner()) },
+               htlc_basepoint: *unsafe { Box::from_raw(htlc_basepoint_arg.take_inner()) },
        }), is_owned: true }
 }
 impl Clone for ChannelPublicKeys {
        }), is_owned: true }
 }
 impl Clone for ChannelPublicKeys {
@@ -695,6 +700,9 @@ pub(crate) extern "C" fn ChannelPublicKeys_clone_void(this_ptr: *const c_void) -
 pub extern "C" fn ChannelPublicKeys_clone(orig: &ChannelPublicKeys) -> ChannelPublicKeys {
        orig.clone()
 }
 pub extern "C" fn ChannelPublicKeys_clone(orig: &ChannelPublicKeys) -> ChannelPublicKeys {
        orig.clone()
 }
+/// Get a string which allows debug introspection of a ChannelPublicKeys object
+pub extern "C" fn ChannelPublicKeys_debug_str_void(o: *const c_void) -> Str {
+       alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::chan_utils::ChannelPublicKeys }).into()}
 /// Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys.
 #[no_mangle]
 pub extern "C" fn ChannelPublicKeys_hash(o: &ChannelPublicKeys) -> u64 {
 /// Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys.
 #[no_mangle]
 pub extern "C" fn ChannelPublicKeys_hash(o: &ChannelPublicKeys) -> u64 {
@@ -721,7 +729,7 @@ pub extern "C" fn ChannelPublicKeys_write(obj: &crate::lightning::ln::chan_utils
 }
 #[allow(unused)]
 pub(crate) extern "C" fn ChannelPublicKeys_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
 }
 #[allow(unused)]
 pub(crate) extern "C" fn ChannelPublicKeys_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelPublicKeys) })
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::chan_utils::nativeChannelPublicKeys) })
 }
 #[no_mangle]
 /// Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
 }
 #[no_mangle]
 /// Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
@@ -734,8 +742,8 @@ pub extern "C" fn ChannelPublicKeys_read(ser: crate::c_types::u8slice) -> crate:
 /// Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
 #[must_use]
 #[no_mangle]
 /// Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn TxCreationKeys_derive_new(mut per_commitment_point: crate::c_types::PublicKey, mut broadcaster_delayed_payment_base: crate::c_types::PublicKey, mut broadcaster_htlc_base: crate::c_types::PublicKey, mut countersignatory_revocation_base: crate::c_types::PublicKey, mut countersignatory_htlc_base: crate::c_types::PublicKey) -> crate::lightning::ln::chan_utils::TxCreationKeys {
-       let mut ret = lightning::ln::chan_utils::TxCreationKeys::derive_new(secp256k1::global::SECP256K1, &per_commitment_point.into_rust(), &broadcaster_delayed_payment_base.into_rust(), &broadcaster_htlc_base.into_rust(), &countersignatory_revocation_base.into_rust(), &countersignatory_htlc_base.into_rust());
+pub extern "C" fn TxCreationKeys_derive_new(mut per_commitment_point: crate::c_types::PublicKey, broadcaster_delayed_payment_base: &crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, broadcaster_htlc_base: &crate::lightning::ln::channel_keys::HtlcBasepoint, countersignatory_revocation_base: &crate::lightning::ln::channel_keys::RevocationBasepoint, countersignatory_htlc_base: &crate::lightning::ln::channel_keys::HtlcBasepoint) -> crate::lightning::ln::chan_utils::TxCreationKeys {
+       let mut ret = lightning::ln::chan_utils::TxCreationKeys::derive_new(secp256k1::global::SECP256K1, &per_commitment_point.into_rust(), broadcaster_delayed_payment_base.get_native_ref(), broadcaster_htlc_base.get_native_ref(), countersignatory_revocation_base.get_native_ref(), countersignatory_htlc_base.get_native_ref());
        crate::lightning::ln::chan_utils::TxCreationKeys { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
        crate::lightning::ln::chan_utils::TxCreationKeys { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
@@ -756,17 +764,17 @@ pub static REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH: usize = lightning::ln::chan_utils
 /// key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
 /// Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
 #[no_mangle]
 /// key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
 /// Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
 #[no_mangle]
-pub extern "C" fn get_revokeable_redeemscript(mut revocation_key: crate::c_types::PublicKey, mut contest_delay: u16, mut broadcaster_delayed_payment_key: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z {
-       let mut ret = lightning::ln::chan_utils::get_revokeable_redeemscript(&revocation_key.into_rust(), contest_delay, &broadcaster_delayed_payment_key.into_rust());
-       ret.into_bytes().into()
+pub extern "C" fn get_revokeable_redeemscript(revocation_key: &crate::lightning::ln::channel_keys::RevocationKey, mut contest_delay: u16, broadcaster_delayed_payment_key: &crate::lightning::ln::channel_keys::DelayedPaymentKey) -> crate::c_types::derived::CVec_u8Z {
+       let mut ret = lightning::ln::chan_utils::get_revokeable_redeemscript(revocation_key.get_native_ref(), contest_delay, broadcaster_delayed_payment_key.get_native_ref());
+       ret.to_bytes().into()
 }
 
 /// Returns the script for the counterparty's output on a holder's commitment transaction based on
 /// the channel type.
 #[no_mangle]
 }
 
 /// Returns the script for the counterparty's output on a holder's commitment transaction based on
 /// the channel type.
 #[no_mangle]
-pub extern "C" fn get_counterparty_payment_script(channel_type_features: &crate::lightning::ln::features::ChannelTypeFeatures, mut payment_key: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn get_counterparty_payment_script(channel_type_features: &crate::lightning_types::features::ChannelTypeFeatures, mut payment_key: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z {
        let mut ret = lightning::ln::chan_utils::get_counterparty_payment_script(channel_type_features.get_native_ref(), &payment_key.into_rust());
        let mut ret = lightning::ln::chan_utils::get_counterparty_payment_script(channel_type_features.get_native_ref(), &payment_key.into_rust());
-       ret.into_bytes().into()
+       ret.to_bytes().into()
 }
 
 
 }
 
 
@@ -789,6 +797,12 @@ pub struct HTLCOutputInCommitment {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for HTLCOutputInCommitment {
+       type Target = nativeHTLCOutputInCommitment;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for HTLCOutputInCommitment { }
+unsafe impl core::marker::Sync for HTLCOutputInCommitment { }
 impl Drop for HTLCOutputInCommitment {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeHTLCOutputInCommitment>::is_null(self.inner) {
 impl Drop for HTLCOutputInCommitment {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeHTLCOutputInCommitment>::is_null(self.inner) {
@@ -819,6 +833,9 @@ impl HTLCOutputInCommitment {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 /// Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
 /// Note that this is not the same as whether it is ountbound *from us*. To determine that you
 }
 /// Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
 /// Note that this is not the same as whether it is ountbound *from us*. To determine that you
@@ -870,7 +887,7 @@ pub extern "C" fn HTLCOutputInCommitment_get_payment_hash(this_ptr: &HTLCOutputI
 /// The hash of the preimage which unlocks this HTLC.
 #[no_mangle]
 pub extern "C" fn HTLCOutputInCommitment_set_payment_hash(this_ptr: &mut HTLCOutputInCommitment, mut val: crate::c_types::ThirtyTwoBytes) {
 /// The hash of the preimage which unlocks this HTLC.
 #[no_mangle]
 pub extern "C" fn HTLCOutputInCommitment_set_payment_hash(this_ptr: &mut HTLCOutputInCommitment, mut val: crate::c_types::ThirtyTwoBytes) {
-       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = ::lightning::ln::PaymentHash(val.data);
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = ::lightning::ln::types::PaymentHash(val.data);
 }
 /// The position within the commitment transactions' outputs. This may be None if the value is
 /// below the dust limit (in which case no output appears in the commitment transaction and the
 }
 /// The position within the commitment transactions' outputs. This may be None if the value is
 /// below the dust limit (in which case no output appears in the commitment transaction and the
@@ -898,7 +915,7 @@ pub extern "C" fn HTLCOutputInCommitment_new(mut offered_arg: bool, mut amount_m
                offered: offered_arg,
                amount_msat: amount_msat_arg,
                cltv_expiry: cltv_expiry_arg,
                offered: offered_arg,
                amount_msat: amount_msat_arg,
                cltv_expiry: cltv_expiry_arg,
-               payment_hash: ::lightning::ln::PaymentHash(payment_hash_arg.data),
+               payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_arg.data),
                transaction_output_index: local_transaction_output_index_arg,
        }), is_owned: true }
 }
                transaction_output_index: local_transaction_output_index_arg,
        }), is_owned: true }
 }
@@ -921,6 +938,9 @@ pub(crate) extern "C" fn HTLCOutputInCommitment_clone_void(this_ptr: *const c_vo
 pub extern "C" fn HTLCOutputInCommitment_clone(orig: &HTLCOutputInCommitment) -> HTLCOutputInCommitment {
        orig.clone()
 }
 pub extern "C" fn HTLCOutputInCommitment_clone(orig: &HTLCOutputInCommitment) -> HTLCOutputInCommitment {
        orig.clone()
 }
+/// Get a string which allows debug introspection of a HTLCOutputInCommitment object
+pub extern "C" fn HTLCOutputInCommitment_debug_str_void(o: *const c_void) -> Str {
+       alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::chan_utils::HTLCOutputInCommitment }).into()}
 /// Checks if two HTLCOutputInCommitments 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.
 /// Checks if two HTLCOutputInCommitments 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.
@@ -930,6 +950,16 @@ pub extern "C" fn HTLCOutputInCommitment_eq(a: &HTLCOutputInCommitment, b: &HTLC
        if a.inner.is_null() || b.inner.is_null() { return false; }
        if a.get_native_ref() == b.get_native_ref() { true } else { false }
 }
        if a.inner.is_null() || b.inner.is_null() { return false; }
        if a.get_native_ref() == b.get_native_ref() { true } else { false }
 }
+/// Converts HTLC's value with millisatoshi precision into [bitcoin::Amount] with satoshi precision.
+/// Typically this conversion is needed when transitioning from LN into base-layer Bitcoin,
+/// e. g. in commitment transactions.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn HTLCOutputInCommitment_to_bitcoin_amount(this_arg: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> u64 {
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.to_bitcoin_amount();
+       ret.to_sat()
+}
+
 #[no_mangle]
 /// Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
 pub extern "C" fn HTLCOutputInCommitment_write(obj: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CVec_u8Z {
 #[no_mangle]
 /// Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
 pub extern "C" fn HTLCOutputInCommitment_write(obj: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CVec_u8Z {
@@ -937,7 +967,7 @@ pub extern "C" fn HTLCOutputInCommitment_write(obj: &crate::lightning::ln::chan_
 }
 #[allow(unused)]
 pub(crate) extern "C" fn HTLCOutputInCommitment_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
 }
 #[allow(unused)]
 pub(crate) extern "C" fn HTLCOutputInCommitment_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeHTLCOutputInCommitment) })
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::chan_utils::nativeHTLCOutputInCommitment) })
 }
 #[no_mangle]
 /// Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
 }
 #[no_mangle]
 /// Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
@@ -949,9 +979,9 @@ pub extern "C" fn HTLCOutputInCommitment_read(ser: crate::c_types::u8slice) -> c
 /// Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
 /// does not need to have its previous_output_index filled.
 #[no_mangle]
 /// Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
 /// does not need to have its previous_output_index filled.
 #[no_mangle]
-pub extern "C" fn get_htlc_redeemscript(htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment, channel_type_features: &crate::lightning::ln::features::ChannelTypeFeatures, keys: &crate::lightning::ln::chan_utils::TxCreationKeys) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn get_htlc_redeemscript(htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment, channel_type_features: &crate::lightning_types::features::ChannelTypeFeatures, keys: &crate::lightning::ln::chan_utils::TxCreationKeys) -> crate::c_types::derived::CVec_u8Z {
        let mut ret = lightning::ln::chan_utils::get_htlc_redeemscript(htlc.get_native_ref(), channel_type_features.get_native_ref(), keys.get_native_ref());
        let mut ret = lightning::ln::chan_utils::get_htlc_redeemscript(htlc.get_native_ref(), channel_type_features.get_native_ref(), keys.get_native_ref());
-       ret.into_bytes().into()
+       ret.to_bytes().into()
 }
 
 /// Gets the redeemscript for a funding output from the two funding public keys.
 }
 
 /// Gets the redeemscript for a funding output from the two funding public keys.
@@ -959,7 +989,7 @@ pub extern "C" fn get_htlc_redeemscript(htlc: &crate::lightning::ln::chan_utils:
 #[no_mangle]
 pub extern "C" fn make_funding_redeemscript(mut broadcaster: crate::c_types::PublicKey, mut countersignatory: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z {
        let mut ret = lightning::ln::chan_utils::make_funding_redeemscript(&broadcaster.into_rust(), &countersignatory.into_rust());
 #[no_mangle]
 pub extern "C" fn make_funding_redeemscript(mut broadcaster: crate::c_types::PublicKey, mut countersignatory: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z {
        let mut ret = lightning::ln::chan_utils::make_funding_redeemscript(&broadcaster.into_rust(), &countersignatory.into_rust());
-       ret.into_bytes().into()
+       ret.to_bytes().into()
 }
 
 /// Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
 }
 
 /// Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
@@ -970,16 +1000,16 @@ pub extern "C" fn make_funding_redeemscript(mut broadcaster: crate::c_types::Pub
 /// Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
 /// commitment transaction).
 #[no_mangle]
 /// Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
 /// commitment transaction).
 #[no_mangle]
-pub extern "C" fn build_htlc_transaction(commitment_txid: *const [u8; 32], mut feerate_per_kw: u32, mut contest_delay: u16, htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment, channel_type_features: &crate::lightning::ln::features::ChannelTypeFeatures, mut broadcaster_delayed_payment_key: crate::c_types::PublicKey, mut revocation_key: crate::c_types::PublicKey) -> crate::c_types::Transaction {
-       let mut ret = lightning::ln::chan_utils::build_htlc_transaction(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*commitment_txid }[..]).unwrap(), feerate_per_kw, contest_delay, htlc.get_native_ref(), channel_type_features.get_native_ref(), &broadcaster_delayed_payment_key.into_rust(), &revocation_key.into_rust());
+pub extern "C" fn build_htlc_transaction(commitment_txid: *const [u8; 32], mut feerate_per_kw: u32, mut contest_delay: u16, htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment, channel_type_features: &crate::lightning_types::features::ChannelTypeFeatures, broadcaster_delayed_payment_key: &crate::lightning::ln::channel_keys::DelayedPaymentKey, revocation_key: &crate::lightning::ln::channel_keys::RevocationKey) -> crate::c_types::Transaction {
+       let mut ret = lightning::ln::chan_utils::build_htlc_transaction(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*commitment_txid }[..]).unwrap(), feerate_per_kw, contest_delay, htlc.get_native_ref(), channel_type_features.get_native_ref(), broadcaster_delayed_payment_key.get_native_ref(), revocation_key.get_native_ref());
        crate::c_types::Transaction::from_bitcoin(&ret)
 }
 
 /// Returns the witness required to satisfy and spend a HTLC input.
 #[no_mangle]
        crate::c_types::Transaction::from_bitcoin(&ret)
 }
 
 /// Returns the witness required to satisfy and spend a HTLC input.
 #[no_mangle]
-pub extern "C" fn build_htlc_input_witness(mut local_sig: crate::c_types::ECDSASignature, mut remote_sig: crate::c_types::ECDSASignature, mut preimage: crate::c_types::derived::COption_ThirtyTwoBytesZ, mut redeem_script: crate::c_types::u8slice, channel_type_features: &crate::lightning::ln::features::ChannelTypeFeatures) -> crate::c_types::Witness {
-       let mut local_preimage = { /*preimage*/ let preimage_opt = preimage; if preimage_opt.is_none() { None } else { Some({ { ::lightning::ln::PaymentPreimage({ preimage_opt.take() }.data) }})} };
-       let mut ret = lightning::ln::chan_utils::build_htlc_input_witness(&local_sig.into_rust(), &remote_sig.into_rust(), &local_preimage, &::bitcoin::blockdata::script::Script::from(Vec::from(redeem_script.to_slice())), channel_type_features.get_native_ref());
+pub extern "C" fn build_htlc_input_witness(mut local_sig: crate::c_types::ECDSASignature, mut remote_sig: crate::c_types::ECDSASignature, mut preimage: crate::c_types::derived::COption_ThirtyTwoBytesZ, mut redeem_script: crate::c_types::u8slice, channel_type_features: &crate::lightning_types::features::ChannelTypeFeatures) -> crate::c_types::Witness {
+       let mut local_preimage = { /*preimage*/ let preimage_opt = preimage; if preimage_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentPreimage({ preimage_opt.take() }.data) }})} };
+       let mut ret = lightning::ln::chan_utils::build_htlc_input_witness(&local_sig.into_rust(), &remote_sig.into_rust(), &local_preimage, ::bitcoin::script::Script::from_bytes(redeem_script.to_slice()), channel_type_features.get_native_ref());
        crate::c_types::Witness::from_bitcoin(&ret)
 }
 
        crate::c_types::Witness::from_bitcoin(&ret)
 }
 
@@ -987,7 +1017,7 @@ pub extern "C" fn build_htlc_input_witness(mut local_sig: crate::c_types::ECDSAS
 #[no_mangle]
 pub extern "C" fn get_to_countersignatory_with_anchors_redeemscript(mut payment_point: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z {
        let mut ret = lightning::ln::chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point.into_rust());
 #[no_mangle]
 pub extern "C" fn get_to_countersignatory_with_anchors_redeemscript(mut payment_point: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z {
        let mut ret = lightning::ln::chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point.into_rust());
-       ret.into_bytes().into()
+       ret.to_bytes().into()
 }
 
 /// Gets the witnessScript for an anchor output from the funding public key.
 }
 
 /// Gets the witnessScript for an anchor output from the funding public key.
@@ -999,7 +1029,7 @@ pub extern "C" fn get_to_countersignatory_with_anchors_redeemscript(mut payment_
 #[no_mangle]
 pub extern "C" fn get_anchor_redeemscript(mut funding_pubkey: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z {
        let mut ret = lightning::ln::chan_utils::get_anchor_redeemscript(&funding_pubkey.into_rust());
 #[no_mangle]
 pub extern "C" fn get_anchor_redeemscript(mut funding_pubkey: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z {
        let mut ret = lightning::ln::chan_utils::get_anchor_redeemscript(&funding_pubkey.into_rust());
-       ret.into_bytes().into()
+       ret.to_bytes().into()
 }
 
 /// Returns the witness required to satisfy and spend an anchor input.
 }
 
 /// Returns the witness required to satisfy and spend an anchor input.
@@ -1033,6 +1063,12 @@ pub struct ChannelTransactionParameters {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for ChannelTransactionParameters {
+       type Target = nativeChannelTransactionParameters;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for ChannelTransactionParameters { }
+unsafe impl core::marker::Sync for ChannelTransactionParameters { }
 impl Drop for ChannelTransactionParameters {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeChannelTransactionParameters>::is_null(self.inner) {
 impl Drop for ChannelTransactionParameters {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeChannelTransactionParameters>::is_null(self.inner) {
@@ -1063,6 +1099,9 @@ impl ChannelTransactionParameters {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 /// Holder public keys
 #[no_mangle]
 }
 /// Holder public keys
 #[no_mangle]
@@ -1138,14 +1177,14 @@ pub extern "C" fn ChannelTransactionParameters_set_funding_outpoint(this_ptr: &m
 /// This channel's type, as negotiated during channel open. For old objects where this field
 /// wasn't serialized, it will default to static_remote_key at deserialization.
 #[no_mangle]
 /// This channel's type, as negotiated during channel open. For old objects where this field
 /// wasn't serialized, it will default to static_remote_key at deserialization.
 #[no_mangle]
-pub extern "C" fn ChannelTransactionParameters_get_channel_type_features(this_ptr: &ChannelTransactionParameters) -> crate::lightning::ln::features::ChannelTypeFeatures {
+pub extern "C" fn ChannelTransactionParameters_get_channel_type_features(this_ptr: &ChannelTransactionParameters) -> crate::lightning_types::features::ChannelTypeFeatures {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_type_features;
        let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_type_features;
-       crate::lightning::ln::features::ChannelTypeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::ChannelTypeFeatures<>) as *mut _) }, is_owned: false }
+       crate::lightning_types::features::ChannelTypeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::ChannelTypeFeatures<>) as *mut _) }, is_owned: false }
 }
 /// This channel's type, as negotiated during channel open. For old objects where this field
 /// wasn't serialized, it will default to static_remote_key at deserialization.
 #[no_mangle]
 }
 /// This channel's type, as negotiated during channel open. For old objects where this field
 /// wasn't serialized, it will default to static_remote_key at deserialization.
 #[no_mangle]
-pub extern "C" fn ChannelTransactionParameters_set_channel_type_features(this_ptr: &mut ChannelTransactionParameters, mut val: crate::lightning::ln::features::ChannelTypeFeatures) {
+pub extern "C" fn ChannelTransactionParameters_set_channel_type_features(this_ptr: &mut ChannelTransactionParameters, mut val: crate::lightning_types::features::ChannelTypeFeatures) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_type_features = *unsafe { Box::from_raw(val.take_inner()) };
 }
 /// Constructs a new ChannelTransactionParameters given each field
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_type_features = *unsafe { Box::from_raw(val.take_inner()) };
 }
 /// Constructs a new ChannelTransactionParameters given each field
@@ -1154,7 +1193,7 @@ pub extern "C" fn ChannelTransactionParameters_set_channel_type_features(this_pt
 /// Note that funding_outpoint_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
 #[must_use]
 #[no_mangle]
 /// Note that funding_outpoint_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelTransactionParameters_new(mut holder_pubkeys_arg: crate::lightning::ln::chan_utils::ChannelPublicKeys, mut holder_selected_contest_delay_arg: u16, mut is_outbound_from_holder_arg: bool, mut counterparty_parameters_arg: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, mut funding_outpoint_arg: crate::lightning::chain::transaction::OutPoint, mut channel_type_features_arg: crate::lightning::ln::features::ChannelTypeFeatures) -> ChannelTransactionParameters {
+pub extern "C" fn ChannelTransactionParameters_new(mut holder_pubkeys_arg: crate::lightning::ln::chan_utils::ChannelPublicKeys, mut holder_selected_contest_delay_arg: u16, mut is_outbound_from_holder_arg: bool, mut counterparty_parameters_arg: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, mut funding_outpoint_arg: crate::lightning::chain::transaction::OutPoint, mut channel_type_features_arg: crate::lightning_types::features::ChannelTypeFeatures) -> ChannelTransactionParameters {
        let mut local_counterparty_parameters_arg = if counterparty_parameters_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(counterparty_parameters_arg.take_inner()) } }) };
        let mut local_funding_outpoint_arg = if funding_outpoint_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(funding_outpoint_arg.take_inner()) } }) };
        ChannelTransactionParameters { inner: ObjOps::heap_alloc(nativeChannelTransactionParameters {
        let mut local_counterparty_parameters_arg = if counterparty_parameters_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(counterparty_parameters_arg.take_inner()) } }) };
        let mut local_funding_outpoint_arg = if funding_outpoint_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(funding_outpoint_arg.take_inner()) } }) };
        ChannelTransactionParameters { inner: ObjOps::heap_alloc(nativeChannelTransactionParameters {
@@ -1185,6 +1224,9 @@ pub(crate) extern "C" fn ChannelTransactionParameters_clone_void(this_ptr: *cons
 pub extern "C" fn ChannelTransactionParameters_clone(orig: &ChannelTransactionParameters) -> ChannelTransactionParameters {
        orig.clone()
 }
 pub extern "C" fn ChannelTransactionParameters_clone(orig: &ChannelTransactionParameters) -> ChannelTransactionParameters {
        orig.clone()
 }
+/// Get a string which allows debug introspection of a ChannelTransactionParameters object
+pub extern "C" fn ChannelTransactionParameters_debug_str_void(o: *const c_void) -> Str {
+       alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::chan_utils::ChannelTransactionParameters }).into()}
 /// Generates a non-cryptographic 64-bit hash of the ChannelTransactionParameters.
 #[no_mangle]
 pub extern "C" fn ChannelTransactionParameters_hash(o: &ChannelTransactionParameters) -> u64 {
 /// Generates a non-cryptographic 64-bit hash of the ChannelTransactionParameters.
 #[no_mangle]
 pub extern "C" fn ChannelTransactionParameters_hash(o: &ChannelTransactionParameters) -> u64 {
@@ -1224,6 +1266,12 @@ pub struct CounterpartyChannelTransactionParameters {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for CounterpartyChannelTransactionParameters {
+       type Target = nativeCounterpartyChannelTransactionParameters;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for CounterpartyChannelTransactionParameters { }
+unsafe impl core::marker::Sync for CounterpartyChannelTransactionParameters { }
 impl Drop for CounterpartyChannelTransactionParameters {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeCounterpartyChannelTransactionParameters>::is_null(self.inner) {
 impl Drop for CounterpartyChannelTransactionParameters {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeCounterpartyChannelTransactionParameters>::is_null(self.inner) {
@@ -1254,6 +1302,9 @@ impl CounterpartyChannelTransactionParameters {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 /// Counter-party public keys
 #[no_mangle]
 }
 /// Counter-party public keys
 #[no_mangle]
@@ -1305,6 +1356,9 @@ pub(crate) extern "C" fn CounterpartyChannelTransactionParameters_clone_void(thi
 pub extern "C" fn CounterpartyChannelTransactionParameters_clone(orig: &CounterpartyChannelTransactionParameters) -> CounterpartyChannelTransactionParameters {
        orig.clone()
 }
 pub extern "C" fn CounterpartyChannelTransactionParameters_clone(orig: &CounterpartyChannelTransactionParameters) -> CounterpartyChannelTransactionParameters {
        orig.clone()
 }
+/// Get a string which allows debug introspection of a CounterpartyChannelTransactionParameters object
+pub extern "C" fn CounterpartyChannelTransactionParameters_debug_str_void(o: *const c_void) -> Str {
+       alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters }).into()}
 /// Generates a non-cryptographic 64-bit hash of the CounterpartyChannelTransactionParameters.
 #[no_mangle]
 pub extern "C" fn CounterpartyChannelTransactionParameters_hash(o: &CounterpartyChannelTransactionParameters) -> u64 {
 /// Generates a non-cryptographic 64-bit hash of the CounterpartyChannelTransactionParameters.
 #[no_mangle]
 pub extern "C" fn CounterpartyChannelTransactionParameters_hash(o: &CounterpartyChannelTransactionParameters) -> u64 {
@@ -1361,7 +1415,7 @@ pub extern "C" fn CounterpartyChannelTransactionParameters_write(obj: &crate::li
 }
 #[allow(unused)]
 pub(crate) extern "C" fn CounterpartyChannelTransactionParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
 }
 #[allow(unused)]
 pub(crate) extern "C" fn CounterpartyChannelTransactionParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeCounterpartyChannelTransactionParameters) })
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::chan_utils::nativeCounterpartyChannelTransactionParameters) })
 }
 #[no_mangle]
 /// Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
 }
 #[no_mangle]
 /// Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
@@ -1377,7 +1431,7 @@ pub extern "C" fn ChannelTransactionParameters_write(obj: &crate::lightning::ln:
 }
 #[allow(unused)]
 pub(crate) extern "C" fn ChannelTransactionParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
 }
 #[allow(unused)]
 pub(crate) extern "C" fn ChannelTransactionParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelTransactionParameters) })
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::chan_utils::nativeChannelTransactionParameters) })
 }
 #[no_mangle]
 /// Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
 }
 #[no_mangle]
 /// Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
@@ -1388,7 +1442,7 @@ pub extern "C" fn ChannelTransactionParameters_read(ser: crate::c_types::u8slice
 }
 
 use lightning::ln::chan_utils::DirectedChannelTransactionParameters as nativeDirectedChannelTransactionParametersImport;
 }
 
 use lightning::ln::chan_utils::DirectedChannelTransactionParameters as nativeDirectedChannelTransactionParametersImport;
-pub(crate) type nativeDirectedChannelTransactionParameters = nativeDirectedChannelTransactionParametersImport<'static>;
+pub(crate) type nativeDirectedChannelTransactionParameters = nativeDirectedChannelTransactionParametersImport<'static>;
 
 /// Static channel fields used to build transactions given per-commitment fields, organized by
 /// broadcaster/countersignatory.
 
 /// Static channel fields used to build transactions given per-commitment fields, organized by
 /// broadcaster/countersignatory.
@@ -1410,6 +1464,12 @@ pub struct DirectedChannelTransactionParameters {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for DirectedChannelTransactionParameters {
+       type Target = nativeDirectedChannelTransactionParameters;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for DirectedChannelTransactionParameters { }
+unsafe impl core::marker::Sync for DirectedChannelTransactionParameters { }
 impl Drop for DirectedChannelTransactionParameters {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeDirectedChannelTransactionParameters>::is_null(self.inner) {
 impl Drop for DirectedChannelTransactionParameters {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeDirectedChannelTransactionParameters>::is_null(self.inner) {
@@ -1440,6 +1500,9 @@ impl DirectedChannelTransactionParameters {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 /// Get the channel pubkeys for the broadcaster
 #[must_use]
 }
 /// Get the channel pubkeys for the broadcaster
 #[must_use]
@@ -1488,9 +1551,9 @@ pub extern "C" fn DirectedChannelTransactionParameters_funding_outpoint(this_arg
 /// Whether to use anchors for this channel
 #[must_use]
 #[no_mangle]
 /// Whether to use anchors for this channel
 #[must_use]
 #[no_mangle]
-pub extern "C" fn DirectedChannelTransactionParameters_channel_type_features(this_arg: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters) -> crate::lightning::ln::features::ChannelTypeFeatures {
+pub extern "C" fn DirectedChannelTransactionParameters_channel_type_features(this_arg: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters) -> crate::lightning_types::features::ChannelTypeFeatures {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_type_features();
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_type_features();
-       crate::lightning::ln::features::ChannelTypeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::ChannelTypeFeatures<>) as *mut _) }, is_owned: false }
+       crate::lightning_types::features::ChannelTypeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning_types::features::ChannelTypeFeatures<>) as *mut _) }, is_owned: false }
 }
 
 
 }
 
 
@@ -1515,6 +1578,12 @@ pub struct HolderCommitmentTransaction {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for HolderCommitmentTransaction {
+       type Target = nativeHolderCommitmentTransaction;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for HolderCommitmentTransaction { }
+unsafe impl core::marker::Sync for HolderCommitmentTransaction { }
 impl Drop for HolderCommitmentTransaction {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeHolderCommitmentTransaction>::is_null(self.inner) {
 impl Drop for HolderCommitmentTransaction {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeHolderCommitmentTransaction>::is_null(self.inner) {
@@ -1545,6 +1614,9 @@ impl HolderCommitmentTransaction {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 /// Our counterparty's signature for the transaction
 #[no_mangle]
 }
 /// Our counterparty's signature for the transaction
 #[no_mangle]
@@ -1591,6 +1663,9 @@ pub(crate) extern "C" fn HolderCommitmentTransaction_clone_void(this_ptr: *const
 pub extern "C" fn HolderCommitmentTransaction_clone(orig: &HolderCommitmentTransaction) -> HolderCommitmentTransaction {
        orig.clone()
 }
 pub extern "C" fn HolderCommitmentTransaction_clone(orig: &HolderCommitmentTransaction) -> HolderCommitmentTransaction {
        orig.clone()
 }
+/// Get a string which allows debug introspection of a HolderCommitmentTransaction object
+pub extern "C" fn HolderCommitmentTransaction_debug_str_void(o: *const c_void) -> Str {
+       alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::chan_utils::HolderCommitmentTransaction }).into()}
 #[no_mangle]
 /// Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
 pub extern "C" fn HolderCommitmentTransaction_write(obj: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CVec_u8Z {
 #[no_mangle]
 /// Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
 pub extern "C" fn HolderCommitmentTransaction_write(obj: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CVec_u8Z {
@@ -1598,7 +1673,7 @@ pub extern "C" fn HolderCommitmentTransaction_write(obj: &crate::lightning::ln::
 }
 #[allow(unused)]
 pub(crate) extern "C" fn HolderCommitmentTransaction_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
 }
 #[allow(unused)]
 pub(crate) extern "C" fn HolderCommitmentTransaction_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeHolderCommitmentTransaction) })
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::chan_utils::nativeHolderCommitmentTransaction) })
 }
 #[no_mangle]
 /// Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
 }
 #[no_mangle]
 /// Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
@@ -1637,6 +1712,12 @@ pub struct BuiltCommitmentTransaction {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for BuiltCommitmentTransaction {
+       type Target = nativeBuiltCommitmentTransaction;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for BuiltCommitmentTransaction { }
+unsafe impl core::marker::Sync for BuiltCommitmentTransaction { }
 impl Drop for BuiltCommitmentTransaction {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeBuiltCommitmentTransaction>::is_null(self.inner) {
 impl Drop for BuiltCommitmentTransaction {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeBuiltCommitmentTransaction>::is_null(self.inner) {
@@ -1667,6 +1748,9 @@ impl BuiltCommitmentTransaction {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 /// The commitment transaction
 #[no_mangle]
 }
 /// The commitment transaction
 #[no_mangle]
@@ -1686,7 +1770,7 @@ pub extern "C" fn BuiltCommitmentTransaction_set_transaction(this_ptr: &mut Buil
 #[no_mangle]
 pub extern "C" fn BuiltCommitmentTransaction_get_txid(this_ptr: &BuiltCommitmentTransaction) -> *const [u8; 32] {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().txid;
 #[no_mangle]
 pub extern "C" fn BuiltCommitmentTransaction_get_txid(this_ptr: &BuiltCommitmentTransaction) -> *const [u8; 32] {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().txid;
-       inner_val.as_inner()
+       inner_val.as_ref()
 }
 /// The txid for the commitment transaction.
 ///
 }
 /// The txid for the commitment transaction.
 ///
@@ -1724,6 +1808,9 @@ pub(crate) extern "C" fn BuiltCommitmentTransaction_clone_void(this_ptr: *const
 pub extern "C" fn BuiltCommitmentTransaction_clone(orig: &BuiltCommitmentTransaction) -> BuiltCommitmentTransaction {
        orig.clone()
 }
 pub extern "C" fn BuiltCommitmentTransaction_clone(orig: &BuiltCommitmentTransaction) -> BuiltCommitmentTransaction {
        orig.clone()
 }
+/// Get a string which allows debug introspection of a BuiltCommitmentTransaction object
+pub extern "C" fn BuiltCommitmentTransaction_debug_str_void(o: *const c_void) -> Str {
+       alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::chan_utils::BuiltCommitmentTransaction }).into()}
 #[no_mangle]
 /// Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
 pub extern "C" fn BuiltCommitmentTransaction_write(obj: &crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> crate::c_types::derived::CVec_u8Z {
 #[no_mangle]
 /// Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
 pub extern "C" fn BuiltCommitmentTransaction_write(obj: &crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> crate::c_types::derived::CVec_u8Z {
@@ -1731,7 +1818,7 @@ pub extern "C" fn BuiltCommitmentTransaction_write(obj: &crate::lightning::ln::c
 }
 #[allow(unused)]
 pub(crate) extern "C" fn BuiltCommitmentTransaction_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
 }
 #[allow(unused)]
 pub(crate) extern "C" fn BuiltCommitmentTransaction_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBuiltCommitmentTransaction) })
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::chan_utils::nativeBuiltCommitmentTransaction) })
 }
 #[no_mangle]
 /// Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
 }
 #[no_mangle]
 /// Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
@@ -1746,7 +1833,7 @@ pub extern "C" fn BuiltCommitmentTransaction_read(ser: crate::c_types::u8slice)
 #[must_use]
 #[no_mangle]
 pub extern "C" fn BuiltCommitmentTransaction_get_sighash_all(this_arg: &crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::ThirtyTwoBytes {
 #[must_use]
 #[no_mangle]
 pub extern "C" fn BuiltCommitmentTransaction_get_sighash_all(this_arg: &crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::ThirtyTwoBytes {
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_sighash_all(&::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis);
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_sighash_all(::bitcoin::script::Script::from_bytes(funding_redeemscript.to_slice()), channel_value_satoshis);
        crate::c_types::ThirtyTwoBytes { data: ret.as_ref().clone() }
 }
 
        crate::c_types::ThirtyTwoBytes { data: ret.as_ref().clone() }
 }
 
@@ -1754,7 +1841,7 @@ pub extern "C" fn BuiltCommitmentTransaction_get_sighash_all(this_arg: &crate::l
 #[must_use]
 #[no_mangle]
 pub extern "C" fn BuiltCommitmentTransaction_sign_counterparty_commitment(this_arg: &crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, funding_key: *const [u8; 32], mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::ECDSASignature {
 #[must_use]
 #[no_mangle]
 pub extern "C" fn BuiltCommitmentTransaction_sign_counterparty_commitment(this_arg: &crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, funding_key: *const [u8; 32], mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::ECDSASignature {
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign_counterparty_commitment(&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), &::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis, secp256k1::global::SECP256K1);
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign_counterparty_commitment(&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), ::bitcoin::script::Script::from_bytes(funding_redeemscript.to_slice()), channel_value_satoshis, secp256k1::global::SECP256K1);
        crate::c_types::ECDSASignature::from_rust(&ret)
 }
 
        crate::c_types::ECDSASignature::from_rust(&ret)
 }
 
@@ -1762,7 +1849,7 @@ pub extern "C" fn BuiltCommitmentTransaction_sign_counterparty_commitment(this_a
 #[must_use]
 #[no_mangle]
 pub extern "C" fn BuiltCommitmentTransaction_sign_holder_commitment(this_arg: &crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, funding_key: *const [u8; 32], mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64, entropy_source: &crate::lightning::sign::EntropySource) -> crate::c_types::ECDSASignature {
 #[must_use]
 #[no_mangle]
 pub extern "C" fn BuiltCommitmentTransaction_sign_holder_commitment(this_arg: &crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, funding_key: *const [u8; 32], mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64, entropy_source: &crate::lightning::sign::EntropySource) -> crate::c_types::ECDSASignature {
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign_holder_commitment(&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), &::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis, entropy_source, secp256k1::global::SECP256K1);
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign_holder_commitment(&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), ::bitcoin::script::Script::from_bytes(funding_redeemscript.to_slice()), channel_value_satoshis, entropy_source, secp256k1::global::SECP256K1);
        crate::c_types::ECDSASignature::from_rust(&ret)
 }
 
        crate::c_types::ECDSASignature::from_rust(&ret)
 }
 
@@ -1790,6 +1877,12 @@ pub struct ClosingTransaction {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for ClosingTransaction {
+       type Target = nativeClosingTransaction;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for ClosingTransaction { }
+unsafe impl core::marker::Sync for ClosingTransaction { }
 impl Drop for ClosingTransaction {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeClosingTransaction>::is_null(self.inner) {
 impl Drop for ClosingTransaction {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeClosingTransaction>::is_null(self.inner) {
@@ -1820,6 +1913,9 @@ impl ClosingTransaction {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 impl Clone for ClosingTransaction {
        fn clone(&self) -> Self {
 }
 impl Clone for ClosingTransaction {
        fn clone(&self) -> Self {
@@ -1863,7 +1959,7 @@ pub extern "C" fn ClosingTransaction_eq(a: &ClosingTransaction, b: &ClosingTrans
 #[must_use]
 #[no_mangle]
 pub extern "C" fn ClosingTransaction_new(mut to_holder_value_sat: u64, mut to_counterparty_value_sat: u64, mut to_holder_script: crate::c_types::derived::CVec_u8Z, mut to_counterparty_script: crate::c_types::derived::CVec_u8Z, mut funding_outpoint: crate::lightning::chain::transaction::OutPoint) -> crate::lightning::ln::chan_utils::ClosingTransaction {
 #[must_use]
 #[no_mangle]
 pub extern "C" fn ClosingTransaction_new(mut to_holder_value_sat: u64, mut to_counterparty_value_sat: u64, mut to_holder_script: crate::c_types::derived::CVec_u8Z, mut to_counterparty_script: crate::c_types::derived::CVec_u8Z, mut funding_outpoint: crate::lightning::chain::transaction::OutPoint) -> crate::lightning::ln::chan_utils::ClosingTransaction {
-       let mut ret = lightning::ln::chan_utils::ClosingTransaction::new(to_holder_value_sat, to_counterparty_value_sat, ::bitcoin::blockdata::script::Script::from(to_holder_script.into_rust()), ::bitcoin::blockdata::script::Script::from(to_counterparty_script.into_rust()), crate::c_types::C_to_bitcoin_outpoint(funding_outpoint));
+       let mut ret = lightning::ln::chan_utils::ClosingTransaction::new(to_holder_value_sat, to_counterparty_value_sat, ::bitcoin::script::ScriptBuf::from(to_holder_script.into_rust()), ::bitcoin::script::ScriptBuf::from(to_counterparty_script.into_rust()), crate::c_types::C_to_bitcoin_outpoint(funding_outpoint));
        crate::lightning::ln::chan_utils::ClosingTransaction { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
        crate::lightning::ln::chan_utils::ClosingTransaction { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
@@ -1915,7 +2011,7 @@ pub extern "C" fn ClosingTransaction_to_counterparty_value_sat(this_arg: &crate:
 #[no_mangle]
 pub extern "C" fn ClosingTransaction_to_holder_script(this_arg: &crate::lightning::ln::chan_utils::ClosingTransaction) -> crate::c_types::u8slice {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.to_holder_script();
 #[no_mangle]
 pub extern "C" fn ClosingTransaction_to_holder_script(this_arg: &crate::lightning::ln::chan_utils::ClosingTransaction) -> crate::c_types::u8slice {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.to_holder_script();
-       crate::c_types::u8slice::from_slice(&ret[..])
+       crate::c_types::u8slice::from_slice(ret.as_ref())
 }
 
 /// The destination of the counterparty's output
 }
 
 /// The destination of the counterparty's output
@@ -1923,12 +2019,12 @@ pub extern "C" fn ClosingTransaction_to_holder_script(this_arg: &crate::lightnin
 #[no_mangle]
 pub extern "C" fn ClosingTransaction_to_counterparty_script(this_arg: &crate::lightning::ln::chan_utils::ClosingTransaction) -> crate::c_types::u8slice {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.to_counterparty_script();
 #[no_mangle]
 pub extern "C" fn ClosingTransaction_to_counterparty_script(this_arg: &crate::lightning::ln::chan_utils::ClosingTransaction) -> crate::c_types::u8slice {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.to_counterparty_script();
-       crate::c_types::u8slice::from_slice(&ret[..])
+       crate::c_types::u8slice::from_slice(ret.as_ref())
 }
 
 
 use lightning::ln::chan_utils::TrustedClosingTransaction as nativeTrustedClosingTransactionImport;
 }
 
 
 use lightning::ln::chan_utils::TrustedClosingTransaction as nativeTrustedClosingTransactionImport;
-pub(crate) type nativeTrustedClosingTransaction = nativeTrustedClosingTransactionImport<'static>;
+pub(crate) type nativeTrustedClosingTransaction = nativeTrustedClosingTransactionImport<'static>;
 
 /// A wrapper on ClosingTransaction indicating that the built bitcoin
 /// transaction is trusted.
 
 /// A wrapper on ClosingTransaction indicating that the built bitcoin
 /// transaction is trusted.
@@ -1951,6 +2047,12 @@ pub struct TrustedClosingTransaction {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for TrustedClosingTransaction {
+       type Target = nativeTrustedClosingTransaction;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for TrustedClosingTransaction { }
+unsafe impl core::marker::Sync for TrustedClosingTransaction { }
 impl Drop for TrustedClosingTransaction {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeTrustedClosingTransaction>::is_null(self.inner) {
 impl Drop for TrustedClosingTransaction {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeTrustedClosingTransaction>::is_null(self.inner) {
@@ -1981,6 +2083,9 @@ impl TrustedClosingTransaction {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 /// The pre-built Bitcoin commitment transaction
 #[must_use]
 }
 /// The pre-built Bitcoin commitment transaction
 #[must_use]
@@ -1996,7 +2101,7 @@ pub extern "C" fn TrustedClosingTransaction_built_transaction(this_arg: &crate::
 #[must_use]
 #[no_mangle]
 pub extern "C" fn TrustedClosingTransaction_get_sighash_all(this_arg: &crate::lightning::ln::chan_utils::TrustedClosingTransaction, mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::ThirtyTwoBytes {
 #[must_use]
 #[no_mangle]
 pub extern "C" fn TrustedClosingTransaction_get_sighash_all(this_arg: &crate::lightning::ln::chan_utils::TrustedClosingTransaction, mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::ThirtyTwoBytes {
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_sighash_all(&::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis);
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_sighash_all(::bitcoin::script::Script::from_bytes(funding_redeemscript.to_slice()), channel_value_satoshis);
        crate::c_types::ThirtyTwoBytes { data: ret.as_ref().clone() }
 }
 
        crate::c_types::ThirtyTwoBytes { data: ret.as_ref().clone() }
 }
 
@@ -2005,7 +2110,7 @@ pub extern "C" fn TrustedClosingTransaction_get_sighash_all(this_arg: &crate::li
 #[must_use]
 #[no_mangle]
 pub extern "C" fn TrustedClosingTransaction_sign(this_arg: &crate::lightning::ln::chan_utils::TrustedClosingTransaction, funding_key: *const [u8; 32], mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::ECDSASignature {
 #[must_use]
 #[no_mangle]
 pub extern "C" fn TrustedClosingTransaction_sign(this_arg: &crate::lightning::ln::chan_utils::TrustedClosingTransaction, funding_key: *const [u8; 32], mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::ECDSASignature {
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign(&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), &::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis, secp256k1::global::SECP256K1);
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign(&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), ::bitcoin::script::Script::from_bytes(funding_redeemscript.to_slice()), channel_value_satoshis, secp256k1::global::SECP256K1);
        crate::c_types::ECDSASignature::from_rust(&ret)
 }
 
        crate::c_types::ECDSASignature::from_rust(&ret)
 }
 
@@ -2034,6 +2139,12 @@ pub struct CommitmentTransaction {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for CommitmentTransaction {
+       type Target = nativeCommitmentTransaction;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for CommitmentTransaction { }
+unsafe impl core::marker::Sync for CommitmentTransaction { }
 impl Drop for CommitmentTransaction {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeCommitmentTransaction>::is_null(self.inner) {
 impl Drop for CommitmentTransaction {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeCommitmentTransaction>::is_null(self.inner) {
@@ -2064,6 +2175,9 @@ impl CommitmentTransaction {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 impl Clone for CommitmentTransaction {
        fn clone(&self) -> Self {
 }
 impl Clone for CommitmentTransaction {
        fn clone(&self) -> Self {
@@ -2084,6 +2198,9 @@ pub(crate) extern "C" fn CommitmentTransaction_clone_void(this_ptr: *const c_voi
 pub extern "C" fn CommitmentTransaction_clone(orig: &CommitmentTransaction) -> CommitmentTransaction {
        orig.clone()
 }
 pub extern "C" fn CommitmentTransaction_clone(orig: &CommitmentTransaction) -> CommitmentTransaction {
        orig.clone()
 }
+/// Get a string which allows debug introspection of a CommitmentTransaction object
+pub extern "C" fn CommitmentTransaction_debug_str_void(o: *const c_void) -> Str {
+       alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::chan_utils::CommitmentTransaction }).into()}
 #[no_mangle]
 /// Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
 pub extern "C" fn CommitmentTransaction_write(obj: &crate::lightning::ln::chan_utils::CommitmentTransaction) -> crate::c_types::derived::CVec_u8Z {
 #[no_mangle]
 /// Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
 pub extern "C" fn CommitmentTransaction_write(obj: &crate::lightning::ln::chan_utils::CommitmentTransaction) -> crate::c_types::derived::CVec_u8Z {
@@ -2091,7 +2208,7 @@ pub extern "C" fn CommitmentTransaction_write(obj: &crate::lightning::ln::chan_u
 }
 #[allow(unused)]
 pub(crate) extern "C" fn CommitmentTransaction_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
 }
 #[allow(unused)]
 pub(crate) extern "C" fn CommitmentTransaction_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeCommitmentTransaction) })
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::chan_utils::nativeCommitmentTransaction) })
 }
 #[no_mangle]
 /// Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
 }
 #[no_mangle]
 /// Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
@@ -2169,7 +2286,7 @@ pub extern "C" fn CommitmentTransaction_verify(this_arg: &crate::lightning::ln::
 
 
 use lightning::ln::chan_utils::TrustedCommitmentTransaction as nativeTrustedCommitmentTransactionImport;
 
 
 use lightning::ln::chan_utils::TrustedCommitmentTransaction as nativeTrustedCommitmentTransactionImport;
-pub(crate) type nativeTrustedCommitmentTransaction = nativeTrustedCommitmentTransactionImport<'static>;
+pub(crate) type nativeTrustedCommitmentTransaction = nativeTrustedCommitmentTransactionImport<'static>;
 
 /// A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
 /// transaction and the transaction creation keys) are trusted.
 
 /// A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
 /// transaction and the transaction creation keys) are trusted.
@@ -2192,6 +2309,12 @@ pub struct TrustedCommitmentTransaction {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for TrustedCommitmentTransaction {
+       type Target = nativeTrustedCommitmentTransaction;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for TrustedCommitmentTransaction { }
+unsafe impl core::marker::Sync for TrustedCommitmentTransaction { }
 impl Drop for TrustedCommitmentTransaction {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeTrustedCommitmentTransaction>::is_null(self.inner) {
 impl Drop for TrustedCommitmentTransaction {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeTrustedCommitmentTransaction>::is_null(self.inner) {
@@ -2222,13 +2345,16 @@ impl TrustedCommitmentTransaction {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 /// The transaction ID of the built Bitcoin transaction
 #[must_use]
 #[no_mangle]
 pub extern "C" fn TrustedCommitmentTransaction_txid(this_arg: &crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> crate::c_types::ThirtyTwoBytes {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.txid();
 }
 /// The transaction ID of the built Bitcoin transaction
 #[must_use]
 #[no_mangle]
 pub extern "C" fn TrustedCommitmentTransaction_txid(this_arg: &crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> crate::c_types::ThirtyTwoBytes {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.txid();
-       crate::c_types::ThirtyTwoBytes { data: ret.into_inner() }
+       crate::c_types::ThirtyTwoBytes { data: *ret.as_ref() }
 }
 
 /// The pre-built Bitcoin commitment transaction
 }
 
 /// The pre-built Bitcoin commitment transaction
@@ -2250,9 +2376,9 @@ pub extern "C" fn TrustedCommitmentTransaction_keys(this_arg: &crate::lightning:
 /// Should anchors be used.
 #[must_use]
 #[no_mangle]
 /// Should anchors be used.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn TrustedCommitmentTransaction_channel_type_features(this_arg: &crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> crate::lightning::ln::features::ChannelTypeFeatures {
+pub extern "C" fn TrustedCommitmentTransaction_channel_type_features(this_arg: &crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> crate::lightning_types::features::ChannelTypeFeatures {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_type_features();
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_type_features();
-       crate::lightning::ln::features::ChannelTypeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::ChannelTypeFeatures<>) as *mut _) }, is_owned: false }
+       crate::lightning_types::features::ChannelTypeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning_types::features::ChannelTypeFeatures<>) as *mut _) }, is_owned: false }
 }
 
 /// Get a signature for each HTLC which was included in the commitment transaction (ie for
 }
 
 /// Get a signature for each HTLC which was included in the commitment transaction (ie for
@@ -2300,7 +2426,7 @@ pub extern "C" fn TrustedCommitmentTransaction_revokeable_output_index(this_arg:
 #[must_use]
 #[no_mangle]
 pub extern "C" fn TrustedCommitmentTransaction_build_to_local_justice_tx(this_arg: &crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, mut feerate_per_kw: u64, mut destination_script: crate::c_types::derived::CVec_u8Z) -> crate::c_types::derived::CResult_TransactionNoneZ {
 #[must_use]
 #[no_mangle]
 pub extern "C" fn TrustedCommitmentTransaction_build_to_local_justice_tx(this_arg: &crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, mut feerate_per_kw: u64, mut destination_script: crate::c_types::derived::CVec_u8Z) -> crate::c_types::derived::CResult_TransactionNoneZ {
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.build_to_local_justice_tx(feerate_per_kw, ::bitcoin::blockdata::script::Script::from(destination_script.into_rust()));
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.build_to_local_justice_tx(feerate_per_kw, ::bitcoin::script::ScriptBuf::from(destination_script.into_rust()));
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Transaction::from_bitcoin(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
        local_ret
 }
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Transaction::from_bitcoin(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
        local_ret
 }