Merge pull request #60 from TheBlueMatt/main
[ldk-c-bindings] / lightning-c-bindings / src / lightning / ln / msgs.rs
index a5a729c5be06469b7f533c1968c7a8a6c236986e..1976040fd7da7d464a15f39b7e28e7ed8c02795c 100644 (file)
 //! raw socket events into your non-internet-facing system and then send routing events back to
 //! track the network on the less-secure system.
 
-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::ln::msgs::DecodeError as nativeDecodeErrorImport;
@@ -76,14 +78,14 @@ impl DecodeError {
        pub(crate) fn take_inner(mut self) -> *mut nativeDecodeError {
                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 DecodeError {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeDecodeError>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeDecodeError>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -146,7 +148,7 @@ impl Init {
        pub(crate) fn take_inner(mut self) -> *mut nativeInit {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -172,7 +174,7 @@ pub extern "C" fn Init_new(mut features_arg: crate::lightning::ln::features::Ini
 impl Clone for Init {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeInit>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeInit>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -235,34 +237,40 @@ impl ErrorMessage {
        pub(crate) fn take_inner(mut self) -> *mut nativeErrorMessage {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
-/// The channel ID involved in the error
+/// The channel ID involved in the error.
+///
+/// All-0s indicates a general error unrelated to a specific channel, after which all channels
+/// with the sending peer should be closed.
 #[no_mangle]
 pub extern "C" fn ErrorMessage_get_channel_id(this_ptr: &ErrorMessage) -> *const [u8; 32] {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
        inner_val
 }
-/// The channel ID involved in the error
+/// The channel ID involved in the error.
+///
+/// All-0s indicates a general error unrelated to a specific channel, after which all channels
+/// with the sending peer should be closed.
 #[no_mangle]
 pub extern "C" fn ErrorMessage_set_channel_id(this_ptr: &mut ErrorMessage, mut val: crate::c_types::ThirtyTwoBytes) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data;
 }
 /// A possibly human-readable error description.
-/// The string should be sanitized before it is used (e.g. emitted to logs
-/// or printed to stdout).  Otherwise, a well crafted error message may trigger a security
-/// vulnerability in the terminal emulator or the logging subsystem.
+/// The string should be sanitized before it is used (e.g. emitted to logs or printed to
+/// stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
+/// the terminal emulator or the logging subsystem.
 #[no_mangle]
 pub extern "C" fn ErrorMessage_get_data(this_ptr: &ErrorMessage) -> crate::c_types::Str {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().data;
        inner_val.as_str().into()
 }
 /// A possibly human-readable error description.
-/// The string should be sanitized before it is used (e.g. emitted to logs
-/// or printed to stdout).  Otherwise, a well crafted error message may trigger a security
-/// vulnerability in the terminal emulator or the logging subsystem.
+/// The string should be sanitized before it is used (e.g. emitted to logs or printed to
+/// stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
+/// the terminal emulator or the logging subsystem.
 #[no_mangle]
 pub extern "C" fn ErrorMessage_set_data(this_ptr: &mut ErrorMessage, mut val: crate::c_types::Str) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.data = val.into_string();
@@ -279,7 +287,7 @@ pub extern "C" fn ErrorMessage_new(mut channel_id_arg: crate::c_types::ThirtyTwo
 impl Clone for ErrorMessage {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeErrorMessage>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeErrorMessage>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -296,6 +304,117 @@ pub extern "C" fn ErrorMessage_clone(orig: &ErrorMessage) -> ErrorMessage {
        orig.clone()
 }
 
+use lightning::ln::msgs::WarningMessage as nativeWarningMessageImport;
+pub(crate) type nativeWarningMessage = nativeWarningMessageImport;
+
+/// A warning message to be sent or received from a peer
+#[must_use]
+#[repr(C)]
+pub struct WarningMessage {
+       /// 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 nativeWarningMessage,
+       /// 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 WarningMessage {
+       fn drop(&mut self) {
+               if self.is_owned && !<*mut nativeWarningMessage>::is_null(self.inner) {
+                       let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+               }
+       }
+}
+/// Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn WarningMessage_free(this_obj: WarningMessage) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn WarningMessage_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeWarningMessage); }
+}
+#[allow(unused)]
+impl WarningMessage {
+       pub(crate) fn get_native_ref(&self) -> &'static nativeWarningMessage {
+               unsafe { &*ObjOps::untweak_ptr(self.inner) }
+       }
+       pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeWarningMessage {
+               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 nativeWarningMessage {
+               assert!(self.is_owned);
+               let ret = ObjOps::untweak_ptr(self.inner);
+               self.inner = core::ptr::null_mut();
+               ret
+       }
+}
+/// The channel ID involved in the warning.
+///
+/// All-0s indicates a warning unrelated to a specific channel.
+#[no_mangle]
+pub extern "C" fn WarningMessage_get_channel_id(this_ptr: &WarningMessage) -> *const [u8; 32] {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+       inner_val
+}
+/// The channel ID involved in the warning.
+///
+/// All-0s indicates a warning unrelated to a specific channel.
+#[no_mangle]
+pub extern "C" fn WarningMessage_set_channel_id(this_ptr: &mut WarningMessage, mut val: crate::c_types::ThirtyTwoBytes) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data;
+}
+/// A possibly human-readable warning description.
+/// The string should be sanitized before it is used (e.g. emitted to logs or printed to
+/// stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
+/// the terminal emulator or the logging subsystem.
+#[no_mangle]
+pub extern "C" fn WarningMessage_get_data(this_ptr: &WarningMessage) -> crate::c_types::Str {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().data;
+       inner_val.as_str().into()
+}
+/// A possibly human-readable warning description.
+/// The string should be sanitized before it is used (e.g. emitted to logs or printed to
+/// stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
+/// the terminal emulator or the logging subsystem.
+#[no_mangle]
+pub extern "C" fn WarningMessage_set_data(this_ptr: &mut WarningMessage, mut val: crate::c_types::Str) {
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.data = val.into_string();
+}
+/// Constructs a new WarningMessage given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn WarningMessage_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut data_arg: crate::c_types::Str) -> WarningMessage {
+       WarningMessage { inner: ObjOps::heap_alloc(nativeWarningMessage {
+               channel_id: channel_id_arg.data,
+               data: data_arg.into_string(),
+       }), is_owned: true }
+}
+impl Clone for WarningMessage {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: if <*mut nativeWarningMessage>::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 WarningMessage_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeWarningMessage)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the WarningMessage
+pub extern "C" fn WarningMessage_clone(orig: &WarningMessage) -> WarningMessage {
+       orig.clone()
+}
+
 use lightning::ln::msgs::Ping as nativePingImport;
 pub(crate) type nativePing = nativePingImport;
 
@@ -342,7 +461,7 @@ impl Ping {
        pub(crate) fn take_inner(mut self) -> *mut nativePing {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -382,7 +501,7 @@ pub extern "C" fn Ping_new(mut ponglen_arg: u16, mut byteslen_arg: u16) -> Ping
 impl Clone for Ping {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativePing>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativePing>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -445,7 +564,7 @@ impl Pong {
        pub(crate) fn take_inner(mut self) -> *mut nativePong {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -473,7 +592,7 @@ pub extern "C" fn Pong_new(mut byteslen_arg: u16) -> Pong {
 impl Clone for Pong {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativePong>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativePong>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -536,7 +655,7 @@ impl OpenChannel {
        pub(crate) fn take_inner(mut self) -> *mut nativeOpenChannel {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -746,7 +865,7 @@ pub extern "C" fn OpenChannel_set_channel_flags(this_ptr: &mut OpenChannel, mut
 #[no_mangle]
 pub extern "C" fn OpenChannel_get_channel_type(this_ptr: &OpenChannel) -> crate::lightning::ln::features::ChannelTypeFeatures {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_type;
-       let mut local_inner_val = crate::lightning::ln::features::ChannelTypeFeatures { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::features::ChannelTypeFeatures<>) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::ln::features::ChannelTypeFeatures { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::features::ChannelTypeFeatures<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// The channel type that this channel will represent. If none is set, we derive the channel
@@ -762,7 +881,7 @@ pub extern "C" fn OpenChannel_set_channel_type(this_ptr: &mut OpenChannel, mut v
 impl Clone for OpenChannel {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeOpenChannel>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeOpenChannel>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -825,7 +944,7 @@ impl AcceptChannel {
        pub(crate) fn take_inner(mut self) -> *mut nativeAcceptChannel {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -983,10 +1102,35 @@ pub extern "C" fn AcceptChannel_get_first_per_commitment_point(this_ptr: &Accept
 pub extern "C" fn AcceptChannel_set_first_per_commitment_point(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.first_per_commitment_point = val.into_rust();
 }
+/// The channel type that this channel will represent. If none is set, we derive the channel
+/// type from the intersection of our feature bits with our counterparty's feature bits from
+/// the Init message.
+///
+/// This is required to match the equivalent field in [`OpenChannel::channel_type`].
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn AcceptChannel_get_channel_type(this_ptr: &AcceptChannel) -> crate::lightning::ln::features::ChannelTypeFeatures {
+       let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_type;
+       let mut local_inner_val = crate::lightning::ln::features::ChannelTypeFeatures { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::features::ChannelTypeFeatures<>) as *mut _ }, is_owned: false };
+       local_inner_val
+}
+/// The channel type that this channel will represent. If none is set, we derive the channel
+/// type from the intersection of our feature bits with our counterparty's feature bits from
+/// the Init message.
+///
+/// This is required to match the equivalent field in [`OpenChannel::channel_type`].
+///
+/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn AcceptChannel_set_channel_type(this_ptr: &mut AcceptChannel, mut val: crate::lightning::ln::features::ChannelTypeFeatures) {
+       let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
+       unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_type = local_val;
+}
 impl Clone for AcceptChannel {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeAcceptChannel>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeAcceptChannel>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -1049,7 +1193,7 @@ impl FundingCreated {
        pub(crate) fn take_inner(mut self) -> *mut nativeFundingCreated {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -1111,7 +1255,7 @@ pub extern "C" fn FundingCreated_new(mut temporary_channel_id_arg: crate::c_type
 impl Clone for FundingCreated {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeFundingCreated>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeFundingCreated>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -1174,7 +1318,7 @@ impl FundingSigned {
        pub(crate) fn take_inner(mut self) -> *mut nativeFundingSigned {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -1212,7 +1356,7 @@ pub extern "C" fn FundingSigned_new(mut channel_id_arg: crate::c_types::ThirtyTw
 impl Clone for FundingSigned {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeFundingSigned>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeFundingSigned>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -1275,7 +1419,7 @@ impl FundingLocked {
        pub(crate) fn take_inner(mut self) -> *mut nativeFundingLocked {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -1313,7 +1457,7 @@ pub extern "C" fn FundingLocked_new(mut channel_id_arg: crate::c_types::ThirtyTw
 impl Clone for FundingLocked {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeFundingLocked>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeFundingLocked>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -1376,7 +1520,7 @@ impl Shutdown {
        pub(crate) fn take_inner(mut self) -> *mut nativeShutdown {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -1416,7 +1560,7 @@ pub extern "C" fn Shutdown_new(mut channel_id_arg: crate::c_types::ThirtyTwoByte
 impl Clone for Shutdown {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeShutdown>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeShutdown>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -1481,7 +1625,7 @@ impl ClosingSignedFeeRange {
        pub(crate) fn take_inner(mut self) -> *mut nativeClosingSignedFeeRange {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -1523,7 +1667,7 @@ pub extern "C" fn ClosingSignedFeeRange_new(mut min_fee_satoshis_arg: u64, mut m
 impl Clone for ClosingSignedFeeRange {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeClosingSignedFeeRange>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeClosingSignedFeeRange>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -1586,7 +1730,7 @@ impl ClosingSigned {
        pub(crate) fn take_inner(mut self) -> *mut nativeClosingSigned {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -1630,7 +1774,7 @@ pub extern "C" fn ClosingSigned_set_signature(this_ptr: &mut ClosingSigned, mut
 #[no_mangle]
 pub extern "C" fn ClosingSigned_get_fee_range(this_ptr: &ClosingSigned) -> crate::lightning::ln::msgs::ClosingSignedFeeRange {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_range;
-       let mut local_inner_val = crate::lightning::ln::msgs::ClosingSignedFeeRange { 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::ClosingSignedFeeRange<>) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::ln::msgs::ClosingSignedFeeRange { 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::ClosingSignedFeeRange<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// The minimum and maximum fees which the sender is willing to accept, provided only by new
@@ -1657,7 +1801,7 @@ pub extern "C" fn ClosingSigned_new(mut channel_id_arg: crate::c_types::ThirtyTw
 impl Clone for ClosingSigned {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeClosingSigned>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeClosingSigned>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -1720,7 +1864,7 @@ impl UpdateAddHTLC {
        pub(crate) fn take_inner(mut self) -> *mut nativeUpdateAddHTLC {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -1782,7 +1926,7 @@ pub extern "C" fn UpdateAddHTLC_set_cltv_expiry(this_ptr: &mut UpdateAddHTLC, mu
 impl Clone for UpdateAddHTLC {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeUpdateAddHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeUpdateAddHTLC>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -1845,7 +1989,7 @@ impl UpdateFulfillHTLC {
        pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFulfillHTLC {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -1895,7 +2039,7 @@ pub extern "C" fn UpdateFulfillHTLC_new(mut channel_id_arg: crate::c_types::Thir
 impl Clone for UpdateFulfillHTLC {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeUpdateFulfillHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeUpdateFulfillHTLC>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -1958,7 +2102,7 @@ impl UpdateFailHTLC {
        pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFailHTLC {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -1987,7 +2131,7 @@ pub extern "C" fn UpdateFailHTLC_set_htlc_id(this_ptr: &mut UpdateFailHTLC, mut
 impl Clone for UpdateFailHTLC {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeUpdateFailHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeUpdateFailHTLC>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -2050,7 +2194,7 @@ impl UpdateFailMalformedHTLC {
        pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFailMalformedHTLC {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -2090,7 +2234,7 @@ pub extern "C" fn UpdateFailMalformedHTLC_set_failure_code(this_ptr: &mut Update
 impl Clone for UpdateFailMalformedHTLC {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeUpdateFailMalformedHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeUpdateFailMalformedHTLC>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -2153,7 +2297,7 @@ impl CommitmentSigned {
        pub(crate) fn take_inner(mut self) -> *mut nativeCommitmentSigned {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -2199,7 +2343,7 @@ pub extern "C" fn CommitmentSigned_new(mut channel_id_arg: crate::c_types::Thirt
 impl Clone for CommitmentSigned {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeCommitmentSigned>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeCommitmentSigned>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -2262,7 +2406,7 @@ impl RevokeAndACK {
        pub(crate) fn take_inner(mut self) -> *mut nativeRevokeAndACK {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -2312,7 +2456,7 @@ pub extern "C" fn RevokeAndACK_new(mut channel_id_arg: crate::c_types::ThirtyTwo
 impl Clone for RevokeAndACK {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeRevokeAndACK>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeRevokeAndACK>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -2375,7 +2519,7 @@ impl UpdateFee {
        pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFee {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -2413,7 +2557,7 @@ pub extern "C" fn UpdateFee_new(mut channel_id_arg: crate::c_types::ThirtyTwoByt
 impl Clone for UpdateFee {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeUpdateFee>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeUpdateFee>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -2479,7 +2623,7 @@ impl DataLossProtect {
        pub(crate) fn take_inner(mut self) -> *mut nativeDataLossProtect {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -2519,7 +2663,7 @@ pub extern "C" fn DataLossProtect_new(mut your_last_per_commitment_secret_arg: c
 impl Clone for DataLossProtect {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeDataLossProtect>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeDataLossProtect>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -2582,7 +2726,7 @@ impl ChannelReestablish {
        pub(crate) fn take_inner(mut self) -> *mut nativeChannelReestablish {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -2622,7 +2766,7 @@ pub extern "C" fn ChannelReestablish_set_next_remote_commitment_number(this_ptr:
 impl Clone for ChannelReestablish {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeChannelReestablish>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeChannelReestablish>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -2685,7 +2829,7 @@ impl AnnouncementSignatures {
        pub(crate) fn take_inner(mut self) -> *mut nativeAnnouncementSignatures {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -2747,7 +2891,7 @@ pub extern "C" fn AnnouncementSignatures_new(mut channel_id_arg: crate::c_types:
 impl Clone for AnnouncementSignatures {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeAnnouncementSignatures>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeAnnouncementSignatures>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -3040,7 +3184,7 @@ impl UnsignedNodeAnnouncement {
        pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedNodeAnnouncement {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -3112,7 +3256,7 @@ pub extern "C" fn UnsignedNodeAnnouncement_set_addresses(this_ptr: &mut Unsigned
 impl Clone for UnsignedNodeAnnouncement {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeUnsignedNodeAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeUnsignedNodeAnnouncement>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -3175,7 +3319,7 @@ impl NodeAnnouncement {
        pub(crate) fn take_inner(mut self) -> *mut nativeNodeAnnouncement {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -3213,7 +3357,7 @@ pub extern "C" fn NodeAnnouncement_new(mut signature_arg: crate::c_types::Signat
 impl Clone for NodeAnnouncement {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeNodeAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeNodeAnnouncement>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -3276,7 +3420,7 @@ impl UnsignedChannelAnnouncement {
        pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedChannelAnnouncement {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -3360,7 +3504,7 @@ pub extern "C" fn UnsignedChannelAnnouncement_set_bitcoin_key_2(this_ptr: &mut U
 impl Clone for UnsignedChannelAnnouncement {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeUnsignedChannelAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeUnsignedChannelAnnouncement>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -3423,7 +3567,7 @@ impl ChannelAnnouncement {
        pub(crate) fn take_inner(mut self) -> *mut nativeChannelAnnouncement {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -3497,7 +3641,7 @@ pub extern "C" fn ChannelAnnouncement_new(mut node_signature_1_arg: crate::c_typ
 impl Clone for ChannelAnnouncement {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeChannelAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeChannelAnnouncement>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -3560,7 +3704,7 @@ impl UnsignedChannelUpdate {
        pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedChannelUpdate {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -3669,7 +3813,7 @@ pub extern "C" fn UnsignedChannelUpdate_set_fee_proportional_millionths(this_ptr
 impl Clone for UnsignedChannelUpdate {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeUnsignedChannelUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeUnsignedChannelUpdate>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -3732,7 +3876,7 @@ impl ChannelUpdate {
        pub(crate) fn take_inner(mut self) -> *mut nativeChannelUpdate {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -3770,7 +3914,7 @@ pub extern "C" fn ChannelUpdate_new(mut signature_arg: crate::c_types::Signature
 impl Clone for ChannelUpdate {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeChannelUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeChannelUpdate>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -3836,7 +3980,7 @@ impl QueryChannelRange {
        pub(crate) fn take_inner(mut self) -> *mut nativeQueryChannelRange {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -3886,7 +4030,7 @@ pub extern "C" fn QueryChannelRange_new(mut chain_hash_arg: crate::c_types::Thir
 impl Clone for QueryChannelRange {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeQueryChannelRange>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeQueryChannelRange>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -3955,7 +4099,7 @@ impl ReplyChannelRange {
        pub(crate) fn take_inner(mut self) -> *mut nativeReplyChannelRange {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -4025,7 +4169,7 @@ pub extern "C" fn ReplyChannelRange_new(mut chain_hash_arg: crate::c_types::Thir
 impl Clone for ReplyChannelRange {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeReplyChannelRange>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeReplyChannelRange>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -4095,7 +4239,7 @@ impl QueryShortChannelIds {
        pub(crate) fn take_inner(mut self) -> *mut nativeQueryShortChannelIds {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -4129,7 +4273,7 @@ pub extern "C" fn QueryShortChannelIds_new(mut chain_hash_arg: crate::c_types::T
 impl Clone for QueryShortChannelIds {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeQueryShortChannelIds>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeQueryShortChannelIds>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -4195,7 +4339,7 @@ impl ReplyShortChannelIdsEnd {
        pub(crate) fn take_inner(mut self) -> *mut nativeReplyShortChannelIdsEnd {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -4235,7 +4379,7 @@ pub extern "C" fn ReplyShortChannelIdsEnd_new(mut chain_hash_arg: crate::c_types
 impl Clone for ReplyShortChannelIdsEnd {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeReplyShortChannelIdsEnd>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeReplyShortChannelIdsEnd>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -4300,7 +4444,7 @@ impl GossipTimestampFilter {
        pub(crate) fn take_inner(mut self) -> *mut nativeGossipTimestampFilter {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -4350,7 +4494,7 @@ pub extern "C" fn GossipTimestampFilter_new(mut chain_hash_arg: crate::c_types::
 impl Clone for GossipTimestampFilter {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeGossipTimestampFilter>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeGossipTimestampFilter>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -4392,6 +4536,15 @@ pub enum ErrorAction {
                /// The message to send.
                msg: crate::lightning::ln::msgs::ErrorMessage,
        },
+       /// The peer did something incorrect. Tell them without closing any channels.
+       SendWarningMessage {
+               /// The message to send.
+               msg: crate::lightning::ln::msgs::WarningMessage,
+               /// The peer may have done something harmless that we weren't able to meaningfully process,
+               /// though we should still tell them about it.
+               /// If this event is logged, log it at the given level.
+               log_level: crate::lightning::util::logger::Level,
+       },
 }
 use lightning::ln::msgs::ErrorAction as nativeErrorAction;
 impl ErrorAction {
@@ -4419,6 +4572,14 @@ impl ErrorAction {
                                        msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
                                }
                        },
+                       ErrorAction::SendWarningMessage {ref msg, ref log_level, } => {
+                               let mut msg_nonref = (*msg).clone();
+                               let mut log_level_nonref = (*log_level).clone();
+                               nativeErrorAction::SendWarningMessage {
+                                       msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
+                                       log_level: log_level_nonref.into_native(),
+                               }
+                       },
                }
        }
        #[allow(unused)]
@@ -4442,6 +4603,12 @@ impl ErrorAction {
                                        msg: *unsafe { Box::from_raw(msg.take_inner()) },
                                }
                        },
+                       ErrorAction::SendWarningMessage {mut msg, mut log_level, } => {
+                               nativeErrorAction::SendWarningMessage {
+                                       msg: *unsafe { Box::from_raw(msg.take_inner()) },
+                                       log_level: log_level.into_native(),
+                               }
+                       },
                }
        }
        #[allow(unused)]
@@ -4449,7 +4616,7 @@ impl ErrorAction {
                match native {
                        nativeErrorAction::DisconnectPeer {ref msg, } => {
                                let mut msg_nonref = (*msg).clone();
-                               let mut local_msg_nonref = crate::lightning::ln::msgs::ErrorMessage { inner: if msg_nonref.is_none() { std::ptr::null_mut() } else {  { ObjOps::heap_alloc((msg_nonref.unwrap())) } }, is_owned: true };
+                               let mut local_msg_nonref = crate::lightning::ln::msgs::ErrorMessage { inner: if msg_nonref.is_none() { core::ptr::null_mut() } else {  { ObjOps::heap_alloc((msg_nonref.unwrap())) } }, is_owned: true };
                                ErrorAction::DisconnectPeer {
                                        msg: local_msg_nonref,
                                }
@@ -4468,13 +4635,21 @@ impl ErrorAction {
                                        msg: crate::lightning::ln::msgs::ErrorMessage { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true },
                                }
                        },
+                       nativeErrorAction::SendWarningMessage {ref msg, ref log_level, } => {
+                               let mut msg_nonref = (*msg).clone();
+                               let mut log_level_nonref = (*log_level).clone();
+                               ErrorAction::SendWarningMessage {
+                                       msg: crate::lightning::ln::msgs::WarningMessage { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true },
+                                       log_level: crate::lightning::util::logger::Level::native_into(log_level_nonref),
+                               }
+                       },
                }
        }
        #[allow(unused)]
        pub(crate) fn native_into(native: nativeErrorAction) -> Self {
                match native {
                        nativeErrorAction::DisconnectPeer {mut msg, } => {
-                               let mut local_msg = crate::lightning::ln::msgs::ErrorMessage { inner: if msg.is_none() { std::ptr::null_mut() } else {  { ObjOps::heap_alloc((msg.unwrap())) } }, is_owned: true };
+                               let mut local_msg = crate::lightning::ln::msgs::ErrorMessage { inner: if msg.is_none() { core::ptr::null_mut() } else {  { ObjOps::heap_alloc((msg.unwrap())) } }, is_owned: true };
                                ErrorAction::DisconnectPeer {
                                        msg: local_msg,
                                }
@@ -4491,6 +4666,12 @@ impl ErrorAction {
                                        msg: crate::lightning::ln::msgs::ErrorMessage { inner: ObjOps::heap_alloc(msg), is_owned: true },
                                }
                        },
+                       nativeErrorAction::SendWarningMessage {mut msg, mut log_level, } => {
+                               ErrorAction::SendWarningMessage {
+                                       msg: crate::lightning::ln::msgs::WarningMessage { inner: ObjOps::heap_alloc(msg), is_owned: true },
+                                       log_level: crate::lightning::util::logger::Level::native_into(log_level),
+                               }
+                       },
                }
        }
 }
@@ -4529,6 +4710,14 @@ pub extern "C" fn ErrorAction_send_error_message(msg: crate::lightning::ln::msgs
                msg,
        }
 }
+#[no_mangle]
+/// Utility method to constructs a new SendWarningMessage-variant ErrorAction
+pub extern "C" fn ErrorAction_send_warning_message(msg: crate::lightning::ln::msgs::WarningMessage, log_level: crate::lightning::util::logger::Level) -> ErrorAction {
+       ErrorAction::SendWarningMessage {
+               msg,
+               log_level,
+       }
+}
 
 use lightning::ln::msgs::LightningError as nativeLightningErrorImport;
 pub(crate) type nativeLightningError = nativeLightningErrorImport;
@@ -4576,7 +4765,7 @@ impl LightningError {
        pub(crate) fn take_inner(mut self) -> *mut nativeLightningError {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -4614,7 +4803,7 @@ pub extern "C" fn LightningError_new(mut err_arg: crate::c_types::Str, mut actio
 impl Clone for LightningError {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeLightningError>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeLightningError>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -4678,7 +4867,7 @@ impl CommitmentUpdate {
        pub(crate) fn take_inner(mut self) -> *mut nativeCommitmentUpdate {
                assert!(self.is_owned);
                let ret = ObjOps::untweak_ptr(self.inner);
-               self.inner = std::ptr::null_mut();
+               self.inner = core::ptr::null_mut();
                ret
        }
 }
@@ -4740,7 +4929,7 @@ pub extern "C" fn CommitmentUpdate_set_update_fail_malformed_htlcs(this_ptr: &mu
 #[no_mangle]
 pub extern "C" fn CommitmentUpdate_get_update_fee(this_ptr: &CommitmentUpdate) -> crate::lightning::ln::msgs::UpdateFee {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().update_fee;
-       let mut local_inner_val = crate::lightning::ln::msgs::UpdateFee { 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::UpdateFee<>) as *mut _ }, is_owned: false };
+       let mut local_inner_val = crate::lightning::ln::msgs::UpdateFee { 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::UpdateFee<>) as *mut _ }, is_owned: false };
        local_inner_val
 }
 /// An update_fee message which should be sent
@@ -4783,7 +4972,7 @@ pub extern "C" fn CommitmentUpdate_new(mut update_add_htlcs_arg: crate::c_types:
 impl Clone for CommitmentUpdate {
        fn clone(&self) -> Self {
                Self {
-                       inner: if <*mut nativeCommitmentUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
+                       inner: if <*mut nativeCommitmentUpdate>::is_null(self.inner) { core::ptr::null_mut() } else {
                                ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
                        is_owned: true,
                }
@@ -4961,7 +5150,7 @@ impl rustChannelMessageHandler for ChannelMessageHandler {
 
 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
 // directly as a Deref trait in higher-level structs:
-impl std::ops::Deref for ChannelMessageHandler {
+impl core::ops::Deref for ChannelMessageHandler {
        type Target = Self;
        fn deref(&self) -> &Self {
                self
@@ -5126,7 +5315,7 @@ impl rustRoutingMessageHandler for RoutingMessageHandler {
 
 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
 // directly as a Deref trait in higher-level structs:
-impl std::ops::Deref for RoutingMessageHandler {
+impl core::ops::Deref for RoutingMessageHandler {
        type Target = Self;
        fn deref(&self) -> &Self {
                self
@@ -5144,11 +5333,13 @@ impl Drop for RoutingMessageHandler {
 }
 mod fuzzy_internal_msgs {
 
-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};
 
 }
 #[no_mangle]
@@ -5552,6 +5743,22 @@ pub extern "C" fn ErrorMessage_read(ser: crate::c_types::u8slice) -> crate::c_ty
        local_res
 }
 #[no_mangle]
+/// Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
+pub extern "C" fn WarningMessage_write(obj: &WarningMessage) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+}
+#[no_mangle]
+pub(crate) extern "C" fn WarningMessage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeWarningMessage) })
+}
+#[no_mangle]
+/// Read a WarningMessage from a byte array, created by WarningMessage_write
+pub extern "C" fn WarningMessage_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_WarningMessageDecodeErrorZ {
+       let res: Result<lightning::ln::msgs::WarningMessage, 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::ln::msgs::WarningMessage { 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 UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
 pub extern "C" fn UnsignedNodeAnnouncement_write(obj: &UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())