Update C/C++ demos to latest upstream API
[ldk-c-bindings] / lightning-c-bindings / src / lightning / routing / network_graph.rs
index 2f939ba61e356e2b8f97324226091f817edfa450..8f509c447d7c760e8acdc30b4d489b5f27c9af1c 100644 (file)
@@ -8,11 +8,13 @@
 
 //! The top-level network map tracking logic lives here.
 
-use std::str::FromStr;
-use std::ffi::c_void;
+use alloc::str::FromStr;
+use core::ffi::c_void;
 use core::convert::Infallible;
 use bitcoin::hashes::Hash;
 use crate::c_types::*;
+#[cfg(feature="no-std")]
+use alloc::{vec::Vec, boxed::Box};
 
 
 use lightning::routing::network_graph::NodeId as nativeNodeIdImport;
@@ -61,14 +63,14 @@ impl NodeId {
        pub(crate) fn take_inner(mut self) -> *mut nativeNodeId {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
 impl Clone for NodeId {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeNodeId>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeNodeId>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -87,15 +89,15 @@ pub extern "C" fn NodeId_clone(orig: &NodeId) -> NodeId {
 /// Create a new NodeId from a public key
 #[must_use]
 #[no_mangle]
-pub extern "C" fn NodeId_from_pubkey(mut pubkey: crate::c_types::PublicKey) -> NodeId {
+pub extern "C" fn NodeId_from_pubkey(mut pubkey: crate::c_types::PublicKey) -> crate::lightning::routing::network_graph::NodeId {
        let mut ret = lightning::routing::network_graph::NodeId::from_pubkey(&pubkey.into_rust());
-       NodeId { inner: ObjOps::heap_alloc(ret), is_owned: true }
+       crate::lightning::routing::network_graph::NodeId { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
 /// Get the public key slice from this NodeId
 #[must_use]
 #[no_mangle]
-pub extern "C" fn NodeId_as_slice(this_arg: &NodeId) -> crate::c_types::u8slice {
+pub extern "C" fn NodeId_as_slice(this_arg: &crate::lightning::routing::network_graph::NodeId) -> crate::c_types::u8slice {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_slice();
        let mut local_ret = crate::c_types::u8slice::from_slice(ret);
        local_ret
@@ -105,15 +107,15 @@ pub extern "C" fn NodeId_as_slice(this_arg: &NodeId) -> crate::c_types::u8slice
 #[no_mangle]
 pub extern "C" fn NodeId_hash(o: &NodeId) -> u64 {
        if o.inner.is_null() { return 0; }
-       // Note that we'd love to use std::collections::hash_map::DefaultHasher but it's not in core
+       // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
        #[allow(deprecated)]
        let mut hasher = core::hash::SipHasher::new();
-       std::hash::Hash::hash(o.get_native_ref(), &mut hasher);
-       std::hash::Hasher::finish(&hasher)
+       core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+       core::hash::Hasher::finish(&hasher)
 }
 #[no_mangle]
 /// Serialize the NodeId object into a byte array which can be read by NodeId_read
-pub extern "C" fn NodeId_write(obj: &NodeId) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn NodeId_write(obj: &crate::lightning::routing::network_graph::NodeId) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
 #[no_mangle]
@@ -123,7 +125,7 @@ pub(crate) extern "C" fn NodeId_write_void(obj: *const c_void) -> crate::c_types
 #[no_mangle]
 /// Read a NodeId from a byte array, created by NodeId_write
 pub extern "C" fn NodeId_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeIdDecodeErrorZ {
-       let res = crate::c_types::deserialize_obj(ser);
+       let res: Result<lightning::routing::network_graph::NodeId, 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::routing::network_graph::NodeId { 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
 }
@@ -174,14 +176,14 @@ impl NetworkGraph {
        pub(crate) fn take_inner(mut self) -> *mut nativeNetworkGraph {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
 impl Clone for NetworkGraph {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeNetworkGraph>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeNetworkGraph>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -244,7 +246,7 @@ impl ReadOnlyNetworkGraph {
        pub(crate) fn take_inner(mut self) -> *mut nativeReadOnlyNetworkGraph {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -415,15 +417,22 @@ pub extern "C" fn NetworkUpdate_node_failure(node_id: crate::c_types::PublicKey,
 }
 #[no_mangle]
 /// Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
-pub extern "C" fn NetworkUpdate_write(obj: &NetworkUpdate) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn NetworkUpdate_write(obj: &crate::lightning::routing::network_graph::NetworkUpdate) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
 }
+#[no_mangle]
+/// Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
+pub extern "C" fn NetworkUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_NetworkUpdateZDecodeErrorZ {
+       let res: Result<Option<lightning::routing::network_graph::NetworkUpdate>, lightning::ln::msgs::DecodeError> = crate::c_types::maybe_deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_NetworkUpdateZ::None } else { crate::c_types::derived::COption_NetworkUpdateZ::Some( { crate::lightning::routing::network_graph::NetworkUpdate::native_into(o.unwrap()) }) }; local_res_0 }).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
+}
 impl From<nativeNetGraphMsgHandler> for crate::lightning::util::events::EventHandler {
        fn from(obj: nativeNetGraphMsgHandler) -> Self {
                let mut rust_obj = NetGraphMsgHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
                let mut ret = NetGraphMsgHandler_as_EventHandler(&rust_obj);
                // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn
-               rust_obj.inner = std::ptr::null_mut();
+               rust_obj.inner = core::ptr::null_mut();
                ret.free = Some(NetGraphMsgHandler_free_void);
                ret
        }
@@ -497,7 +506,7 @@ impl NetGraphMsgHandler {
        pub(crate) fn take_inner(mut self) -> *mut nativeNetGraphMsgHandler {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -508,19 +517,19 @@ impl NetGraphMsgHandler {
 /// channel owners' keys.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn NetGraphMsgHandler_new(network_graph: &crate::lightning::routing::network_graph::NetworkGraph, mut chain_access: crate::c_types::derived::COption_AccessZ, mut logger: crate::lightning::util::logger::Logger) -> NetGraphMsgHandler {
+pub extern "C" fn NetGraphMsgHandler_new(network_graph: &crate::lightning::routing::network_graph::NetworkGraph, mut chain_access: crate::c_types::derived::COption_AccessZ, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning::routing::network_graph::NetGraphMsgHandler {
        let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } };
        let mut ret = lightning::routing::network_graph::NetGraphMsgHandler::new(network_graph.get_native_ref(), local_chain_access, logger);
-       NetGraphMsgHandler { inner: ObjOps::heap_alloc(ret), is_owned: true }
+       crate::lightning::routing::network_graph::NetGraphMsgHandler { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
 
 /// Adds a provider used to check new announcements. Does not affect
 /// existing announcements unless they are updated.
 /// Add, update or remove the provider would replace the current one.
 #[no_mangle]
-pub extern "C" fn NetGraphMsgHandler_add_chain_access(this_arg: &mut NetGraphMsgHandler, mut chain_access: crate::c_types::derived::COption_AccessZ) {
+pub extern "C" fn NetGraphMsgHandler_add_chain_access(this_arg: &mut crate::lightning::routing::network_graph::NetGraphMsgHandler, mut chain_access: crate::c_types::derived::COption_AccessZ) {
        let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } };
-       unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut nativeNetGraphMsgHandler)) }.add_chain_access(local_chain_access)
+       unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::routing::network_graph::nativeNetGraphMsgHandler)) }.add_chain_access(local_chain_access)
 }
 
 impl From<nativeNetGraphMsgHandler> for crate::lightning::ln::msgs::RoutingMessageHandler {
@@ -528,7 +537,7 @@ impl From<nativeNetGraphMsgHandler> for crate::lightning::ln::msgs::RoutingMessa
                let mut rust_obj = NetGraphMsgHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
                let mut ret = NetGraphMsgHandler_as_RoutingMessageHandler(&rust_obj);
                // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn
-               rust_obj.inner = std::ptr::null_mut();
+               rust_obj.inner = core::ptr::null_mut();
                ret.free = Some(NetGraphMsgHandler_free_void);
                ret
        }
@@ -545,7 +554,7 @@ pub extern "C" fn NetGraphMsgHandler_as_RoutingMessageHandler(this_arg: &NetGrap
                handle_channel_update: NetGraphMsgHandler_RoutingMessageHandler_handle_channel_update,
                get_next_channel_announcements: NetGraphMsgHandler_RoutingMessageHandler_get_next_channel_announcements,
                get_next_node_announcements: NetGraphMsgHandler_RoutingMessageHandler_get_next_node_announcements,
-               sync_routing_table: NetGraphMsgHandler_RoutingMessageHandler_sync_routing_table,
+               peer_connected: NetGraphMsgHandler_RoutingMessageHandler_peer_connected,
                handle_reply_channel_range: NetGraphMsgHandler_RoutingMessageHandler_handle_reply_channel_range,
                handle_reply_short_channel_ids_end: NetGraphMsgHandler_RoutingMessageHandler_handle_reply_short_channel_ids_end,
                handle_query_channel_range: NetGraphMsgHandler_RoutingMessageHandler_handle_query_channel_range,
@@ -579,7 +588,7 @@ extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_channel_update(thi
 #[must_use]
 extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_get_next_channel_announcements(this_arg: *const c_void, mut starting_point: u64, mut batch_amount: u8) -> crate::c_types::derived::CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
        let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::get_next_channel_announcements(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, starting_point, batch_amount);
-       let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2) = item; let mut local_orig_ret_0_1 = crate::lightning::ln::msgs::ChannelUpdate { inner: if orig_ret_0_1.is_none() { std::ptr::null_mut() } else {  { ObjOps::heap_alloc((orig_ret_0_1.unwrap())) } }, is_owned: true }; let mut local_orig_ret_0_2 = crate::lightning::ln::msgs::ChannelUpdate { inner: if orig_ret_0_2.is_none() { std::ptr::null_mut() } else {  { ObjOps::heap_alloc((orig_ret_0_2.unwrap())) } }, is_owned: true }; let mut local_ret_0 = (crate::lightning::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, local_orig_ret_0_1, local_orig_ret_0_2).into(); local_ret_0 }); };
+       let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2) = item; let mut local_orig_ret_0_1 = crate::lightning::ln::msgs::ChannelUpdate { inner: if orig_ret_0_1.is_none() { core::ptr::null_mut() } else {  { ObjOps::heap_alloc((orig_ret_0_1.unwrap())) } }, is_owned: true }; let mut local_orig_ret_0_2 = crate::lightning::ln::msgs::ChannelUpdate { inner: if orig_ret_0_2.is_none() { core::ptr::null_mut() } else {  { ObjOps::heap_alloc((orig_ret_0_2.unwrap())) } }, is_owned: true }; let mut local_ret_0 = (crate::lightning::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, local_orig_ret_0_1, local_orig_ret_0_2).into(); local_ret_0 }); };
        local_ret.into()
 }
 #[must_use]
@@ -589,18 +598,18 @@ extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_get_next_node_announcemen
        let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::msgs::NodeAnnouncement { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
        local_ret.into()
 }
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_sync_routing_table(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init_msg: &crate::lightning::ln::msgs::Init) {
-       <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::sync_routing_table(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &their_node_id.into_rust(), init_msg.get_native_ref())
+extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init_msg: &crate::lightning::ln::msgs::Init) {
+       <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &their_node_id.into_rust(), init_msg.get_native_ref())
 }
 #[must_use]
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_reply_channel_range(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
-       let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_reply_channel_range(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) });
+extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_reply_channel_range(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::lightning::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+       let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_reply_channel_range(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
        local_ret
 }
 #[must_use]
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_reply_short_channel_ids_end(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
-       let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_reply_short_channel_ids_end(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) });
+extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_reply_short_channel_ids_end(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+       let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_reply_short_channel_ids_end(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
        local_ret
 }
@@ -622,7 +631,7 @@ impl From<nativeNetGraphMsgHandler> for crate::lightning::util::events::MessageS
                let mut rust_obj = NetGraphMsgHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
                let mut ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&rust_obj);
                // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn
-               rust_obj.inner = std::ptr::null_mut();
+               rust_obj.inner = core::ptr::null_mut();
                ret.free = Some(NetGraphMsgHandler_free_void);
                ret
        }
@@ -646,19 +655,18 @@ extern "C" fn NetGraphMsgHandler_MessageSendEventsProvider_get_and_clear_pending
 }
 
 
-use lightning::routing::network_graph::DirectionalChannelInfo as nativeDirectionalChannelInfoImport;
-pub(crate) type nativeDirectionalChannelInfo = nativeDirectionalChannelInfoImport;
+use lightning::routing::network_graph::ChannelUpdateInfo as nativeChannelUpdateInfoImport;
+pub(crate) type nativeChannelUpdateInfo = nativeChannelUpdateInfoImport;
 
-/// Details about one direction of a channel. Received
-/// within a channel update.
+/// Details about one direction of a channel as received within a [`ChannelUpdate`].
 #[must_use]
 #[repr(C)]
-pub struct DirectionalChannelInfo {
+pub struct ChannelUpdateInfo {
        /// 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 nativeDirectionalChannelInfo,
+       pub inner: *mut nativeChannelUpdateInfo,
        /// 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
@@ -666,105 +674,105 @@ pub struct DirectionalChannelInfo {
        pub is_owned: bool,
 }
 
-impl Drop for DirectionalChannelInfo {
+impl Drop for ChannelUpdateInfo {
        fn drop(&mut self) {
-               if self.is_owned && !<*mut nativeDirectionalChannelInfo>::is_null(self.inner) {
+               if self.is_owned && !<*mut nativeChannelUpdateInfo>::is_null(self.inner) {
                        let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
                }
        }
 }
-/// Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
+/// Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_free(this_obj: DirectionalChannelInfo) { }
+pub extern "C" fn ChannelUpdateInfo_free(this_obj: ChannelUpdateInfo) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn DirectionalChannelInfo_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDirectionalChannelInfo); }
+pub(crate) extern "C" fn ChannelUpdateInfo_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelUpdateInfo); }
 }
 #[allow(unused)]
-impl DirectionalChannelInfo {
-       pub(crate) fn get_native_ref(&self) -> &'static nativeDirectionalChannelInfo {
+impl ChannelUpdateInfo {
+       pub(crate) fn get_native_ref(&self) -> &'static nativeChannelUpdateInfo {
                unsafe { &*ObjOps::untweak_ptr(self.inner) }
        }
-       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeDirectionalChannelInfo {
+       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelUpdateInfo {
                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 nativeDirectionalChannelInfo {
+       pub(crate) fn take_inner(mut self) -> *mut nativeChannelUpdateInfo {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
 /// When the last update to the channel direction was issued.
 /// Value is opaque, as set in the announcement.
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_get_last_update(this_ptr: &DirectionalChannelInfo) -> u32 {
+pub extern "C" fn ChannelUpdateInfo_get_last_update(this_ptr: &ChannelUpdateInfo) -> u32 {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().last_update;
        *inner_val
 }
 /// When the last update to the channel direction was issued.
 /// Value is opaque, as set in the announcement.
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_set_last_update(this_ptr: &mut DirectionalChannelInfo, mut val: u32) {
+pub extern "C" fn ChannelUpdateInfo_set_last_update(this_ptr: &mut ChannelUpdateInfo, mut val: u32) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.last_update = val;
 }
 /// Whether the channel can be currently used for payments (in this one direction).
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_get_enabled(this_ptr: &DirectionalChannelInfo) -> bool {
+pub extern "C" fn ChannelUpdateInfo_get_enabled(this_ptr: &ChannelUpdateInfo) -> bool {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().enabled;
        *inner_val
 }
 /// Whether the channel can be currently used for payments (in this one direction).
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_set_enabled(this_ptr: &mut DirectionalChannelInfo, mut val: bool) {
+pub extern "C" fn ChannelUpdateInfo_set_enabled(this_ptr: &mut ChannelUpdateInfo, mut val: bool) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.enabled = val;
 }
 /// The difference in CLTV values that you must have when routing through this channel.
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_get_cltv_expiry_delta(this_ptr: &DirectionalChannelInfo) -> u16 {
+pub extern "C" fn ChannelUpdateInfo_get_cltv_expiry_delta(this_ptr: &ChannelUpdateInfo) -> u16 {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta;
        *inner_val
 }
 /// The difference in CLTV values that you must have when routing through this channel.
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_set_cltv_expiry_delta(this_ptr: &mut DirectionalChannelInfo, mut val: u16) {
+pub extern "C" fn ChannelUpdateInfo_set_cltv_expiry_delta(this_ptr: &mut ChannelUpdateInfo, mut val: u16) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry_delta = val;
 }
 /// The minimum value, which must be relayed to the next hop via the channel
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_get_htlc_minimum_msat(this_ptr: &DirectionalChannelInfo) -> u64 {
+pub extern "C" fn ChannelUpdateInfo_get_htlc_minimum_msat(this_ptr: &ChannelUpdateInfo) -> u64 {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_minimum_msat;
        *inner_val
 }
 /// The minimum value, which must be relayed to the next hop via the channel
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_set_htlc_minimum_msat(this_ptr: &mut DirectionalChannelInfo, mut val: u64) {
+pub extern "C" fn ChannelUpdateInfo_set_htlc_minimum_msat(this_ptr: &mut ChannelUpdateInfo, mut val: u64) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_minimum_msat = val;
 }
 /// The maximum value which may be relayed to the next hop via the channel.
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_get_htlc_maximum_msat(this_ptr: &DirectionalChannelInfo) -> crate::c_types::derived::COption_u64Z {
+pub extern "C" fn ChannelUpdateInfo_get_htlc_maximum_msat(this_ptr: &ChannelUpdateInfo) -> crate::c_types::derived::COption_u64Z {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_maximum_msat;
        let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
        local_inner_val
 }
 /// The maximum value which may be relayed to the next hop via the channel.
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_set_htlc_maximum_msat(this_ptr: &mut DirectionalChannelInfo, mut val: crate::c_types::derived::COption_u64Z) {
+pub extern "C" fn ChannelUpdateInfo_set_htlc_maximum_msat(this_ptr: &mut ChannelUpdateInfo, mut val: crate::c_types::derived::COption_u64Z) {
        let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_maximum_msat = local_val;
 }
 /// Fees charged when the channel is used for routing
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_get_fees(this_ptr: &DirectionalChannelInfo) -> crate::lightning::routing::network_graph::RoutingFees {
+pub extern "C" fn ChannelUpdateInfo_get_fees(this_ptr: &ChannelUpdateInfo) -> crate::lightning::routing::network_graph::RoutingFees {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().fees;
        crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::network_graph::RoutingFees<>) as *mut _) }, is_owned: false }
 }
 /// Fees charged when the channel is used for routing
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_set_fees(this_ptr: &mut DirectionalChannelInfo, mut val: crate::lightning::routing::network_graph::RoutingFees) {
+pub extern "C" fn ChannelUpdateInfo_set_fees(this_ptr: &mut ChannelUpdateInfo, mut val: crate::lightning::routing::network_graph::RoutingFees) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fees = *unsafe { Box::from_raw(val.take_inner()) };
 }
 /// Most recent update for the channel received from the network
@@ -774,9 +782,9 @@ pub extern "C" fn DirectionalChannelInfo_set_fees(this_ptr: &mut DirectionalChan
 ///
 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_get_last_update_message(this_ptr: &DirectionalChannelInfo) -> crate::lightning::ln::msgs::ChannelUpdate {
+pub extern "C" fn ChannelUpdateInfo_get_last_update_message(this_ptr: &ChannelUpdateInfo) -> crate::lightning::ln::msgs::ChannelUpdate {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().last_update_message;
-       let mut local_inner_val = crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::ChannelUpdate<>) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::ChannelUpdate<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// Most recent update for the channel received from the network
@@ -786,17 +794,17 @@ pub extern "C" fn DirectionalChannelInfo_get_last_update_message(this_ptr: &Dire
 ///
 /// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_set_last_update_message(this_ptr: &mut DirectionalChannelInfo, mut val: crate::lightning::ln::msgs::ChannelUpdate) {
+pub extern "C" fn ChannelUpdateInfo_set_last_update_message(this_ptr: &mut ChannelUpdateInfo, mut val: crate::lightning::ln::msgs::ChannelUpdate) {
        let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.last_update_message = local_val;
 }
-/// Constructs a new DirectionalChannelInfo given each field
+/// Constructs a new ChannelUpdateInfo given each field
 #[must_use]
 #[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_new(mut last_update_arg: u32, mut enabled_arg: bool, mut cltv_expiry_delta_arg: u16, mut htlc_minimum_msat_arg: u64, mut htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z, mut fees_arg: crate::lightning::routing::network_graph::RoutingFees, mut last_update_message_arg: crate::lightning::ln::msgs::ChannelUpdate) -> DirectionalChannelInfo {
+pub extern "C" fn ChannelUpdateInfo_new(mut last_update_arg: u32, mut enabled_arg: bool, mut cltv_expiry_delta_arg: u16, mut htlc_minimum_msat_arg: u64, mut htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z, mut fees_arg: crate::lightning::routing::network_graph::RoutingFees, mut last_update_message_arg: crate::lightning::ln::msgs::ChannelUpdate) -> ChannelUpdateInfo {
        let mut local_htlc_maximum_msat_arg = if htlc_maximum_msat_arg.is_some() { Some( { htlc_maximum_msat_arg.take() }) } else { None };
        let mut local_last_update_message_arg = if last_update_message_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(last_update_message_arg.take_inner()) } }) };
-       DirectionalChannelInfo { inner: ObjOps::heap_alloc(nativeDirectionalChannelInfo {
+       ChannelUpdateInfo { inner: ObjOps::heap_alloc(nativeChannelUpdateInfo {
                last_update: last_update_arg,
                enabled: enabled_arg,
                cltv_expiry_delta: cltv_expiry_delta_arg,
@@ -806,10 +814,10 @@ pub extern "C" fn DirectionalChannelInfo_new(mut last_update_arg: u32, mut enabl
                last_update_message: local_last_update_message_arg,
        }), is_owned: true }
 }
-impl Clone for DirectionalChannelInfo {
+impl Clone for ChannelUpdateInfo {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeDirectionalChannelInfo>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeChannelUpdateInfo>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -817,28 +825,28 @@ impl Clone for DirectionalChannelInfo {
 }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn DirectionalChannelInfo_clone_void(this_ptr: *const c_void) -> *mut c_void {
-       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDirectionalChannelInfo)).clone() })) as *mut c_void
+pub(crate) extern "C" fn ChannelUpdateInfo_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelUpdateInfo)).clone() })) as *mut c_void
 }
 #[no_mangle]
-/// Creates a copy of the DirectionalChannelInfo
-pub extern "C" fn DirectionalChannelInfo_clone(orig: &DirectionalChannelInfo) -> DirectionalChannelInfo {
+/// Creates a copy of the ChannelUpdateInfo
+pub extern "C" fn ChannelUpdateInfo_clone(orig: &ChannelUpdateInfo) -> ChannelUpdateInfo {
        orig.clone()
 }
 #[no_mangle]
-/// Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
-pub extern "C" fn DirectionalChannelInfo_write(obj: &DirectionalChannelInfo) -> crate::c_types::derived::CVec_u8Z {
+/// Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
+pub extern "C" fn ChannelUpdateInfo_write(obj: &crate::lightning::routing::network_graph::ChannelUpdateInfo) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
 #[no_mangle]
-pub(crate) extern "C" fn DirectionalChannelInfo_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeDirectionalChannelInfo) })
+pub(crate) extern "C" fn ChannelUpdateInfo_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelUpdateInfo) })
 }
 #[no_mangle]
-/// Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
-pub extern "C" fn DirectionalChannelInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_DirectionalChannelInfoDecodeErrorZ {
-       let res = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::network_graph::DirectionalChannelInfo { 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 ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
+pub extern "C" fn ChannelUpdateInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelUpdateInfoDecodeErrorZ {
+       let res: Result<lightning::routing::network_graph::ChannelUpdateInfo, 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::routing::network_graph::ChannelUpdateInfo { 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
 }
 
@@ -889,7 +897,7 @@ impl ChannelInfo {
        pub(crate) fn take_inner(mut self) -> *mut nativeChannelInfo {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -919,16 +927,16 @@ pub extern "C" fn ChannelInfo_set_node_one(this_ptr: &mut ChannelInfo, mut val:
 ///
 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
 #[no_mangle]
-pub extern "C" fn ChannelInfo_get_one_to_two(this_ptr: &ChannelInfo) -> crate::lightning::routing::network_graph::DirectionalChannelInfo {
+pub extern "C" fn ChannelInfo_get_one_to_two(this_ptr: &ChannelInfo) -> crate::lightning::routing::network_graph::ChannelUpdateInfo {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().one_to_two;
-       let mut local_inner_val = crate::lightning::routing::network_graph::DirectionalChannelInfo { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::DirectionalChannelInfo<>) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::routing::network_graph::ChannelUpdateInfo { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::ChannelUpdateInfo<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// Details about the first direction of a channel
 ///
 /// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
 #[no_mangle]
-pub extern "C" fn ChannelInfo_set_one_to_two(this_ptr: &mut ChannelInfo, mut val: crate::lightning::routing::network_graph::DirectionalChannelInfo) {
+pub extern "C" fn ChannelInfo_set_one_to_two(this_ptr: &mut ChannelInfo, mut val: crate::lightning::routing::network_graph::ChannelUpdateInfo) {
        let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.one_to_two = local_val;
 }
@@ -947,16 +955,16 @@ pub extern "C" fn ChannelInfo_set_node_two(this_ptr: &mut ChannelInfo, mut val:
 ///
 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
 #[no_mangle]
-pub extern "C" fn ChannelInfo_get_two_to_one(this_ptr: &ChannelInfo) -> crate::lightning::routing::network_graph::DirectionalChannelInfo {
+pub extern "C" fn ChannelInfo_get_two_to_one(this_ptr: &ChannelInfo) -> crate::lightning::routing::network_graph::ChannelUpdateInfo {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().two_to_one;
-       let mut local_inner_val = crate::lightning::routing::network_graph::DirectionalChannelInfo { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::DirectionalChannelInfo<>) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::routing::network_graph::ChannelUpdateInfo { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::ChannelUpdateInfo<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// Details about the second direction of a channel
 ///
 /// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
 #[no_mangle]
-pub extern "C" fn ChannelInfo_set_two_to_one(this_ptr: &mut ChannelInfo, mut val: crate::lightning::routing::network_graph::DirectionalChannelInfo) {
+pub extern "C" fn ChannelInfo_set_two_to_one(this_ptr: &mut ChannelInfo, mut val: crate::lightning::routing::network_graph::ChannelUpdateInfo) {
        let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.two_to_one = local_val;
 }
@@ -982,7 +990,7 @@ pub extern "C" fn ChannelInfo_set_capacity_sats(this_ptr: &mut ChannelInfo, mut
 #[no_mangle]
 pub extern "C" fn ChannelInfo_get_announcement_message(this_ptr: &ChannelInfo) -> crate::lightning::ln::msgs::ChannelAnnouncement {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().announcement_message;
-       let mut local_inner_val = crate::lightning::ln::msgs::ChannelAnnouncement { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::ChannelAnnouncement<>) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::ln::msgs::ChannelAnnouncement { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::ChannelAnnouncement<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// An initial announcement of the channel
@@ -996,28 +1004,10 @@ pub extern "C" fn ChannelInfo_set_announcement_message(this_ptr: &mut ChannelInf
        let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.announcement_message = local_val;
 }
-/// Constructs a new ChannelInfo given each field
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelInfo_new(mut features_arg: crate::lightning::ln::features::ChannelFeatures, mut node_one_arg: crate::lightning::routing::network_graph::NodeId, mut one_to_two_arg: crate::lightning::routing::network_graph::DirectionalChannelInfo, mut node_two_arg: crate::lightning::routing::network_graph::NodeId, mut two_to_one_arg: crate::lightning::routing::network_graph::DirectionalChannelInfo, mut capacity_sats_arg: crate::c_types::derived::COption_u64Z, mut announcement_message_arg: crate::lightning::ln::msgs::ChannelAnnouncement) -> ChannelInfo {
-       let mut local_one_to_two_arg = if one_to_two_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(one_to_two_arg.take_inner()) } }) };
-       let mut local_two_to_one_arg = if two_to_one_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(two_to_one_arg.take_inner()) } }) };
-       let mut local_capacity_sats_arg = if capacity_sats_arg.is_some() { Some( { capacity_sats_arg.take() }) } else { None };
-       let mut local_announcement_message_arg = if announcement_message_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(announcement_message_arg.take_inner()) } }) };
-       ChannelInfo { inner: ObjOps::heap_alloc(nativeChannelInfo {
-               features: *unsafe { Box::from_raw(features_arg.take_inner()) },
-               node_one: *unsafe { Box::from_raw(node_one_arg.take_inner()) },
-               one_to_two: local_one_to_two_arg,
-               node_two: *unsafe { Box::from_raw(node_two_arg.take_inner()) },
-               two_to_one: local_two_to_one_arg,
-               capacity_sats: local_capacity_sats_arg,
-               announcement_message: local_announcement_message_arg,
-       }), is_owned: true }
-}
 impl Clone for ChannelInfo {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeChannelInfo>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeChannelInfo>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -1035,7 +1025,7 @@ pub extern "C" fn ChannelInfo_clone(orig: &ChannelInfo) -> ChannelInfo {
 }
 #[no_mangle]
 /// Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
-pub extern "C" fn ChannelInfo_write(obj: &ChannelInfo) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn ChannelInfo_write(obj: &crate::lightning::routing::network_graph::ChannelInfo) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
 #[no_mangle]
@@ -1045,11 +1035,292 @@ pub(crate) extern "C" fn ChannelInfo_write_void(obj: *const c_void) -> crate::c_
 #[no_mangle]
 /// Read a ChannelInfo from a byte array, created by ChannelInfo_write
 pub extern "C" fn ChannelInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelInfoDecodeErrorZ {
-       let res = crate::c_types::deserialize_obj(ser);
+       let res: Result<lightning::routing::network_graph::ChannelInfo, 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::routing::network_graph::ChannelInfo { 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
 }
 
+use lightning::routing::network_graph::DirectedChannelInfo as nativeDirectedChannelInfoImport;
+pub(crate) type nativeDirectedChannelInfo = nativeDirectedChannelInfoImport<'static>;
+
+/// A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
+/// source node to a target node.
+#[must_use]
+#[repr(C)]
+pub struct DirectedChannelInfo {
+       /// 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 nativeDirectedChannelInfo,
+       /// 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 DirectedChannelInfo {
+       fn drop(&mut self) {
+               if self.is_owned && !<*mut nativeDirectedChannelInfo>::is_null(self.inner) {
+                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+               }
+       }
+}
+/// Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn DirectedChannelInfo_free(this_obj: DirectedChannelInfo) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn DirectedChannelInfo_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDirectedChannelInfo); }
+}
+#[allow(unused)]
+impl DirectedChannelInfo {
+       pub(crate) fn get_native_ref(&self) -> &'static nativeDirectedChannelInfo {
+               unsafe { &*ObjOps::untweak_ptr(self.inner) }
+       }
+       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeDirectedChannelInfo {
+               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 nativeDirectedChannelInfo {
+               assert!(self.is_owned);
+               let ret = ObjOps::untweak_ptr(self.inner);
+               self.inner = core::ptr::null_mut();
+               ret
+       }
+}
+impl Clone for DirectedChannelInfo {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: if <*mut nativeDirectedChannelInfo>::is_null(self.inner) { core::ptr::null_mut() } else {
+                               ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+                       is_owned: true,
+               }
+       }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn DirectedChannelInfo_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDirectedChannelInfo)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the DirectedChannelInfo
+pub extern "C" fn DirectedChannelInfo_clone(orig: &DirectedChannelInfo) -> DirectedChannelInfo {
+       orig.clone()
+}
+/// Returns information for the channel.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn DirectedChannelInfo_channel(this_arg: &crate::lightning::routing::network_graph::DirectedChannelInfo) -> crate::lightning::routing::network_graph::ChannelInfo {
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel();
+       crate::lightning::routing::network_graph::ChannelInfo { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::routing::network_graph::ChannelInfo<>) as *mut _) }, is_owned: false }
+}
+
+/// Returns information for the direction.
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[must_use]
+#[no_mangle]
+pub extern "C" fn DirectedChannelInfo_direction(this_arg: &crate::lightning::routing::network_graph::DirectedChannelInfo) -> crate::lightning::routing::network_graph::ChannelUpdateInfo {
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.direction();
+       let mut local_ret = crate::lightning::routing::network_graph::ChannelUpdateInfo { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::routing::network_graph::ChannelUpdateInfo<>) as *mut _ }, is_owned: false };
+       local_ret
+}
+
+/// Returns the [`EffectiveCapacity`] of the channel in the direction.
+///
+/// This is either the total capacity from the funding transaction, if known, or the
+/// `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
+/// whichever is smaller.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn DirectedChannelInfo_effective_capacity(this_arg: &crate::lightning::routing::network_graph::DirectedChannelInfo) -> crate::lightning::routing::network_graph::EffectiveCapacity {
+       let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.effective_capacity();
+       crate::lightning::routing::network_graph::EffectiveCapacity::native_into(ret)
+}
+
+/// The effective capacity of a channel for routing purposes.
+///
+/// While this may be smaller than the actual channel capacity, amounts greater than
+/// [`Self::as_msat`] should not be routed through the channel.
+#[must_use]
+#[derive(Clone)]
+#[repr(C)]
+pub enum EffectiveCapacity {
+       /// The available liquidity in the channel known from being a channel counterparty, and thus a
+       /// direct hop.
+       ExactLiquidity {
+               /// Either the inbound or outbound liquidity depending on the direction, denominated in
+               /// millisatoshi.
+               liquidity_msat: u64,
+       },
+       /// The maximum HTLC amount in one direction as advertised on the gossip network.
+       MaximumHTLC {
+               /// The maximum HTLC amount denominated in millisatoshi.
+               amount_msat: u64,
+       },
+       /// The total capacity of the channel as determined by the funding transaction.
+       Total {
+               /// The funding amount denominated in millisatoshi.
+               capacity_msat: u64,
+       },
+       /// A capacity sufficient to route any payment, typically used for private channels provided by
+       /// an invoice.
+       Infinite,
+       /// A capacity that is unknown possibly because either the chain state is unavailable to know
+       /// the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
+       Unknown,
+}
+use lightning::routing::network_graph::EffectiveCapacity as nativeEffectiveCapacity;
+impl EffectiveCapacity {
+       #[allow(unused)]
+       pub(crate) fn to_native(&self) -> nativeEffectiveCapacity {
+               match self {
+                       EffectiveCapacity::ExactLiquidity {ref liquidity_msat, } => {
+                               let mut liquidity_msat_nonref = (*liquidity_msat).clone();
+                               nativeEffectiveCapacity::ExactLiquidity {
+                                       liquidity_msat: liquidity_msat_nonref,
+                               }
+                       },
+                       EffectiveCapacity::MaximumHTLC {ref amount_msat, } => {
+                               let mut amount_msat_nonref = (*amount_msat).clone();
+                               nativeEffectiveCapacity::MaximumHTLC {
+                                       amount_msat: amount_msat_nonref,
+                               }
+                       },
+                       EffectiveCapacity::Total {ref capacity_msat, } => {
+                               let mut capacity_msat_nonref = (*capacity_msat).clone();
+                               nativeEffectiveCapacity::Total {
+                                       capacity_msat: capacity_msat_nonref,
+                               }
+                       },
+                       EffectiveCapacity::Infinite => nativeEffectiveCapacity::Infinite,
+                       EffectiveCapacity::Unknown => nativeEffectiveCapacity::Unknown,
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn into_native(self) -> nativeEffectiveCapacity {
+               match self {
+                       EffectiveCapacity::ExactLiquidity {mut liquidity_msat, } => {
+                               nativeEffectiveCapacity::ExactLiquidity {
+                                       liquidity_msat: liquidity_msat,
+                               }
+                       },
+                       EffectiveCapacity::MaximumHTLC {mut amount_msat, } => {
+                               nativeEffectiveCapacity::MaximumHTLC {
+                                       amount_msat: amount_msat,
+                               }
+                       },
+                       EffectiveCapacity::Total {mut capacity_msat, } => {
+                               nativeEffectiveCapacity::Total {
+                                       capacity_msat: capacity_msat,
+                               }
+                       },
+                       EffectiveCapacity::Infinite => nativeEffectiveCapacity::Infinite,
+                       EffectiveCapacity::Unknown => nativeEffectiveCapacity::Unknown,
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn from_native(native: &nativeEffectiveCapacity) -> Self {
+               match native {
+                       nativeEffectiveCapacity::ExactLiquidity {ref liquidity_msat, } => {
+                               let mut liquidity_msat_nonref = (*liquidity_msat).clone();
+                               EffectiveCapacity::ExactLiquidity {
+                                       liquidity_msat: liquidity_msat_nonref,
+                               }
+                       },
+                       nativeEffectiveCapacity::MaximumHTLC {ref amount_msat, } => {
+                               let mut amount_msat_nonref = (*amount_msat).clone();
+                               EffectiveCapacity::MaximumHTLC {
+                                       amount_msat: amount_msat_nonref,
+                               }
+                       },
+                       nativeEffectiveCapacity::Total {ref capacity_msat, } => {
+                               let mut capacity_msat_nonref = (*capacity_msat).clone();
+                               EffectiveCapacity::Total {
+                                       capacity_msat: capacity_msat_nonref,
+                               }
+                       },
+                       nativeEffectiveCapacity::Infinite => EffectiveCapacity::Infinite,
+                       nativeEffectiveCapacity::Unknown => EffectiveCapacity::Unknown,
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn native_into(native: nativeEffectiveCapacity) -> Self {
+               match native {
+                       nativeEffectiveCapacity::ExactLiquidity {mut liquidity_msat, } => {
+                               EffectiveCapacity::ExactLiquidity {
+                                       liquidity_msat: liquidity_msat,
+                               }
+                       },
+                       nativeEffectiveCapacity::MaximumHTLC {mut amount_msat, } => {
+                               EffectiveCapacity::MaximumHTLC {
+                                       amount_msat: amount_msat,
+                               }
+                       },
+                       nativeEffectiveCapacity::Total {mut capacity_msat, } => {
+                               EffectiveCapacity::Total {
+                                       capacity_msat: capacity_msat,
+                               }
+                       },
+                       nativeEffectiveCapacity::Infinite => EffectiveCapacity::Infinite,
+                       nativeEffectiveCapacity::Unknown => EffectiveCapacity::Unknown,
+               }
+       }
+}
+/// Frees any resources used by the EffectiveCapacity
+#[no_mangle]
+pub extern "C" fn EffectiveCapacity_free(this_ptr: EffectiveCapacity) { }
+/// Creates a copy of the EffectiveCapacity
+#[no_mangle]
+pub extern "C" fn EffectiveCapacity_clone(orig: &EffectiveCapacity) -> EffectiveCapacity {
+       orig.clone()
+}
+#[no_mangle]
+/// Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
+pub extern "C" fn EffectiveCapacity_exact_liquidity(liquidity_msat: u64) -> EffectiveCapacity {
+       EffectiveCapacity::ExactLiquidity {
+               liquidity_msat,
+       }
+}
+#[no_mangle]
+/// Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
+pub extern "C" fn EffectiveCapacity_maximum_htlc(amount_msat: u64) -> EffectiveCapacity {
+       EffectiveCapacity::MaximumHTLC {
+               amount_msat,
+       }
+}
+#[no_mangle]
+/// Utility method to constructs a new Total-variant EffectiveCapacity
+pub extern "C" fn EffectiveCapacity_total(capacity_msat: u64) -> EffectiveCapacity {
+       EffectiveCapacity::Total {
+               capacity_msat,
+       }
+}
+#[no_mangle]
+/// Utility method to constructs a new Infinite-variant EffectiveCapacity
+pub extern "C" fn EffectiveCapacity_infinite() -> EffectiveCapacity {
+       EffectiveCapacity::Infinite}
+#[no_mangle]
+/// Utility method to constructs a new Unknown-variant EffectiveCapacity
+pub extern "C" fn EffectiveCapacity_unknown() -> EffectiveCapacity {
+       EffectiveCapacity::Unknown}
+/// The presumed channel capacity denominated in millisatoshi for [`EffectiveCapacity::Unknown`] to
+/// use when making routing decisions.
+
+#[no_mangle]
+pub static UNKNOWN_CHANNEL_CAPACITY_MSAT: u64 = lightning::routing::network_graph::UNKNOWN_CHANNEL_CAPACITY_MSAT;
+/// Returns the effective capacity denominated in millisatoshi.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn EffectiveCapacity_as_msat(this_arg: &crate::lightning::routing::network_graph::EffectiveCapacity) -> u64 {
+       let mut ret = this_arg.to_native().as_msat();
+       ret
+}
+
+
 use lightning::routing::network_graph::RoutingFees as nativeRoutingFeesImport;
 pub(crate) type nativeRoutingFees = nativeRoutingFeesImport;
 
@@ -1096,7 +1367,7 @@ impl RoutingFees {
        pub(crate) fn take_inner(mut self) -> *mut nativeRoutingFees {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -1145,7 +1416,7 @@ pub extern "C" fn RoutingFees_eq(a: &RoutingFees, b: &RoutingFees) -> bool {
 impl Clone for RoutingFees {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeRoutingFees>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeRoutingFees>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -1165,15 +1436,15 @@ pub extern "C" fn RoutingFees_clone(orig: &RoutingFees) -> RoutingFees {
 #[no_mangle]
 pub extern "C" fn RoutingFees_hash(o: &RoutingFees) -> u64 {
        if o.inner.is_null() { return 0; }
-       // Note that we'd love to use std::collections::hash_map::DefaultHasher but it's not in core
+       // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
        #[allow(deprecated)]
        let mut hasher = core::hash::SipHasher::new();
-       std::hash::Hash::hash(o.get_native_ref(), &mut hasher);
-       std::hash::Hasher::finish(&hasher)
+       core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+       core::hash::Hasher::finish(&hasher)
 }
 #[no_mangle]
 /// Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
-pub extern "C" fn RoutingFees_write(obj: &RoutingFees) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn RoutingFees_write(obj: &crate::lightning::routing::network_graph::RoutingFees) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
 #[no_mangle]
@@ -1183,7 +1454,7 @@ pub(crate) extern "C" fn RoutingFees_write_void(obj: *const c_void) -> crate::c_
 #[no_mangle]
 /// Read a RoutingFees from a byte array, created by RoutingFees_write
 pub extern "C" fn RoutingFees_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RoutingFeesDecodeErrorZ {
-       let res = crate::c_types::deserialize_obj(ser);
+       let res: Result<lightning::routing::network_graph::RoutingFees, 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::routing::network_graph::RoutingFees { 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
 }
@@ -1234,7 +1505,7 @@ impl NodeAnnouncementInfo {
        pub(crate) fn take_inner(mut self) -> *mut nativeNodeAnnouncementInfo {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -1303,7 +1574,7 @@ pub extern "C" fn NodeAnnouncementInfo_set_addresses(this_ptr: &mut NodeAnnounce
 #[no_mangle]
 pub extern "C" fn NodeAnnouncementInfo_get_announcement_message(this_ptr: &NodeAnnouncementInfo) -> crate::lightning::ln::msgs::NodeAnnouncement {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().announcement_message;
-       let mut local_inner_val = crate::lightning::ln::msgs::NodeAnnouncement { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::NodeAnnouncement<>) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::ln::msgs::NodeAnnouncement { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::msgs::NodeAnnouncement<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// An initial announcement of the node
@@ -1335,7 +1606,7 @@ pub extern "C" fn NodeAnnouncementInfo_new(mut features_arg: crate::lightning::l
 impl Clone for NodeAnnouncementInfo {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeNodeAnnouncementInfo>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeNodeAnnouncementInfo>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -1353,7 +1624,7 @@ pub extern "C" fn NodeAnnouncementInfo_clone(orig: &NodeAnnouncementInfo) -> Nod
 }
 #[no_mangle]
 /// Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
-pub extern "C" fn NodeAnnouncementInfo_write(obj: &NodeAnnouncementInfo) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn NodeAnnouncementInfo_write(obj: &crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
 #[no_mangle]
@@ -1363,7 +1634,7 @@ pub(crate) extern "C" fn NodeAnnouncementInfo_write_void(obj: *const c_void) ->
 #[no_mangle]
 /// Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
 pub extern "C" fn NodeAnnouncementInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeAnnouncementInfoDecodeErrorZ {
-       let res = crate::c_types::deserialize_obj(ser);
+       let res: Result<lightning::routing::network_graph::NodeAnnouncementInfo, 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::routing::network_graph::NodeAnnouncementInfo { 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
 }
@@ -1414,7 +1685,7 @@ impl NodeInfo {
        pub(crate) fn take_inner(mut self) -> *mut nativeNodeInfo {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -1432,7 +1703,7 @@ pub extern "C" fn NodeInfo_set_channels(this_ptr: &mut NodeInfo, mut val: crate:
 #[no_mangle]
 pub extern "C" fn NodeInfo_get_lowest_inbound_channel_fees(this_ptr: &NodeInfo) -> crate::lightning::routing::network_graph::RoutingFees {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().lowest_inbound_channel_fees;
-       let mut local_inner_val = crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::RoutingFees<>) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::RoutingFees<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// Lowest fees enabling routing via any of the enabled, known channels to a node.
@@ -1453,7 +1724,7 @@ pub extern "C" fn NodeInfo_set_lowest_inbound_channel_fees(this_ptr: &mut NodeIn
 #[no_mangle]
 pub extern "C" fn NodeInfo_get_announcement_info(this_ptr: &NodeInfo) -> crate::lightning::routing::network_graph::NodeAnnouncementInfo {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().announcement_info;
-       let mut local_inner_val = crate::lightning::routing::network_graph::NodeAnnouncementInfo { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::NodeAnnouncementInfo<>) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::routing::network_graph::NodeAnnouncementInfo { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::network_graph::NodeAnnouncementInfo<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// More information about a node from node_announcement.
@@ -1482,7 +1753,7 @@ pub extern "C" fn NodeInfo_new(mut channels_arg: crate::c_types::derived::CVec_u
 impl Clone for NodeInfo {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeNodeInfo>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeNodeInfo>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -1500,7 +1771,7 @@ pub extern "C" fn NodeInfo_clone(orig: &NodeInfo) -> NodeInfo {
 }
 #[no_mangle]
 /// Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
-pub extern "C" fn NodeInfo_write(obj: &NodeInfo) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn NodeInfo_write(obj: &crate::lightning::routing::network_graph::NodeInfo) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
 #[no_mangle]
@@ -1510,13 +1781,13 @@ pub(crate) extern "C" fn NodeInfo_write_void(obj: *const c_void) -> crate::c_typ
 #[no_mangle]
 /// Read a NodeInfo from a byte array, created by NodeInfo_write
 pub extern "C" fn NodeInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeInfoDecodeErrorZ {
-       let res = crate::c_types::deserialize_obj(ser);
+       let res: Result<lightning::routing::network_graph::NodeInfo, 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::routing::network_graph::NodeInfo { 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
 }
 #[no_mangle]
 /// Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
-pub extern "C" fn NetworkGraph_write(obj: &NetworkGraph) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn NetworkGraph_write(obj: &crate::lightning::routing::network_graph::NetworkGraph) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
 #[no_mangle]
@@ -1526,7 +1797,7 @@ pub(crate) extern "C" fn NetworkGraph_write_void(obj: *const c_void) -> crate::c
 #[no_mangle]
 /// Read a NetworkGraph from a byte array, created by NetworkGraph_write
 pub extern "C" fn NetworkGraph_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NetworkGraphDecodeErrorZ {
-       let res = crate::c_types::deserialize_obj(ser);
+       let res: Result<lightning::routing::network_graph::NetworkGraph, 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::routing::network_graph::NetworkGraph { 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
 }
@@ -1541,7 +1812,7 @@ pub extern "C" fn NetworkGraph_new(mut genesis_hash: crate::c_types::ThirtyTwoBy
 /// Returns a read-only view of the network graph.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn NetworkGraph_read_only(this_arg: &NetworkGraph) -> crate::lightning::routing::network_graph::ReadOnlyNetworkGraph {
+pub extern "C" fn NetworkGraph_read_only(this_arg: &crate::lightning::routing::network_graph::NetworkGraph) -> crate::lightning::routing::network_graph::ReadOnlyNetworkGraph {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.read_only();
        crate::lightning::routing::network_graph::ReadOnlyNetworkGraph { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
@@ -1554,7 +1825,7 @@ pub extern "C" fn NetworkGraph_read_only(this_arg: &NetworkGraph) -> crate::ligh
 /// routing messages from a source using a protocol other than the lightning P2P protocol.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn NetworkGraph_update_node_from_announcement(this_arg: &NetworkGraph, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+pub extern "C" fn NetworkGraph_update_node_from_announcement(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_node_from_announcement(msg.get_native_ref(), secp256k1::SECP256K1);
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
        local_ret
@@ -1566,7 +1837,7 @@ pub extern "C" fn NetworkGraph_update_node_from_announcement(this_arg: &NetworkG
 /// peers.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn NetworkGraph_update_node_from_unsigned_announcement(this_arg: &NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+pub extern "C" fn NetworkGraph_update_node_from_unsigned_announcement(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_node_from_unsigned_announcement(msg.get_native_ref());
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
        local_ret
@@ -1582,7 +1853,7 @@ pub extern "C" fn NetworkGraph_update_node_from_unsigned_announcement(this_arg:
 /// the corresponding UTXO exists on chain and is correctly-formatted.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn NetworkGraph_update_channel_from_announcement(this_arg: &NetworkGraph, msg: &crate::lightning::ln::msgs::ChannelAnnouncement, mut chain_access: crate::c_types::derived::COption_AccessZ) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+pub extern "C" fn NetworkGraph_update_channel_from_announcement(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::ChannelAnnouncement, mut chain_access: crate::c_types::derived::COption_AccessZ) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
        let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } };
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel_from_announcement(msg.get_native_ref(), &local_chain_access, secp256k1::SECP256K1);
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
@@ -1597,7 +1868,7 @@ pub extern "C" fn NetworkGraph_update_channel_from_announcement(this_arg: &Netwo
 /// the corresponding UTXO exists on chain and is correctly-formatted.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn NetworkGraph_update_channel_from_unsigned_announcement(this_arg: &NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement, mut chain_access: crate::c_types::derived::COption_AccessZ) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+pub extern "C" fn NetworkGraph_update_channel_from_unsigned_announcement(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement, mut chain_access: crate::c_types::derived::COption_AccessZ) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
        let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } };
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel_from_unsigned_announcement(msg.get_native_ref(), &local_chain_access);
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
@@ -1609,25 +1880,61 @@ pub extern "C" fn NetworkGraph_update_channel_from_unsigned_announcement(this_ar
 /// May cause the removal of nodes too, if this was their last channel.
 /// If not permanent, makes channels unavailable for routing.
 #[no_mangle]
-pub extern "C" fn NetworkGraph_close_channel_from_update(this_arg: &NetworkGraph, mut short_channel_id: u64, mut is_permanent: bool) {
+pub extern "C" fn NetworkGraph_close_channel_from_update(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, mut short_channel_id: u64, mut is_permanent: bool) {
        unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.close_channel_from_update(short_channel_id, is_permanent)
 }
 
 /// Marks a node in the graph as failed.
 #[no_mangle]
-pub extern "C" fn NetworkGraph_fail_node(this_arg: &NetworkGraph, mut _node_id: crate::c_types::PublicKey, mut is_permanent: bool) {
+pub extern "C" fn NetworkGraph_fail_node(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, mut _node_id: crate::c_types::PublicKey, mut is_permanent: bool) {
        unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fail_node(&_node_id.into_rust(), is_permanent)
 }
 
+/// Removes information about channels that we haven't heard any updates about in some time.
+/// This can be used regularly to prune the network graph of channels that likely no longer
+/// exist.
+///
+/// While there is no formal requirement that nodes regularly re-broadcast their channel
+/// updates every two weeks, the non-normative section of BOLT 7 currently suggests that
+/// pruning occur for updates which are at least two weeks old, which we implement here.
+///
+/// Note that for users of the `lightning-background-processor` crate this method may be
+/// automatically called regularly for you.
+///
+/// This method is only available with the `std` feature. See
+/// [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use.
+#[no_mangle]
+pub extern "C" fn NetworkGraph_remove_stale_channels(this_arg: &crate::lightning::routing::network_graph::NetworkGraph) {
+       unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_stale_channels()
+}
+
+/// Removes information about channels that we haven't heard any updates about in some time.
+/// This can be used regularly to prune the network graph of channels that likely no longer
+/// exist.
+///
+/// While there is no formal requirement that nodes regularly re-broadcast their channel
+/// updates every two weeks, the non-normative section of BOLT 7 currently suggests that
+/// pruning occur for updates which are at least two weeks old, which we implement here.
+///
+/// This function takes the current unix time as an argument. For users with the `std` feature
+/// enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
+#[no_mangle]
+pub extern "C" fn NetworkGraph_remove_stale_channels_with_time(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, mut current_time_unix: u64) {
+       unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_stale_channels_with_time(current_time_unix)
+}
+
 /// For an already known (from announcement) channel, update info about one of the directions
 /// of the channel.
 ///
 /// You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
 /// RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
 /// routing messages from a source using a protocol other than the lightning P2P protocol.
+///
+/// If built with `no-std`, any updates with a timestamp more than two weeks in the past or
+/// materially in the future will be rejected.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn NetworkGraph_update_channel(this_arg: &NetworkGraph, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+pub extern "C" fn NetworkGraph_update_channel(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel(msg.get_native_ref(), secp256k1::SECP256K1);
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
        local_ret
@@ -1636,9 +1943,12 @@ pub extern "C" fn NetworkGraph_update_channel(this_arg: &NetworkGraph, msg: &cra
 /// For an already known (from announcement) channel, update info about one of the directions
 /// of the channel without verifying the associated signatures. Because we aren't given the
 /// associated signatures here we cannot relay the channel update to any of our peers.
+///
+/// If built with `no-std`, any updates with a timestamp more than two weeks in the past or
+/// materially in the future will be rejected.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn NetworkGraph_update_channel_unsigned(this_arg: &NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedChannelUpdate) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+pub extern "C" fn NetworkGraph_update_channel_unsigned(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedChannelUpdate) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel_unsigned(msg.get_native_ref());
        let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
        local_ret
@@ -1649,7 +1959,7 @@ pub extern "C" fn NetworkGraph_update_channel_unsigned(this_arg: &NetworkGraph,
 /// or if node announcement for the node was never received.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ReadOnlyNetworkGraph_get_addresses(this_arg: &ReadOnlyNetworkGraph, mut pubkey: crate::c_types::PublicKey) -> crate::c_types::derived::COption_CVec_NetAddressZZ {
+pub extern "C" fn ReadOnlyNetworkGraph_get_addresses(this_arg: &crate::lightning::routing::network_graph::ReadOnlyNetworkGraph, mut pubkey: crate::c_types::PublicKey) -> crate::c_types::derived::COption_CVec_NetAddressZZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_addresses(&pubkey.into_rust());
        let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_NetAddressZZ::None } else { crate::c_types::derived::COption_CVec_NetAddressZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::lightning::ln::msgs::NetAddress::native_into(item) }); }; local_ret_0.into() }) };
        local_ret