]> git.bitcoin.ninja Git - ldk-c-bindings/blobdiff - lightning-c-bindings/src/lightning/ln/features.rs
Add missing `rustc` `metadata` override for `lightning_types`
[ldk-c-bindings] / lightning-c-bindings / src / lightning / ln / features.rs
index f74b3909f1ee7e66949336936717ff253c38d00d..985db0d4fb77d1256d12cf177713778014c7310e 100644 (file)
 
 //! Feature flag definitions for the Lightning protocol according to [BOLT #9].
 //!
 
 //! Feature flag definitions for the Lightning protocol according to [BOLT #9].
 //!
-//! Lightning nodes advertise a supported set of operation through feature flags. Features are
-//! applicable for a specific context as indicated in some [messages]. [`Features`] encapsulates
-//! behavior for specifying and checking feature flags for a particular context. Each feature is
-//! defined internally by a trait specifying the corresponding flags (i.e., even and odd bits).
+//! See [`lightning_types::features`] for the list of features currently supported.
 //!
 //!
-//! Whether a feature is considered \"known\" or \"unknown\" is relative to the implementation, whereas
-//! the term \"supports\" is used in reference to a particular set of [`Features`]. That is, a node
-//! supports a feature if it advertises the feature (as either required or optional) to its peers.
-//! And the implementation can interpret a feature if the feature is known to it.
+//! Note that the use of types via this module is deprecated and will be removed in a future
+//! version. Instead, use feature objects via [`lightning::types::features`].
 //!
 //!
-//! [BOLT #9]: https://github.com/lightningnetwork/lightning-rfc/blob/master/09-features.md
-//! [messages]: crate::ln::msgs
+//! [`lightning::types::features`]: crate::types::features
+//! [BOLT #9]: https://github.com/lightning/bolts/blob/master/09-features.md
 
 
-use std::str::FromStr;
-use std::ffi::c_void;
+use alloc::str::FromStr;
+use alloc::string::String;
+use core::ffi::c_void;
 use core::convert::Infallible;
 use bitcoin::hashes::Hash;
 use crate::c_types::*;
 use core::convert::Infallible;
 use bitcoin::hashes::Hash;
 use crate::c_types::*;
+#[cfg(feature="no-std")]
+use alloc::{vec::Vec, boxed::Box};
 
 
-mod sealed {
-
-use std::str::FromStr;
-use std::ffi::c_void;
-use core::convert::Infallible;
-use bitcoin::hashes::Hash;
-use crate::c_types::*;
-
-}
-/// Checks if two InitFeaturess contain equal inner contents.
-/// This ignores pointers and is_owned flags and looks at the values in fields.
-/// Two objects with NULL inner values will be considered "equal" here.
-#[no_mangle]
-pub extern "C" fn InitFeatures_eq(a: &InitFeatures, b: &InitFeatures) -> bool {
-       if a.inner == b.inner { return true; }
-       if a.inner.is_null() || b.inner.is_null() { return false; }
-       if a.get_native_ref() == b.get_native_ref() { true } else { false }
-}
-/// Checks if two NodeFeaturess contain equal inner contents.
-/// This ignores pointers and is_owned flags and looks at the values in fields.
-/// Two objects with NULL inner values will be considered "equal" here.
-#[no_mangle]
-pub extern "C" fn NodeFeatures_eq(a: &NodeFeatures, b: &NodeFeatures) -> bool {
-       if a.inner == b.inner { return true; }
-       if a.inner.is_null() || b.inner.is_null() { return false; }
-       if a.get_native_ref() == b.get_native_ref() { true } else { false }
-}
-/// Checks if two ChannelFeaturess contain equal inner contents.
-/// This ignores pointers and is_owned flags and looks at the values in fields.
-/// Two objects with NULL inner values will be considered "equal" here.
 #[no_mangle]
 #[no_mangle]
-pub extern "C" fn ChannelFeatures_eq(a: &ChannelFeatures, b: &ChannelFeatures) -> bool {
-       if a.inner == b.inner { return true; }
-       if a.inner.is_null() || b.inner.is_null() { return false; }
-       if a.get_native_ref() == b.get_native_ref() { true } else { false }
-}
-/// Checks if two InvoiceFeaturess contain equal inner contents.
-/// This ignores pointers and is_owned flags and looks at the values in fields.
-/// Two objects with NULL inner values will be considered "equal" here.
-#[no_mangle]
-pub extern "C" fn InvoiceFeatures_eq(a: &InvoiceFeatures, b: &InvoiceFeatures) -> bool {
-       if a.inner == b.inner { return true; }
-       if a.inner.is_null() || b.inner.is_null() { return false; }
-       if a.get_native_ref() == b.get_native_ref() { true } else { false }
-}
-impl Clone for InitFeatures {
-       fn clone(&self) -> Self {
-               Self {
-                       inner: if <*mut nativeInitFeatures>::is_null(self.inner) { std::ptr::null_mut() } else {
-                               ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
-                       is_owned: true,
-               }
-       }
-}
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn InitFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
-       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInitFeatures)).clone() })) as *mut c_void
-}
-#[no_mangle]
-/// Creates a copy of the InitFeatures
-pub extern "C" fn InitFeatures_clone(orig: &InitFeatures) -> InitFeatures {
-       orig.clone()
-}
-impl Clone for NodeFeatures {
-       fn clone(&self) -> Self {
-               Self {
-                       inner: if <*mut nativeNodeFeatures>::is_null(self.inner) { std::ptr::null_mut() } else {
-                               ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
-                       is_owned: true,
-               }
-       }
+/// Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
+pub extern "C" fn InitFeatures_write(obj: &crate::lightning_types::features::InitFeatures) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
 #[allow(unused)]
 }
 #[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn NodeFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
-       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeFeatures)).clone() })) as *mut c_void
+pub(crate) extern "C" fn InitFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeInitFeatures) })
 }
 #[no_mangle]
 }
 #[no_mangle]
-/// Creates a copy of the NodeFeatures
-pub extern "C" fn NodeFeatures_clone(orig: &NodeFeatures) -> NodeFeatures {
-       orig.clone()
-}
-impl Clone for ChannelFeatures {
-       fn clone(&self) -> Self {
-               Self {
-                       inner: if <*mut nativeChannelFeatures>::is_null(self.inner) { std::ptr::null_mut() } else {
-                               ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
-                       is_owned: true,
-               }
-       }
-}
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn ChannelFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
-       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelFeatures)).clone() })) as *mut c_void
+/// Read a InitFeatures from a byte array, created by InitFeatures_write
+pub extern "C" fn InitFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitFeaturesDecodeErrorZ {
+       let res: Result<lightning_types::features::InitFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
+       local_res
 }
 #[no_mangle]
 }
 #[no_mangle]
-/// Creates a copy of the ChannelFeatures
-pub extern "C" fn ChannelFeatures_clone(orig: &ChannelFeatures) -> ChannelFeatures {
-       orig.clone()
-}
-impl Clone for InvoiceFeatures {
-       fn clone(&self) -> Self {
-               Self {
-                       inner: if <*mut nativeInvoiceFeatures>::is_null(self.inner) { std::ptr::null_mut() } else {
-                               ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
-                       is_owned: true,
-               }
-       }
+/// Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
+pub extern "C" fn ChannelFeatures_write(obj: &crate::lightning_types::features::ChannelFeatures) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
 #[allow(unused)]
 }
 #[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn InvoiceFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
-       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInvoiceFeatures)).clone() })) as *mut c_void
-}
-#[no_mangle]
-/// Creates a copy of the InvoiceFeatures
-pub extern "C" fn InvoiceFeatures_clone(orig: &InvoiceFeatures) -> InvoiceFeatures {
-       orig.clone()
-}
-
-use lightning::ln::features::InitFeatures as nativeInitFeaturesImport;
-type nativeInitFeatures = nativeInitFeaturesImport;
-
-/// Features used within an `init` message.
-#[must_use]
-#[repr(C)]
-pub struct InitFeatures {
-       /// A pointer to the opaque Rust object.
-
-       /// Nearly everywhere, inner must be non-null, however in places where
-       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
-       pub inner: *mut nativeInitFeatures,
-       /// Indicates that this is the only struct which contains the same pointer.
-
-       /// Rust functions which take ownership of an object provided via an argument require
-       /// this to be true and invalidate the object pointed to by inner.
-       pub is_owned: bool,
-}
-
-impl Drop for InitFeatures {
-       fn drop(&mut self) {
-               if self.is_owned && !<*mut nativeInitFeatures>::is_null(self.inner) {
-                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
-               }
-       }
+pub(crate) extern "C" fn ChannelFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeChannelFeatures) })
 }
 }
-/// Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
 #[no_mangle]
 #[no_mangle]
-pub extern "C" fn InitFeatures_free(this_obj: InitFeatures) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn InitFeatures_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInitFeatures); }
-}
-#[allow(unused)]
-impl InitFeatures {
-       pub(crate) fn get_native_ref(&self) -> &'static nativeInitFeatures {
-               unsafe { &*ObjOps::untweak_ptr(self.inner) }
-       }
-       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeInitFeatures {
-               unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
-       }
-       /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
-       pub(crate) fn take_inner(mut self) -> *mut nativeInitFeatures {
-               assert!(self.is_owned);
-               let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
-               ret
-       }
-}
-
-use lightning::ln::features::NodeFeatures as nativeNodeFeaturesImport;
-type nativeNodeFeatures = nativeNodeFeaturesImport;
-
-/// Features used within a `node_announcement` message.
-#[must_use]
-#[repr(C)]
-pub struct NodeFeatures {
-       /// A pointer to the opaque Rust object.
-
-       /// Nearly everywhere, inner must be non-null, however in places where
-       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
-       pub inner: *mut nativeNodeFeatures,
-       /// Indicates that this is the only struct which contains the same pointer.
-
-       /// Rust functions which take ownership of an object provided via an argument require
-       /// this to be true and invalidate the object pointed to by inner.
-       pub is_owned: bool,
-}
-
-impl Drop for NodeFeatures {
-       fn drop(&mut self) {
-               if self.is_owned && !<*mut nativeNodeFeatures>::is_null(self.inner) {
-                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
-               }
-       }
+/// Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
+pub extern "C" fn ChannelFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelFeaturesDecodeErrorZ {
+       let res: Result<lightning_types::features::ChannelFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_types::features::ChannelFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
+       local_res
 }
 }
-/// Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
 #[no_mangle]
 #[no_mangle]
-pub extern "C" fn NodeFeatures_free(this_obj: NodeFeatures) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn NodeFeatures_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeFeatures); }
+/// Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
+pub extern "C" fn NodeFeatures_write(obj: &crate::lightning_types::features::NodeFeatures) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
 #[allow(unused)]
 }
 #[allow(unused)]
-impl NodeFeatures {
-       pub(crate) fn get_native_ref(&self) -> &'static nativeNodeFeatures {
-               unsafe { &*ObjOps::untweak_ptr(self.inner) }
-       }
-       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNodeFeatures {
-               unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
-       }
-       /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
-       pub(crate) fn take_inner(mut self) -> *mut nativeNodeFeatures {
-               assert!(self.is_owned);
-               let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
-               ret
-       }
-}
-
-use lightning::ln::features::ChannelFeatures as nativeChannelFeaturesImport;
-type nativeChannelFeatures = nativeChannelFeaturesImport;
-
-/// Features used within a `channel_announcement` message.
-#[must_use]
-#[repr(C)]
-pub struct ChannelFeatures {
-       /// A pointer to the opaque Rust object.
-
-       /// Nearly everywhere, inner must be non-null, however in places where
-       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
-       pub inner: *mut nativeChannelFeatures,
-       /// Indicates that this is the only struct which contains the same pointer.
-
-       /// Rust functions which take ownership of an object provided via an argument require
-       /// this to be true and invalidate the object pointed to by inner.
-       pub is_owned: bool,
-}
-
-impl Drop for ChannelFeatures {
-       fn drop(&mut self) {
-               if self.is_owned && !<*mut nativeChannelFeatures>::is_null(self.inner) {
-                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
-               }
-       }
+pub(crate) extern "C" fn NodeFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeNodeFeatures) })
 }
 }
-/// Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
 #[no_mangle]
 #[no_mangle]
-pub extern "C" fn ChannelFeatures_free(this_obj: ChannelFeatures) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn ChannelFeatures_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelFeatures); }
-}
-#[allow(unused)]
-impl ChannelFeatures {
-       pub(crate) fn get_native_ref(&self) -> &'static nativeChannelFeatures {
-               unsafe { &*ObjOps::untweak_ptr(self.inner) }
-       }
-       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelFeatures {
-               unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
-       }
-       /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
-       pub(crate) fn take_inner(mut self) -> *mut nativeChannelFeatures {
-               assert!(self.is_owned);
-               let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
-               ret
-       }
-}
-
-use lightning::ln::features::InvoiceFeatures as nativeInvoiceFeaturesImport;
-type nativeInvoiceFeatures = nativeInvoiceFeaturesImport;
-
-/// Features used within an invoice.
-#[must_use]
-#[repr(C)]
-pub struct InvoiceFeatures {
-       /// A pointer to the opaque Rust object.
-
-       /// Nearly everywhere, inner must be non-null, however in places where
-       /// the Rust equivalent takes an Option, it may be set to null to indicate None.
-       pub inner: *mut nativeInvoiceFeatures,
-       /// Indicates that this is the only struct which contains the same pointer.
-
-       /// Rust functions which take ownership of an object provided via an argument require
-       /// this to be true and invalidate the object pointed to by inner.
-       pub is_owned: bool,
-}
-
-impl Drop for InvoiceFeatures {
-       fn drop(&mut self) {
-               if self.is_owned && !<*mut nativeInvoiceFeatures>::is_null(self.inner) {
-                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
-               }
-       }
+/// Read a NodeFeatures from a byte array, created by NodeFeatures_write
+pub extern "C" fn NodeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeFeaturesDecodeErrorZ {
+       let res: Result<lightning_types::features::NodeFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
+       local_res
 }
 }
-/// Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
 #[no_mangle]
 #[no_mangle]
-pub extern "C" fn InvoiceFeatures_free(this_obj: InvoiceFeatures) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn InvoiceFeatures_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInvoiceFeatures); }
+/// Serialize the Bolt11InvoiceFeatures object into a byte array which can be read by Bolt11InvoiceFeatures_read
+pub extern "C" fn Bolt11InvoiceFeatures_write(obj: &crate::lightning_types::features::Bolt11InvoiceFeatures) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
 #[allow(unused)]
 }
 #[allow(unused)]
-impl InvoiceFeatures {
-       pub(crate) fn get_native_ref(&self) -> &'static nativeInvoiceFeatures {
-               unsafe { &*ObjOps::untweak_ptr(self.inner) }
-       }
-       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeInvoiceFeatures {
-               unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
-       }
-       /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
-       pub(crate) fn take_inner(mut self) -> *mut nativeInvoiceFeatures {
-               assert!(self.is_owned);
-               let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
-               ret
-       }
-}
-/// Create a blank Features with no features set
-#[must_use]
-#[no_mangle]
-pub extern "C" fn InitFeatures_empty() -> InitFeatures {
-       let mut ret = lightning::ln::features::InitFeatures::empty();
-       InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// Creates a Features with the bits set which are known by the implementation
-#[must_use]
-#[no_mangle]
-pub extern "C" fn InitFeatures_known() -> InitFeatures {
-       let mut ret = lightning::ln::features::InitFeatures::known();
-       InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// Returns true if this `Features` object contains unknown feature flags which are set as
-/// \"required\".
-#[must_use]
-#[no_mangle]
-pub extern "C" fn InitFeatures_requires_unknown_bits(this_arg: &InitFeatures) -> bool {
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits();
-       ret
-}
-
-/// Create a blank Features with no features set
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NodeFeatures_empty() -> NodeFeatures {
-       let mut ret = lightning::ln::features::NodeFeatures::empty();
-       NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// Creates a Features with the bits set which are known by the implementation
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NodeFeatures_known() -> NodeFeatures {
-       let mut ret = lightning::ln::features::NodeFeatures::known();
-       NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// Returns true if this `Features` object contains unknown feature flags which are set as
-/// \"required\".
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NodeFeatures_requires_unknown_bits(this_arg: &NodeFeatures) -> bool {
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits();
-       ret
-}
-
-/// Create a blank Features with no features set
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelFeatures_empty() -> ChannelFeatures {
-       let mut ret = lightning::ln::features::ChannelFeatures::empty();
-       ChannelFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// Creates a Features with the bits set which are known by the implementation
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelFeatures_known() -> ChannelFeatures {
-       let mut ret = lightning::ln::features::ChannelFeatures::known();
-       ChannelFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// Returns true if this `Features` object contains unknown feature flags which are set as
-/// \"required\".
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelFeatures_requires_unknown_bits(this_arg: &ChannelFeatures) -> bool {
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits();
-       ret
-}
-
-/// Create a blank Features with no features set
-#[must_use]
-#[no_mangle]
-pub extern "C" fn InvoiceFeatures_empty() -> InvoiceFeatures {
-       let mut ret = lightning::ln::features::InvoiceFeatures::empty();
-       InvoiceFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// Creates a Features with the bits set which are known by the implementation
-#[must_use]
-#[no_mangle]
-pub extern "C" fn InvoiceFeatures_known() -> InvoiceFeatures {
-       let mut ret = lightning::ln::features::InvoiceFeatures::known();
-       InvoiceFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// Returns true if this `Features` object contains unknown feature flags which are set as
-/// \"required\".
-#[must_use]
-#[no_mangle]
-pub extern "C" fn InvoiceFeatures_requires_unknown_bits(this_arg: &InvoiceFeatures) -> bool {
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits();
-       ret
-}
-
-/// Returns whether the `payment_secret` feature is supported.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn InitFeatures_supports_payment_secret(this_arg: &InitFeatures) -> bool {
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_secret();
-       ret
-}
-
-/// Returns whether the `payment_secret` feature is supported.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn NodeFeatures_supports_payment_secret(this_arg: &NodeFeatures) -> bool {
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_secret();
-       ret
+pub(crate) extern "C" fn Bolt11InvoiceFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeBolt11InvoiceFeatures) })
 }
 }
-
-/// Returns whether the `payment_secret` feature is supported.
-#[must_use]
 #[no_mangle]
 #[no_mangle]
-pub extern "C" fn InvoiceFeatures_supports_payment_secret(this_arg: &InvoiceFeatures) -> bool {
-       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_secret();
-       ret
-}
-
-#[no_mangle]
-/// Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
-pub extern "C" fn InitFeatures_write(obj: &InitFeatures) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-pub(crate) extern "C" fn InitFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInitFeatures) })
+/// Read a Bolt11InvoiceFeatures from a byte array, created by Bolt11InvoiceFeatures_write
+pub extern "C" fn Bolt11InvoiceFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
+       let res: Result<lightning_types::features::Bolt11InvoiceFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_types::features::Bolt11InvoiceFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
+       local_res
 }
 #[no_mangle]
 }
 #[no_mangle]
-/// Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
-pub extern "C" fn NodeFeatures_write(obj: &NodeFeatures) -> crate::c_types::derived::CVec_u8Z {
+/// Serialize the Bolt12InvoiceFeatures object into a byte array which can be read by Bolt12InvoiceFeatures_read
+pub extern "C" fn Bolt12InvoiceFeatures_write(obj: &crate::lightning_types::features::Bolt12InvoiceFeatures) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
-#[no_mangle]
-pub(crate) extern "C" fn NodeFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeFeatures) })
-}
-#[no_mangle]
-/// Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
-pub extern "C" fn ChannelFeatures_write(obj: &ChannelFeatures) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+#[allow(unused)]
+pub(crate) extern "C" fn Bolt12InvoiceFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeBolt12InvoiceFeatures) })
 }
 #[no_mangle]
 }
 #[no_mangle]
-pub(crate) extern "C" fn ChannelFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelFeatures) })
+/// Read a Bolt12InvoiceFeatures from a byte array, created by Bolt12InvoiceFeatures_write
+pub extern "C" fn Bolt12InvoiceFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
+       let res: Result<lightning_types::features::Bolt12InvoiceFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_types::features::Bolt12InvoiceFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
+       local_res
 }
 #[no_mangle]
 }
 #[no_mangle]
-/// Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
-pub extern "C" fn InvoiceFeatures_write(obj: &InvoiceFeatures) -> crate::c_types::derived::CVec_u8Z {
+/// Serialize the BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read
+pub extern "C" fn BlindedHopFeatures_write(obj: &crate::lightning_types::features::BlindedHopFeatures) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
-#[no_mangle]
-pub(crate) extern "C" fn InvoiceFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInvoiceFeatures) })
+#[allow(unused)]
+pub(crate) extern "C" fn BlindedHopFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeBlindedHopFeatures) })
 }
 #[no_mangle]
 }
 #[no_mangle]
-/// Read a InitFeatures from a byte array, created by InitFeatures_write
-pub extern "C" fn InitFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitFeaturesDecodeErrorZ {
-       let res = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+/// Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write
+pub extern "C" fn BlindedHopFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_BlindedHopFeaturesDecodeErrorZ {
+       let res: Result<lightning_types::features::BlindedHopFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_types::features::BlindedHopFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 #[no_mangle]
        local_res
 }
 #[no_mangle]
-/// Read a NodeFeatures from a byte array, created by NodeFeatures_write
-pub extern "C" fn NodeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeFeaturesDecodeErrorZ {
-       let res = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
-       local_res
+/// Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
+pub extern "C" fn ChannelTypeFeatures_write(obj: &crate::lightning_types::features::ChannelTypeFeatures) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
 }
-#[no_mangle]
-/// Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
-pub extern "C" fn ChannelFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelFeaturesDecodeErrorZ {
-       let res = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
-       local_res
+#[allow(unused)]
+pub(crate) extern "C" fn ChannelTypeFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeChannelTypeFeatures) })
 }
 #[no_mangle]
 }
 #[no_mangle]
-/// Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
-pub extern "C" fn InvoiceFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InvoiceFeaturesDecodeErrorZ {
-       let res = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InvoiceFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+/// Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
+pub extern "C" fn ChannelTypeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelTypeFeaturesDecodeErrorZ {
+       let res: Result<lightning_types::features::ChannelTypeFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_types::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
        local_res
 }