Merge pull request #39 from TheBlueMatt/main
[ldk-c-bindings] / lightning-c-bindings / src / lightning / ln / msgs.rs
index 9812571b66de89319301861a2c4060783111aa84..cdc862d7eb1702007abb33c90ed73727836f3665 100644 (file)
@@ -245,16 +245,16 @@ pub extern "C" fn ErrorMessage_get_data(this_ptr: &ErrorMessage) -> crate::c_typ
 /// 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::derived::CVec_u8Z) {
-       unsafe { &mut *this_ptr.inner }.data = String::from_utf8(val.into_rust()).unwrap();
+pub extern "C" fn ErrorMessage_set_data(this_ptr: &mut ErrorMessage, mut val: crate::c_types::Str) {
+       unsafe { &mut *this_ptr.inner }.data = val.into_string();
 }
 /// Constructs a new ErrorMessage given each field
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ErrorMessage_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut data_arg: crate::c_types::derived::CVec_u8Z) -> ErrorMessage {
+pub extern "C" fn ErrorMessage_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut data_arg: crate::c_types::Str) -> ErrorMessage {
        ErrorMessage { inner: Box::into_raw(Box::new(nativeErrorMessage {
                channel_id: channel_id_arg.data,
-               data: String::from_utf8(data_arg.into_rust()).unwrap(),
+               data: data_arg.into_string(),
        })), is_owned: true }
 }
 impl Clone for ErrorMessage {
@@ -1345,6 +1345,107 @@ pub extern "C" fn Shutdown_clone(orig: &Shutdown) -> Shutdown {
        orig.clone()
 }
 
+use lightning::ln::msgs::ClosingSignedFeeRange as nativeClosingSignedFeeRangeImport;
+type nativeClosingSignedFeeRange = nativeClosingSignedFeeRangeImport;
+
+/// The minimum and maximum fees which the sender is willing to place on the closing transaction.
+/// This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
+/// to use.
+#[must_use]
+#[repr(C)]
+pub struct ClosingSignedFeeRange {
+       /// 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 nativeClosingSignedFeeRange,
+       /// 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 ClosingSignedFeeRange {
+       fn drop(&mut self) {
+               if self.is_owned && !<*mut nativeClosingSignedFeeRange>::is_null(self.inner) {
+                       let _ = unsafe { Box::from_raw(self.inner) };
+               }
+       }
+}
+/// Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn ClosingSignedFeeRange_free(this_obj: ClosingSignedFeeRange) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn ClosingSignedFeeRange_free_void(this_ptr: *mut c_void) {
+       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeClosingSignedFeeRange); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl ClosingSignedFeeRange {
+       pub(crate) fn take_inner(mut self) -> *mut nativeClosingSignedFeeRange {
+               assert!(self.is_owned);
+               let ret = self.inner;
+               self.inner = std::ptr::null_mut();
+               ret
+       }
+}
+/// The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
+/// transaction.
+#[no_mangle]
+pub extern "C" fn ClosingSignedFeeRange_get_min_fee_satoshis(this_ptr: &ClosingSignedFeeRange) -> u64 {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.min_fee_satoshis;
+       *inner_val
+}
+/// The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
+/// transaction.
+#[no_mangle]
+pub extern "C" fn ClosingSignedFeeRange_set_min_fee_satoshis(this_ptr: &mut ClosingSignedFeeRange, mut val: u64) {
+       unsafe { &mut *this_ptr.inner }.min_fee_satoshis = val;
+}
+/// The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
+/// transaction.
+#[no_mangle]
+pub extern "C" fn ClosingSignedFeeRange_get_max_fee_satoshis(this_ptr: &ClosingSignedFeeRange) -> u64 {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_fee_satoshis;
+       *inner_val
+}
+/// The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
+/// transaction.
+#[no_mangle]
+pub extern "C" fn ClosingSignedFeeRange_set_max_fee_satoshis(this_ptr: &mut ClosingSignedFeeRange, mut val: u64) {
+       unsafe { &mut *this_ptr.inner }.max_fee_satoshis = val;
+}
+/// Constructs a new ClosingSignedFeeRange given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ClosingSignedFeeRange_new(mut min_fee_satoshis_arg: u64, mut max_fee_satoshis_arg: u64) -> ClosingSignedFeeRange {
+       ClosingSignedFeeRange { inner: Box::into_raw(Box::new(nativeClosingSignedFeeRange {
+               min_fee_satoshis: min_fee_satoshis_arg,
+               max_fee_satoshis: max_fee_satoshis_arg,
+       })), is_owned: true }
+}
+impl Clone for ClosingSignedFeeRange {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: if <*mut nativeClosingSignedFeeRange>::is_null(self.inner) { std::ptr::null_mut() } else {
+                               Box::into_raw(Box::new(unsafe { &*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 ClosingSignedFeeRange_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeClosingSignedFeeRange)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the ClosingSignedFeeRange
+pub extern "C" fn ClosingSignedFeeRange_clone(orig: &ClosingSignedFeeRange) -> ClosingSignedFeeRange {
+       orig.clone()
+}
+
 use lightning::ln::msgs::ClosingSigned as nativeClosingSignedImport;
 type nativeClosingSigned = nativeClosingSignedImport;
 
@@ -1422,14 +1523,35 @@ pub extern "C" fn ClosingSigned_get_signature(this_ptr: &ClosingSigned) -> crate
 pub extern "C" fn ClosingSigned_set_signature(this_ptr: &mut ClosingSigned, mut val: crate::c_types::Signature) {
        unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
 }
+/// The minimum and maximum fees which the sender is willing to accept, provided only by new
+/// nodes.
+///
+/// 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 ClosingSigned_get_fee_range(this_ptr: &ClosingSigned) -> crate::lightning::ln::msgs::ClosingSignedFeeRange {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_range;
+       let mut local_inner_val = crate::lightning::ln::msgs::ClosingSignedFeeRange { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else {  { (inner_val.as_ref().unwrap()) } } as *const _) as *mut _ }, is_owned: false };
+       local_inner_val
+}
+/// The minimum and maximum fees which the sender is willing to accept, provided only by new
+/// nodes.
+///
+/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn ClosingSigned_set_fee_range(this_ptr: &mut ClosingSigned, mut val: crate::lightning::ln::msgs::ClosingSignedFeeRange) {
+       let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
+       unsafe { &mut *this_ptr.inner }.fee_range = local_val;
+}
 /// Constructs a new ClosingSigned given each field
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ClosingSigned_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut fee_satoshis_arg: u64, mut signature_arg: crate::c_types::Signature) -> ClosingSigned {
+pub extern "C" fn ClosingSigned_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut fee_satoshis_arg: u64, mut signature_arg: crate::c_types::Signature, mut fee_range_arg: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> ClosingSigned {
+       let mut local_fee_range_arg = if fee_range_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(fee_range_arg.take_inner()) } }) };
        ClosingSigned { inner: Box::into_raw(Box::new(nativeClosingSigned {
                channel_id: channel_id_arg.data,
                fee_satoshis: fee_satoshis_arg,
                signature: signature_arg.into_rust(),
+               fee_range: local_fee_range_arg,
        })), is_owned: true }
 }
 impl Clone for ClosingSigned {
@@ -1538,7 +1660,7 @@ pub extern "C" fn UpdateAddHTLC_get_payment_hash(this_ptr: &UpdateAddHTLC) -> *c
 /// The payment hash, the pre-image of which controls HTLC redemption
 #[no_mangle]
 pub extern "C" fn UpdateAddHTLC_set_payment_hash(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
-       unsafe { &mut *this_ptr.inner }.payment_hash = ::lightning::ln::channelmanager::PaymentHash(val.data);
+       unsafe { &mut *this_ptr.inner }.payment_hash = ::lightning::ln::PaymentHash(val.data);
 }
 /// The expiry height of the HTLC
 #[no_mangle]
@@ -1646,7 +1768,7 @@ pub extern "C" fn UpdateFulfillHTLC_get_payment_preimage(this_ptr: &UpdateFulfil
 /// The pre-image of the payment hash, allowing HTLC redemption
 #[no_mangle]
 pub extern "C" fn UpdateFulfillHTLC_set_payment_preimage(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
-       unsafe { &mut *this_ptr.inner }.payment_preimage = ::lightning::ln::channelmanager::PaymentPreimage(val.data);
+       unsafe { &mut *this_ptr.inner }.payment_preimage = ::lightning::ln::PaymentPreimage(val.data);
 }
 /// Constructs a new UpdateFulfillHTLC given each field
 #[must_use]
@@ -1655,7 +1777,7 @@ pub extern "C" fn UpdateFulfillHTLC_new(mut channel_id_arg: crate::c_types::Thir
        UpdateFulfillHTLC { inner: Box::into_raw(Box::new(nativeUpdateFulfillHTLC {
                channel_id: channel_id_arg.data,
                htlc_id: htlc_id_arg,
-               payment_preimage: ::lightning::ln::channelmanager::PaymentPreimage(payment_preimage_arg.data),
+               payment_preimage: ::lightning::ln::PaymentPreimage(payment_preimage_arg.data),
        })), is_owned: true }
 }
 impl Clone for UpdateFulfillHTLC {
@@ -2677,6 +2799,40 @@ pub extern "C" fn NetAddress_clone(orig: &NetAddress) -> NetAddress {
        orig.clone()
 }
 #[no_mangle]
+/// Utility method to constructs a new IPv4-variant NetAddress
+pub extern "C" fn NetAddress_ipv4(addr: crate::c_types::FourBytes, port: u16) -> NetAddress {
+       NetAddress::IPv4 {
+               addr,
+               port,
+       }
+}
+#[no_mangle]
+/// Utility method to constructs a new IPv6-variant NetAddress
+pub extern "C" fn NetAddress_ipv6(addr: crate::c_types::SixteenBytes, port: u16) -> NetAddress {
+       NetAddress::IPv6 {
+               addr,
+               port,
+       }
+}
+#[no_mangle]
+/// Utility method to constructs a new OnionV2-variant NetAddress
+pub extern "C" fn NetAddress_onion_v2(addr: crate::c_types::TenBytes, port: u16) -> NetAddress {
+       NetAddress::OnionV2 {
+               addr,
+               port,
+       }
+}
+#[no_mangle]
+/// Utility method to constructs a new OnionV3-variant NetAddress
+pub extern "C" fn NetAddress_onion_v3(ed25519_pubkey: crate::c_types::ThirtyTwoBytes, checksum: u16, version: u8, port: u16) -> NetAddress {
+       NetAddress::OnionV3 {
+               ed25519_pubkey,
+               checksum,
+               version,
+               port,
+       }
+}
+#[no_mangle]
 /// Serialize the NetAddress object into a byte array which can be read by NetAddress_read
 pub extern "C" fn NetAddress_write(obj: &NetAddress) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
@@ -2688,6 +2844,13 @@ pub extern "C" fn Result_read(ser: crate::c_types::u8slice) -> crate::c_types::d
        let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = match o { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::NetAddress::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { e }).into() }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
        local_res
 }
+#[no_mangle]
+/// Read a NetAddress from a byte array, created by NetAddress_write
+pub extern "C" fn NetAddress_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NetAddressDecodeErrorZ {
+       let res = crate::c_types::deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::NetAddress::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
+       local_res
+}
 
 use lightning::ln::msgs::UnsignedNodeAnnouncement as nativeUnsignedNodeAnnouncementImport;
 type nativeUnsignedNodeAnnouncement = nativeUnsignedNodeAnnouncementImport;
@@ -4003,10 +4166,15 @@ pub enum ErrorAction {
        /// The peer took some action which made us think they were useless. Disconnect them.
        DisconnectPeer {
                /// An error message which we should make an effort to send before we disconnect.
+               ///
+               /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
                msg: crate::lightning::ln::msgs::ErrorMessage,
        },
        /// The peer did something harmless that we weren't able to process, just log and ignore
        IgnoreError,
+       /// The peer did something harmless that we weren't able to meaningfully process.
+       /// If the error is logged, log it at the given level.
+       IgnoreAndLog(crate::lightning::util::logger::Level),
        /// The peer did something incorrect. Tell them.
        SendErrorMessage {
                /// The message to send.
@@ -4026,6 +4194,12 @@ impl ErrorAction {
                                }
                        },
                        ErrorAction::IgnoreError => nativeErrorAction::IgnoreError,
+                       ErrorAction::IgnoreAndLog (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               nativeErrorAction::IgnoreAndLog (
+                                       a_nonref.into_native(),
+                               )
+                       },
                        ErrorAction::SendErrorMessage {ref msg, } => {
                                let mut msg_nonref = (*msg).clone();
                                nativeErrorAction::SendErrorMessage {
@@ -4044,6 +4218,11 @@ impl ErrorAction {
                                }
                        },
                        ErrorAction::IgnoreError => nativeErrorAction::IgnoreError,
+                       ErrorAction::IgnoreAndLog (mut a, ) => {
+                               nativeErrorAction::IgnoreAndLog (
+                                       a.into_native(),
+                               )
+                       },
                        ErrorAction::SendErrorMessage {mut msg, } => {
                                nativeErrorAction::SendErrorMessage {
                                        msg: *unsafe { Box::from_raw(msg.take_inner()) },
@@ -4062,6 +4241,12 @@ impl ErrorAction {
                                }
                        },
                        nativeErrorAction::IgnoreError => ErrorAction::IgnoreError,
+                       nativeErrorAction::IgnoreAndLog (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               ErrorAction::IgnoreAndLog (
+                                       crate::lightning::util::logger::Level::native_into(a_nonref),
+                               )
+                       },
                        nativeErrorAction::SendErrorMessage {ref msg, } => {
                                let mut msg_nonref = (*msg).clone();
                                ErrorAction::SendErrorMessage {
@@ -4080,6 +4265,11 @@ impl ErrorAction {
                                }
                        },
                        nativeErrorAction::IgnoreError => ErrorAction::IgnoreError,
+                       nativeErrorAction::IgnoreAndLog (mut a, ) => {
+                               ErrorAction::IgnoreAndLog (
+                                       crate::lightning::util::logger::Level::native_into(a),
+                               )
+                       },
                        nativeErrorAction::SendErrorMessage {mut msg, } => {
                                ErrorAction::SendErrorMessage {
                                        msg: crate::lightning::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(msg)), is_owned: true },
@@ -4096,6 +4286,29 @@ pub extern "C" fn ErrorAction_free(this_ptr: ErrorAction) { }
 pub extern "C" fn ErrorAction_clone(orig: &ErrorAction) -> ErrorAction {
        orig.clone()
 }
+#[no_mangle]
+/// Utility method to constructs a new DisconnectPeer-variant ErrorAction
+pub extern "C" fn ErrorAction_disconnect_peer(msg: crate::lightning::ln::msgs::ErrorMessage) -> ErrorAction {
+       ErrorAction::DisconnectPeer {
+               msg,
+       }
+}
+#[no_mangle]
+/// Utility method to constructs a new IgnoreError-variant ErrorAction
+pub extern "C" fn ErrorAction_ignore_error() -> ErrorAction {
+       ErrorAction::IgnoreError}
+#[no_mangle]
+/// Utility method to constructs a new IgnoreAndLog-variant ErrorAction
+pub extern "C" fn ErrorAction_ignore_and_log(a: crate::lightning::util::logger::Level) -> ErrorAction {
+       ErrorAction::IgnoreAndLog(a, )
+}
+#[no_mangle]
+/// Utility method to constructs a new SendErrorMessage-variant ErrorAction
+pub extern "C" fn ErrorAction_send_error_message(msg: crate::lightning::ln::msgs::ErrorMessage) -> ErrorAction {
+       ErrorAction::SendErrorMessage {
+               msg,
+       }
+}
 
 use lightning::ln::msgs::LightningError as nativeLightningErrorImport;
 type nativeLightningError = nativeLightningErrorImport;
@@ -4149,8 +4362,8 @@ pub extern "C" fn LightningError_get_err(this_ptr: &LightningError) -> crate::c_
 }
 /// A human-readable message describing the error
 #[no_mangle]
-pub extern "C" fn LightningError_set_err(this_ptr: &mut LightningError, mut val: crate::c_types::derived::CVec_u8Z) {
-       unsafe { &mut *this_ptr.inner }.err = String::from_utf8(val.into_rust()).unwrap();
+pub extern "C" fn LightningError_set_err(this_ptr: &mut LightningError, mut val: crate::c_types::Str) {
+       unsafe { &mut *this_ptr.inner }.err = val.into_string();
 }
 /// The action which should be taken against the offending peer.
 #[no_mangle]
@@ -4166,9 +4379,9 @@ pub extern "C" fn LightningError_set_action(this_ptr: &mut LightningError, mut v
 /// Constructs a new LightningError given each field
 #[must_use]
 #[no_mangle]
-pub extern "C" fn LightningError_new(mut err_arg: crate::c_types::derived::CVec_u8Z, mut action_arg: crate::lightning::ln::msgs::ErrorAction) -> LightningError {
+pub extern "C" fn LightningError_new(mut err_arg: crate::c_types::Str, mut action_arg: crate::lightning::ln::msgs::ErrorAction) -> LightningError {
        LightningError { inner: Box::into_raw(Box::new(nativeLightningError {
-               err: String::from_utf8(err_arg.into_rust()).unwrap(),
+               err: err_arg.into_string(),
                action: action_arg.into_native(),
        })), is_owned: true }
 }
@@ -4262,6 +4475,8 @@ pub extern "C" fn CommitmentUpdate_set_update_fail_malformed_htlcs(this_ptr: &mu
        unsafe { &mut *this_ptr.inner }.update_fail_malformed_htlcs = local_val;
 }
 /// An update_fee message which should be sent
+///
+/// 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 CommitmentUpdate_get_update_fee(this_ptr: &CommitmentUpdate) -> crate::lightning::ln::msgs::UpdateFee {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.update_fee;
@@ -4269,6 +4484,8 @@ pub extern "C" fn CommitmentUpdate_get_update_fee(this_ptr: &CommitmentUpdate) -
        local_inner_val
 }
 /// An update_fee message which should be sent
+///
+/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
 #[no_mangle]
 pub extern "C" fn CommitmentUpdate_set_update_fee(this_ptr: &mut CommitmentUpdate, mut val: crate::lightning::ln::msgs::UpdateFee) {
        let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
@@ -4461,6 +4678,29 @@ pub extern "C" fn HTLCFailChannelUpdate_free(this_ptr: HTLCFailChannelUpdate) {
 pub extern "C" fn HTLCFailChannelUpdate_clone(orig: &HTLCFailChannelUpdate) -> HTLCFailChannelUpdate {
        orig.clone()
 }
+#[no_mangle]
+/// Utility method to constructs a new ChannelUpdateMessage-variant HTLCFailChannelUpdate
+pub extern "C" fn HTLCFailChannelUpdate_channel_update_message(msg: crate::lightning::ln::msgs::ChannelUpdate) -> HTLCFailChannelUpdate {
+       HTLCFailChannelUpdate::ChannelUpdateMessage {
+               msg,
+       }
+}
+#[no_mangle]
+/// Utility method to constructs a new ChannelClosed-variant HTLCFailChannelUpdate
+pub extern "C" fn HTLCFailChannelUpdate_channel_closed(short_channel_id: u64, is_permanent: bool) -> HTLCFailChannelUpdate {
+       HTLCFailChannelUpdate::ChannelClosed {
+               short_channel_id,
+               is_permanent,
+       }
+}
+#[no_mangle]
+/// Utility method to constructs a new NodeFailure-variant HTLCFailChannelUpdate
+pub extern "C" fn HTLCFailChannelUpdate_node_failure(node_id: crate::c_types::PublicKey, is_permanent: bool) -> HTLCFailChannelUpdate {
+       HTLCFailChannelUpdate::NodeFailure {
+               node_id,
+               is_permanent,
+       }
+}
 /// A trait to describe an object which can receive channel messages.
 ///
 /// Messages MAY be called in parallel when they originate from different their_node_ids, however
@@ -4519,76 +4759,104 @@ pub struct ChannelMessageHandler {
        /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
        pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
 }
+unsafe impl Send for ChannelMessageHandler {}
+unsafe impl Sync for ChannelMessageHandler {}
+#[no_mangle]
+pub(crate) extern "C" fn ChannelMessageHandler_clone_fields(orig: &ChannelMessageHandler) -> ChannelMessageHandler {
+       ChannelMessageHandler {
+               this_arg: orig.this_arg,
+               handle_open_channel: Clone::clone(&orig.handle_open_channel),
+               handle_accept_channel: Clone::clone(&orig.handle_accept_channel),
+               handle_funding_created: Clone::clone(&orig.handle_funding_created),
+               handle_funding_signed: Clone::clone(&orig.handle_funding_signed),
+               handle_funding_locked: Clone::clone(&orig.handle_funding_locked),
+               handle_shutdown: Clone::clone(&orig.handle_shutdown),
+               handle_closing_signed: Clone::clone(&orig.handle_closing_signed),
+               handle_update_add_htlc: Clone::clone(&orig.handle_update_add_htlc),
+               handle_update_fulfill_htlc: Clone::clone(&orig.handle_update_fulfill_htlc),
+               handle_update_fail_htlc: Clone::clone(&orig.handle_update_fail_htlc),
+               handle_update_fail_malformed_htlc: Clone::clone(&orig.handle_update_fail_malformed_htlc),
+               handle_commitment_signed: Clone::clone(&orig.handle_commitment_signed),
+               handle_revoke_and_ack: Clone::clone(&orig.handle_revoke_and_ack),
+               handle_update_fee: Clone::clone(&orig.handle_update_fee),
+               handle_announcement_signatures: Clone::clone(&orig.handle_announcement_signatures),
+               peer_disconnected: Clone::clone(&orig.peer_disconnected),
+               peer_connected: Clone::clone(&orig.peer_connected),
+               handle_channel_reestablish: Clone::clone(&orig.handle_channel_reestablish),
+               handle_channel_update: Clone::clone(&orig.handle_channel_update),
+               handle_error: Clone::clone(&orig.handle_error),
+               MessageSendEventsProvider: crate::lightning::util::events::MessageSendEventsProvider_clone_fields(&orig.MessageSendEventsProvider),
+               free: Clone::clone(&orig.free),
+       }
+}
 impl lightning::util::events::MessageSendEventsProvider for ChannelMessageHandler {
        fn get_and_clear_pending_msg_events(&self) -> Vec<lightning::util::events::MessageSendEvent> {
-               let mut ret = (self.MessageSendEventsProvider.get_and_clear_pending_msg_events)(self.this_arg);
+               let mut ret = (self.MessageSendEventsProvider.get_and_clear_pending_msg_events)(self.MessageSendEventsProvider.this_arg);
                let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); };
                local_ret
        }
 }
-unsafe impl Send for ChannelMessageHandler {}
-unsafe impl Sync for ChannelMessageHandler {}
 
 use lightning::ln::msgs::ChannelMessageHandler as rustChannelMessageHandler;
 impl rustChannelMessageHandler for ChannelMessageHandler {
-       fn handle_open_channel(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, their_features: lightning::ln::features::InitFeatures, msg: &lightning::ln::msgs::OpenChannel) {
+       fn handle_open_channel(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut their_features: lightning::ln::features::InitFeatures, mut msg: &lightning::ln::msgs::OpenChannel) {
                (self.handle_open_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::features::InitFeatures { inner: Box::into_raw(Box::new(their_features)), is_owned: true }, &crate::lightning::ln::msgs::OpenChannel { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_accept_channel(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, their_features: lightning::ln::features::InitFeatures, msg: &lightning::ln::msgs::AcceptChannel) {
+       fn handle_accept_channel(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut their_features: lightning::ln::features::InitFeatures, mut msg: &lightning::ln::msgs::AcceptChannel) {
                (self.handle_accept_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::features::InitFeatures { inner: Box::into_raw(Box::new(their_features)), is_owned: true }, &crate::lightning::ln::msgs::AcceptChannel { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_funding_created(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::FundingCreated) {
+       fn handle_funding_created(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::FundingCreated) {
                (self.handle_funding_created)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingCreated { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_funding_signed(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::FundingSigned) {
+       fn handle_funding_signed(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::FundingSigned) {
                (self.handle_funding_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingSigned { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_funding_locked(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::FundingLocked) {
+       fn handle_funding_locked(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::FundingLocked) {
                (self.handle_funding_locked)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingLocked { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_shutdown(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, their_features: &lightning::ln::features::InitFeatures, msg: &lightning::ln::msgs::Shutdown) {
+       fn handle_shutdown(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut their_features: &lightning::ln::features::InitFeatures, mut msg: &lightning::ln::msgs::Shutdown) {
                (self.handle_shutdown)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::features::InitFeatures { inner: unsafe { (their_features as *const _) as *mut _ }, is_owned: false }, &crate::lightning::ln::msgs::Shutdown { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_closing_signed(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ClosingSigned) {
+       fn handle_closing_signed(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ClosingSigned) {
                (self.handle_closing_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ClosingSigned { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_update_add_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateAddHTLC) {
+       fn handle_update_add_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateAddHTLC) {
                (self.handle_update_add_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateAddHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_update_fulfill_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFulfillHTLC) {
+       fn handle_update_fulfill_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFulfillHTLC) {
                (self.handle_update_fulfill_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_update_fail_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFailHTLC) {
+       fn handle_update_fail_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailHTLC) {
                (self.handle_update_fail_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_update_fail_malformed_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFailMalformedHTLC) {
+       fn handle_update_fail_malformed_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailMalformedHTLC) {
                (self.handle_update_fail_malformed_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailMalformedHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_commitment_signed(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::CommitmentSigned) {
+       fn handle_commitment_signed(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::CommitmentSigned) {
                (self.handle_commitment_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_revoke_and_ack(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::RevokeAndACK) {
+       fn handle_revoke_and_ack(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::RevokeAndACK) {
                (self.handle_revoke_and_ack)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::RevokeAndACK { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_update_fee(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFee) {
+       fn handle_update_fee(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFee) {
                (self.handle_update_fee)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFee { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_announcement_signatures(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::AnnouncementSignatures) {
+       fn handle_announcement_signatures(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::AnnouncementSignatures) {
                (self.handle_announcement_signatures)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::AnnouncementSignatures { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn peer_disconnected(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, no_connection_possible: bool) {
+       fn peer_disconnected(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut no_connection_possible: bool) {
                (self.peer_disconnected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), no_connection_possible)
        }
-       fn peer_connected(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::Init) {
+       fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::Init) {
                (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_channel_reestablish(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ChannelReestablish) {
+       fn handle_channel_reestablish(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ChannelReestablish) {
                (self.handle_channel_reestablish)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelReestablish { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_channel_update(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ChannelUpdate) {
+       fn handle_channel_update(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ChannelUpdate) {
                (self.handle_channel_update)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_error(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ErrorMessage) {
+       fn handle_error(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ErrorMessage) {
                (self.handle_error)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ErrorMessage { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
        }
 }
@@ -4646,6 +4914,8 @@ pub struct RoutingMessageHandler {
        /// starting at the node *after* the provided publickey and including batch_amount entries
        /// immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
        /// If None is provided for starting_point, we start at the first node.
+       ///
+       /// Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
        #[must_use]
        pub get_next_node_announcements: extern "C" fn (this_arg: *const c_void, starting_point: crate::c_types::PublicKey, batch_amount: u8) -> crate::c_types::derived::CVec_NodeAnnouncementZ,
        /// Called when a connection is established with a peer. This can be used to
@@ -4679,9 +4949,28 @@ pub struct RoutingMessageHandler {
 }
 unsafe impl Send for RoutingMessageHandler {}
 unsafe impl Sync for RoutingMessageHandler {}
+#[no_mangle]
+pub(crate) extern "C" fn RoutingMessageHandler_clone_fields(orig: &RoutingMessageHandler) -> RoutingMessageHandler {
+       RoutingMessageHandler {
+               this_arg: orig.this_arg,
+               handle_node_announcement: Clone::clone(&orig.handle_node_announcement),
+               handle_channel_announcement: Clone::clone(&orig.handle_channel_announcement),
+               handle_channel_update: Clone::clone(&orig.handle_channel_update),
+               handle_htlc_fail_channel_update: Clone::clone(&orig.handle_htlc_fail_channel_update),
+               get_next_channel_announcements: Clone::clone(&orig.get_next_channel_announcements),
+               get_next_node_announcements: Clone::clone(&orig.get_next_node_announcements),
+               sync_routing_table: Clone::clone(&orig.sync_routing_table),
+               handle_reply_channel_range: Clone::clone(&orig.handle_reply_channel_range),
+               handle_reply_short_channel_ids_end: Clone::clone(&orig.handle_reply_short_channel_ids_end),
+               handle_query_channel_range: Clone::clone(&orig.handle_query_channel_range),
+               handle_query_short_channel_ids: Clone::clone(&orig.handle_query_short_channel_ids),
+               MessageSendEventsProvider: crate::lightning::util::events::MessageSendEventsProvider_clone_fields(&orig.MessageSendEventsProvider),
+               free: Clone::clone(&orig.free),
+       }
+}
 impl lightning::util::events::MessageSendEventsProvider for RoutingMessageHandler {
        fn get_and_clear_pending_msg_events(&self) -> Vec<lightning::util::events::MessageSendEvent> {
-               let mut ret = (self.MessageSendEventsProvider.get_and_clear_pending_msg_events)(self.this_arg);
+               let mut ret = (self.MessageSendEventsProvider.get_and_clear_pending_msg_events)(self.MessageSendEventsProvider.this_arg);
                let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); };
                local_ret
        }
@@ -4689,54 +4978,54 @@ impl lightning::util::events::MessageSendEventsProvider for RoutingMessageHandle
 
 use lightning::ln::msgs::RoutingMessageHandler as rustRoutingMessageHandler;
 impl rustRoutingMessageHandler for RoutingMessageHandler {
-       fn handle_node_announcement(&self, msg: &lightning::ln::msgs::NodeAnnouncement) -> Result<bool, lightning::ln::msgs::LightningError> {
+       fn handle_node_announcement(&self, mut msg: &lightning::ln::msgs::NodeAnnouncement) -> Result<bool, lightning::ln::msgs::LightningError> {
                let mut ret = (self.handle_node_announcement)(self.this_arg, &crate::lightning::ln::msgs::NodeAnnouncement { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }) }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
                local_ret
        }
-       fn handle_channel_announcement(&self, msg: &lightning::ln::msgs::ChannelAnnouncement) -> Result<bool, lightning::ln::msgs::LightningError> {
+       fn handle_channel_announcement(&self, mut msg: &lightning::ln::msgs::ChannelAnnouncement) -> Result<bool, lightning::ln::msgs::LightningError> {
                let mut ret = (self.handle_channel_announcement)(self.this_arg, &crate::lightning::ln::msgs::ChannelAnnouncement { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }) }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
                local_ret
        }
-       fn handle_channel_update(&self, msg: &lightning::ln::msgs::ChannelUpdate) -> Result<bool, lightning::ln::msgs::LightningError> {
+       fn handle_channel_update(&self, mut msg: &lightning::ln::msgs::ChannelUpdate) -> Result<bool, lightning::ln::msgs::LightningError> {
                let mut ret = (self.handle_channel_update)(self.this_arg, &crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false });
                let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }) }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
                local_ret
        }
-       fn handle_htlc_fail_channel_update(&self, update: &lightning::ln::msgs::HTLCFailChannelUpdate) {
+       fn handle_htlc_fail_channel_update(&self, mut update: &lightning::ln::msgs::HTLCFailChannelUpdate) {
                (self.handle_htlc_fail_channel_update)(self.this_arg, &crate::lightning::ln::msgs::HTLCFailChannelUpdate::from_native(update))
        }
-       fn get_next_channel_announcements(&self, starting_point: u64, batch_amount: u8) -> Vec<(lightning::ln::msgs::ChannelAnnouncement, Option<lightning::ln::msgs::ChannelUpdate>, Option<lightning::ln::msgs::ChannelUpdate>)> {
+       fn get_next_channel_announcements(&self, mut starting_point: u64, mut batch_amount: u8) -> Vec<(lightning::ln::msgs::ChannelAnnouncement, Option<lightning::ln::msgs::ChannelUpdate>, Option<lightning::ln::msgs::ChannelUpdate>)> {
                let mut ret = (self.get_next_channel_announcements)(self.this_arg, starting_point, batch_amount);
                let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2) = item.to_rust(); let mut local_orig_ret_0_1 = if orig_ret_0_1.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) } }) }; let mut local_orig_ret_0_2 = if orig_ret_0_2.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(orig_ret_0_2.take_inner()) } }) }; let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, local_orig_ret_0_1, local_orig_ret_0_2); local_ret_0 }); };
                local_ret
        }
-       fn get_next_node_announcements(&self, starting_point: Option<&bitcoin::secp256k1::key::PublicKey>, batch_amount: u8) -> Vec<lightning::ln::msgs::NodeAnnouncement> {
+       fn get_next_node_announcements(&self, mut starting_point: Option<&bitcoin::secp256k1::key::PublicKey>, mut batch_amount: u8) -> Vec<lightning::ln::msgs::NodeAnnouncement> {
                let mut local_starting_point = if starting_point.is_none() { crate::c_types::PublicKey::null() } else {  { crate::c_types::PublicKey::from_rust(&(starting_point.unwrap())) } };
                let mut ret = (self.get_next_node_announcements)(self.this_arg, local_starting_point, batch_amount);
                let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
                local_ret
        }
-       fn sync_routing_table(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, init: &lightning::ln::msgs::Init) {
+       fn sync_routing_table(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut init: &lightning::ln::msgs::Init) {
                (self.sync_routing_table)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { (init as *const _) as *mut _ }, is_owned: false })
        }
-       fn handle_reply_channel_range(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
+       fn handle_reply_channel_range(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
                let mut ret = (self.handle_reply_channel_range)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::ReplyChannelRange { inner: Box::into_raw(Box::new(msg)), is_owned: true });
                let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
                local_ret
        }
-       fn handle_reply_short_channel_ids_end(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: lightning::ln::msgs::ReplyShortChannelIdsEnd) -> Result<(), lightning::ln::msgs::LightningError> {
+       fn handle_reply_short_channel_ids_end(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: lightning::ln::msgs::ReplyShortChannelIdsEnd) -> Result<(), lightning::ln::msgs::LightningError> {
                let mut ret = (self.handle_reply_short_channel_ids_end)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::ReplyShortChannelIdsEnd { inner: Box::into_raw(Box::new(msg)), is_owned: true });
                let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
                local_ret
        }
-       fn handle_query_channel_range(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: lightning::ln::msgs::QueryChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
+       fn handle_query_channel_range(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: lightning::ln::msgs::QueryChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
                let mut ret = (self.handle_query_channel_range)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::QueryChannelRange { inner: Box::into_raw(Box::new(msg)), is_owned: true });
                let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
                local_ret
        }
-       fn handle_query_short_channel_ids(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: lightning::ln::msgs::QueryShortChannelIds) -> Result<(), lightning::ln::msgs::LightningError> {
+       fn handle_query_short_channel_ids(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: lightning::ln::msgs::QueryShortChannelIds) -> Result<(), lightning::ln::msgs::LightningError> {
                let mut ret = (self.handle_query_short_channel_ids)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::QueryShortChannelIds { inner: Box::into_raw(Box::new(msg)), is_owned: true });
                let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
                local_ret
@@ -4834,6 +5123,22 @@ pub extern "C" fn ClosingSigned_read(ser: crate::c_types::u8slice) -> crate::c_t
        local_res
 }
 #[no_mangle]
+/// Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
+pub extern "C" fn ClosingSignedFeeRange_write(obj: &ClosingSignedFeeRange) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
+}
+#[no_mangle]
+pub(crate) extern "C" fn ClosingSignedFeeRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeClosingSignedFeeRange) })
+}
+#[no_mangle]
+/// Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
+pub extern "C" fn ClosingSignedFeeRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ClosingSignedFeeRangeDecodeErrorZ {
+       let res = crate::c_types::deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ClosingSignedFeeRange { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
+       local_res
+}
+#[no_mangle]
 /// Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
 pub extern "C" fn CommitmentSigned_write(obj: &CommitmentSigned) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })