Merge pull request #27 from TheBlueMatt/main
[ldk-c-bindings] / lightning-c-bindings / src / lightning / ln / channelmanager.rs
index 9530c750ce7cd9d3b3637bfc4fa463bf0031019c..164e944bff7277a91167176960de02e5f7887109 100644 (file)
@@ -17,6 +17,7 @@
 //! imply it needs to fail HTLCs/payments/channels it manages).
 //!
 
+use std::str::FromStr;
 use std::ffi::c_void;
 use bitcoin::hashes::Hash;
 use crate::c_types::*;
@@ -154,7 +155,7 @@ impl ChainParameters {
 #[no_mangle]
 pub extern "C" fn ChainParameters_get_network(this_ptr: &ChainParameters) -> crate::bitcoin::network::Network {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.network;
-       crate::bitcoin::network::Network::from_bitcoin((*inner_val))
+       crate::bitcoin::network::Network::from_bitcoin(inner_val)
 }
 /// The network for determining the `chain_hash` in Lightning messages.
 #[no_mangle]
@@ -167,7 +168,7 @@ pub extern "C" fn ChainParameters_set_network(this_ptr: &mut ChainParameters, mu
 #[no_mangle]
 pub extern "C" fn ChainParameters_get_best_block(this_ptr: &ChainParameters) -> crate::lightning::ln::channelmanager::BestBlock {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.best_block;
-       crate::lightning::ln::channelmanager::BestBlock { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::channelmanager::BestBlock { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
 }
 /// The hash and height of the latest block successfully connected.
 ///
@@ -185,6 +186,25 @@ pub extern "C" fn ChainParameters_new(mut network_arg: crate::bitcoin::network::
                best_block: *unsafe { Box::from_raw(best_block_arg.take_inner()) },
        })), is_owned: true }
 }
+impl Clone for ChainParameters {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: if <*mut nativeChainParameters>::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 ChainParameters_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChainParameters)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the ChainParameters
+pub extern "C" fn ChainParameters_clone(orig: &ChainParameters) -> ChainParameters {
+       orig.clone()
+}
 
 use lightning::ln::channelmanager::BestBlock as nativeBestBlockImport;
 type nativeBestBlock = nativeBestBlockImport;
@@ -291,7 +311,7 @@ pub extern "C" fn BestBlock_height(this_arg: &BestBlock) -> u32 {
 #[no_mangle]
 pub static BREAKDOWN_TIMEOUT: u16 = lightning::ln::channelmanager::BREAKDOWN_TIMEOUT;
 /// The minimum number of blocks between an inbound HTLC's CLTV and the corresponding outbound
-/// HTLC's CLTV. The current default represents roughly six hours of blocks at six blocks/hour.
+/// HTLC's CLTV. The current default represents roughly seven hours of blocks at six blocks/hour.
 ///
 /// This can be increased (but not decreased) through [`ChannelConfig::cltv_expiry_delta`]
 ///
@@ -299,6 +319,12 @@ pub static BREAKDOWN_TIMEOUT: u16 = lightning::ln::channelmanager::BREAKDOWN_TIM
 
 #[no_mangle]
 pub static MIN_CLTV_EXPIRY_DELTA: u16 = lightning::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA;
+/// Minimum CLTV difference between the current block height and received inbound payments.
+/// Invoices generated for payment to us must set their `min_final_cltv_expiry` field to at least
+/// this value.
+
+#[no_mangle]
+pub static MIN_FINAL_CLTV_EXPIRY: u32 = lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY;
 
 use lightning::ln::channelmanager::ChannelDetails as nativeChannelDetailsImport;
 type nativeChannelDetails = nativeChannelDetailsImport;
@@ -351,7 +377,7 @@ impl ChannelDetails {
 #[no_mangle]
 pub extern "C" fn ChannelDetails_get_channel_id(this_ptr: &ChannelDetails) -> *const [u8; 32] {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
-       &(*inner_val)
+       inner_val
 }
 /// The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
 /// thereafter this is the txid of the funding transaction xor the funding transaction output).
@@ -361,6 +387,27 @@ pub extern "C" fn ChannelDetails_get_channel_id(this_ptr: &ChannelDetails) -> *c
 pub extern "C" fn ChannelDetails_set_channel_id(this_ptr: &mut ChannelDetails, mut val: crate::c_types::ThirtyTwoBytes) {
        unsafe { &mut *this_ptr.inner }.channel_id = val.data;
 }
+/// The Channel's funding transaction output, if we've negotiated the funding transaction with
+/// our counterparty already.
+///
+/// Note that, if this has been set, `channel_id` will be equivalent to
+/// `funding_txo.unwrap().to_channel_id()`.
+#[no_mangle]
+pub extern "C" fn ChannelDetails_get_funding_txo(this_ptr: &ChannelDetails) -> crate::lightning::chain::transaction::OutPoint {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_txo;
+       let mut local_inner_val = crate::lightning::chain::transaction::OutPoint { 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 Channel's funding transaction output, if we've negotiated the funding transaction with
+/// our counterparty already.
+///
+/// Note that, if this has been set, `channel_id` will be equivalent to
+/// `funding_txo.unwrap().to_channel_id()`.
+#[no_mangle]
+pub extern "C" fn ChannelDetails_set_funding_txo(this_ptr: &mut ChannelDetails, mut val: crate::lightning::chain::transaction::OutPoint) {
+       let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
+       unsafe { &mut *this_ptr.inner }.funding_txo = local_val;
+}
 /// The position of the funding transaction in the chain. None if the funding transaction has
 /// not yet been confirmed and the channel fully opened.
 #[no_mangle]
@@ -380,7 +427,7 @@ pub extern "C" fn ChannelDetails_set_short_channel_id(this_ptr: &mut ChannelDeta
 #[no_mangle]
 pub extern "C" fn ChannelDetails_get_remote_network_id(this_ptr: &ChannelDetails) -> crate::c_types::PublicKey {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.remote_network_id;
-       crate::c_types::PublicKey::from_rust(&(*inner_val))
+       crate::c_types::PublicKey::from_rust(&inner_val)
 }
 /// The node_id of our counterparty
 #[no_mangle]
@@ -393,7 +440,7 @@ pub extern "C" fn ChannelDetails_set_remote_network_id(this_ptr: &mut ChannelDet
 #[no_mangle]
 pub extern "C" fn ChannelDetails_get_counterparty_features(this_ptr: &ChannelDetails) -> crate::lightning::ln::features::InitFeatures {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.counterparty_features;
-       crate::lightning::ln::features::InitFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::ln::features::InitFeatures { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
 }
 /// The Features the channel counterparty provided upon last connection.
 /// Useful for routing as it is the most up-to-date copy of the counterparty's features and
@@ -406,7 +453,7 @@ pub extern "C" fn ChannelDetails_set_counterparty_features(this_ptr: &mut Channe
 #[no_mangle]
 pub extern "C" fn ChannelDetails_get_channel_value_satoshis(this_ptr: &ChannelDetails) -> u64 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_value_satoshis;
-       (*inner_val)
+       *inner_val
 }
 /// The value, in satoshis, of this channel as appears in the funding output
 #[no_mangle]
@@ -417,7 +464,7 @@ pub extern "C" fn ChannelDetails_set_channel_value_satoshis(this_ptr: &mut Chann
 #[no_mangle]
 pub extern "C" fn ChannelDetails_get_user_id(this_ptr: &ChannelDetails) -> u64 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.user_id;
-       (*inner_val)
+       *inner_val
 }
 /// The user_id passed in to create_channel, or 0 if the channel was inbound.
 #[no_mangle]
@@ -431,7 +478,7 @@ pub extern "C" fn ChannelDetails_set_user_id(this_ptr: &mut ChannelDetails, mut
 #[no_mangle]
 pub extern "C" fn ChannelDetails_get_outbound_capacity_msat(this_ptr: &ChannelDetails) -> u64 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.outbound_capacity_msat;
-       (*inner_val)
+       *inner_val
 }
 /// The available outbound capacity for sending HTLCs to the remote peer. This does not include
 /// any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
@@ -449,7 +496,7 @@ pub extern "C" fn ChannelDetails_set_outbound_capacity_msat(this_ptr: &mut Chann
 #[no_mangle]
 pub extern "C" fn ChannelDetails_get_inbound_capacity_msat(this_ptr: &ChannelDetails) -> u64 {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.inbound_capacity_msat;
-       (*inner_val)
+       *inner_val
 }
 /// The available inbound capacity for the remote peer to send HTLCs to us. This does not
 /// include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
@@ -460,18 +507,63 @@ pub extern "C" fn ChannelDetails_get_inbound_capacity_msat(this_ptr: &ChannelDet
 pub extern "C" fn ChannelDetails_set_inbound_capacity_msat(this_ptr: &mut ChannelDetails, mut val: u64) {
        unsafe { &mut *this_ptr.inner }.inbound_capacity_msat = val;
 }
+/// True if the channel was initiated (and thus funded) by us.
+#[no_mangle]
+pub extern "C" fn ChannelDetails_get_is_outbound(this_ptr: &ChannelDetails) -> bool {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.is_outbound;
+       *inner_val
+}
+/// True if the channel was initiated (and thus funded) by us.
+#[no_mangle]
+pub extern "C" fn ChannelDetails_set_is_outbound(this_ptr: &mut ChannelDetails, mut val: bool) {
+       unsafe { &mut *this_ptr.inner }.is_outbound = val;
+}
+/// True if the channel is confirmed, funding_locked messages have been exchanged, and the
+/// channel is not currently being shut down. `funding_locked` message exchange implies the
+/// required confirmation count has been reached (and we were connected to the peer at some
+/// point after the funding transaction received enough confirmations).
+#[no_mangle]
+pub extern "C" fn ChannelDetails_get_is_funding_locked(this_ptr: &ChannelDetails) -> bool {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.is_funding_locked;
+       *inner_val
+}
+/// True if the channel is confirmed, funding_locked messages have been exchanged, and the
+/// channel is not currently being shut down. `funding_locked` message exchange implies the
+/// required confirmation count has been reached (and we were connected to the peer at some
+/// point after the funding transaction received enough confirmations).
+#[no_mangle]
+pub extern "C" fn ChannelDetails_set_is_funding_locked(this_ptr: &mut ChannelDetails, mut val: bool) {
+       unsafe { &mut *this_ptr.inner }.is_funding_locked = val;
+}
 /// True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
-/// the peer is connected, and (c) no monitor update failure is pending resolution.
+/// the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
+/// channel is not currently negotiating a shutdown.
+///
+/// This is a strict superset of `is_funding_locked`.
 #[no_mangle]
-pub extern "C" fn ChannelDetails_get_is_live(this_ptr: &ChannelDetails) -> bool {
-       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.is_live;
-       (*inner_val)
+pub extern "C" fn ChannelDetails_get_is_usable(this_ptr: &ChannelDetails) -> bool {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.is_usable;
+       *inner_val
 }
 /// True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
-/// the peer is connected, and (c) no monitor update failure is pending resolution.
+/// the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
+/// channel is not currently negotiating a shutdown.
+///
+/// This is a strict superset of `is_funding_locked`.
 #[no_mangle]
-pub extern "C" fn ChannelDetails_set_is_live(this_ptr: &mut ChannelDetails, mut val: bool) {
-       unsafe { &mut *this_ptr.inner }.is_live = val;
+pub extern "C" fn ChannelDetails_set_is_usable(this_ptr: &mut ChannelDetails, mut val: bool) {
+       unsafe { &mut *this_ptr.inner }.is_usable = val;
+}
+/// True if this channel is (or will be) publicly-announced.
+#[no_mangle]
+pub extern "C" fn ChannelDetails_get_is_public(this_ptr: &ChannelDetails) -> bool {
+       let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.is_public;
+       *inner_val
+}
+/// True if this channel is (or will be) publicly-announced.
+#[no_mangle]
+pub extern "C" fn ChannelDetails_set_is_public(this_ptr: &mut ChannelDetails, mut val: bool) {
+       unsafe { &mut *this_ptr.inner }.is_public = val;
 }
 impl Clone for ChannelDetails {
        fn clone(&self) -> Self {
@@ -602,7 +694,7 @@ impl PaymentSendFailure {
                        },
                        nativePaymentSendFailure::PathParameterError (ref a, ) => {
                                let mut a_nonref = (*a).clone();
-                               let mut local_a_nonref = Vec::new(); for mut item in a_nonref.drain(..) { local_a_nonref.push( { let mut local_a_nonref_0 = match item { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_a_nonref_0 }); };
+                               let mut local_a_nonref = Vec::new(); for mut item in a_nonref.drain(..) { local_a_nonref.push( { let mut local_a_nonref_0 = match item { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_a_nonref_0 }); };
                                PaymentSendFailure::PathParameterError (
                                        local_a_nonref.into(),
                                )
@@ -616,7 +708,7 @@ impl PaymentSendFailure {
                        },
                        nativePaymentSendFailure::PartialFailure (ref a, ) => {
                                let mut a_nonref = (*a).clone();
-                               let mut local_a_nonref = Vec::new(); for mut item in a_nonref.drain(..) { local_a_nonref.push( { let mut local_a_nonref_0 = match item { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_a_nonref_0 }); };
+                               let mut local_a_nonref = Vec::new(); for mut item in a_nonref.drain(..) { local_a_nonref.push( { let mut local_a_nonref_0 = match item { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_a_nonref_0 }); };
                                PaymentSendFailure::PartialFailure (
                                        local_a_nonref.into(),
                                )
@@ -632,7 +724,7 @@ impl PaymentSendFailure {
                                )
                        },
                        nativePaymentSendFailure::PathParameterError (mut a, ) => {
-                               let mut local_a = Vec::new(); for mut item in a.drain(..) { local_a.push( { let mut local_a_0 = match item { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_a_0 }); };
+                               let mut local_a = Vec::new(); for mut item in a.drain(..) { local_a.push( { let mut local_a_0 = match item { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_a_0 }); };
                                PaymentSendFailure::PathParameterError (
                                        local_a.into(),
                                )
@@ -644,7 +736,7 @@ impl PaymentSendFailure {
                                )
                        },
                        nativePaymentSendFailure::PartialFailure (mut a, ) => {
-                               let mut local_a = Vec::new(); for mut item in a.drain(..) { local_a.push( { let mut local_a_0 = match item { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_a_0 }); };
+                               let mut local_a = Vec::new(); for mut item in a.drain(..) { local_a.push( { let mut local_a_0 = match item { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_a_0 }); };
                                PaymentSendFailure::PartialFailure (
                                        local_a.into(),
                                )
@@ -705,7 +797,7 @@ pub extern "C" fn ChannelManager_get_current_default_configuration(this_arg: &Ch
 pub extern "C" fn ChannelManager_create_channel(this_arg: &ChannelManager, mut their_network_key: crate::c_types::PublicKey, mut channel_value_satoshis: u64, mut push_msat: u64, mut user_id: u64, mut override_config: crate::lightning::util::config::UserConfig) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
        let mut local_override_config = if override_config.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(override_config.take_inner()) } }) };
        let mut ret = unsafe { &*this_arg.inner }.create_channel(their_network_key.into_rust(), channel_value_satoshis, push_msat, user_id, local_override_config);
-       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
        local_ret
 }
 
@@ -722,8 +814,9 @@ pub extern "C" fn ChannelManager_list_channels(this_arg: &ChannelManager) -> cra
 /// Gets the list of usable channels, in random order. Useful as an argument to
 /// get_route to ensure non-announced channels are used.
 ///
-/// These are guaranteed to have their is_live value set to true, see the documentation for
-/// ChannelDetails::is_live for more info on exactly what the criteria are.
+/// These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
+/// documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
+/// are.
 #[must_use]
 #[no_mangle]
 pub extern "C" fn ChannelManager_list_usable_channels(this_arg: &ChannelManager) -> crate::c_types::derived::CVec_ChannelDetailsZ {
@@ -741,7 +834,7 @@ pub extern "C" fn ChannelManager_list_usable_channels(this_arg: &ChannelManager)
 #[no_mangle]
 pub extern "C" fn ChannelManager_close_channel(this_arg: &ChannelManager, channel_id: *const [u8; 32]) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
        let mut ret = unsafe { &*this_arg.inner }.close_channel(unsafe { &*channel_id});
-       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
        local_ret
 }
 
@@ -751,7 +844,7 @@ pub extern "C" fn ChannelManager_close_channel(this_arg: &ChannelManager, channe
 #[no_mangle]
 pub extern "C" fn ChannelManager_force_close_channel(this_arg: &ChannelManager, channel_id: *const [u8; 32]) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
        let mut ret = unsafe { &*this_arg.inner }.force_close_channel(unsafe { &*channel_id});
-       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
        local_ret
 }
 
@@ -804,9 +897,9 @@ pub extern "C" fn ChannelManager_force_close_all_channels(this_arg: &ChannelMana
 #[must_use]
 #[no_mangle]
 pub extern "C" fn ChannelManager_send_payment(this_arg: &ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ {
-       let mut local_payment_secret = if payment_secret.data == [0; 32] { None } else { Some( { ::lightning::ln::channelmanager::PaymentSecret(payment_secret.data) }) };
-       let mut ret = unsafe { &*this_arg.inner }.send_payment(unsafe { &*route.inner }, ::lightning::ln::channelmanager::PaymentHash(payment_hash.data), &local_payment_secret);
-       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() };
+       let mut local_payment_secret = if payment_secret.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentSecret(payment_secret.data) }) };
+       let mut ret = unsafe { &*this_arg.inner }.send_payment(unsafe { &*route.inner }, ::lightning::ln::PaymentHash(payment_hash.data), &local_payment_secret);
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() };
        local_ret
 }
 
@@ -828,27 +921,34 @@ pub extern "C" fn ChannelManager_send_payment(this_arg: &ChannelManager, route:
 /// Note that this includes RBF or similar transaction replacement strategies - lightning does
 /// not currently support replacing a funding transaction on an existing channel. Instead,
 /// create a new channel with a conflicting funding transaction.
+///
+/// [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
 #[must_use]
 #[no_mangle]
 pub extern "C" fn ChannelManager_funding_transaction_generated(this_arg: &ChannelManager, temporary_channel_id: *const [u8; 32], mut funding_transaction: crate::c_types::Transaction) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
        let mut ret = unsafe { &*this_arg.inner }.funding_transaction_generated(unsafe { &*temporary_channel_id}, funding_transaction.into_bitcoin());
-       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
        local_ret
 }
 
-/// Generates a signed node_announcement from the given arguments and creates a
-/// BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
-/// seen a channel_announcement from us (ie unless we have public channels open).
+/// Regenerates channel_announcements and generates a signed node_announcement from the given
+/// arguments, providing them in corresponding events via
+/// [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
+/// on-chain. This effectively re-broadcasts all channel announcements and sends our node
+/// announcement to ensure that the lightning P2P network is aware of the channels we have and
+/// our network addresses.
+///
+/// `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
+/// node to humans. They carry no in-protocol meaning.
 ///
-/// RGB is a node \"color\" and alias is a printable human-readable string to describe this node
-/// to humans. They carry no in-protocol meaning.
+/// `addresses` represent the set (possibly empty) of socket addresses on which this node
+/// accepts incoming connections. These will be included in the node_announcement, publicly
+/// tying these addresses together and to this node. If you wish to preserve user privacy,
+/// addresses should likely contain only Tor Onion addresses.
 ///
-/// addresses represent the set (possibly empty) of socket addresses on which this node accepts
-/// incoming connections. These will be broadcast to the network, publicly tying these
-/// addresses together. If you wish to preserve user privacy, addresses should likely contain
-/// only Tor Onion addresses.
+/// Panics if `addresses` is absurdly large (more than 500).
 ///
-/// Panics if addresses is absurdly large (more than 500).
+/// [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
 #[no_mangle]
 pub extern "C" fn ChannelManager_broadcast_node_announcement(this_arg: &ChannelManager, mut rgb: crate::c_types::ThreeBytes, mut alias: crate::c_types::ThirtyTwoBytes, mut addresses: crate::c_types::derived::CVec_NetAddressZ) {
        let mut local_addresses = Vec::new(); for mut item in addresses.into_rust().drain(..) { local_addresses.push( { item.into_native() }); };
@@ -883,9 +983,8 @@ pub extern "C" fn ChannelManager_timer_tick_occurred(this_arg: &ChannelManager)
 /// HTLC backwards has been started.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelManager_fail_htlc_backwards(this_arg: &ChannelManager, payment_hash: *const [u8; 32], mut payment_secret: crate::c_types::ThirtyTwoBytes) -> bool {
-       let mut local_payment_secret = if payment_secret.data == [0; 32] { None } else { Some( { ::lightning::ln::channelmanager::PaymentSecret(payment_secret.data) }) };
-       let mut ret = unsafe { &*this_arg.inner }.fail_htlc_backwards(&::lightning::ln::channelmanager::PaymentHash(unsafe { *payment_hash }), &local_payment_secret);
+pub extern "C" fn ChannelManager_fail_htlc_backwards(this_arg: &ChannelManager, payment_hash: *const [u8; 32]) -> bool {
+       let mut ret = unsafe { &*this_arg.inner }.fail_htlc_backwards(&::lightning::ln::PaymentHash(unsafe { *payment_hash }));
        ret
 }
 
@@ -893,22 +992,19 @@ pub extern "C" fn ChannelManager_fail_htlc_backwards(this_arg: &ChannelManager,
 /// generating message events for the net layer to claim the payment, if possible. Thus, you
 /// should probably kick the net layer to go send messages if this returns true!
 ///
-/// You must specify the expected amounts for this HTLC, and we will only claim HTLCs
-/// available within a few percent of the expected amount. This is critical for several
-/// reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
-/// payment_preimage without having provided the full value and b) it avoids certain
-/// privacy-breaking recipient-probing attacks which may reveal payment activity to
-/// motivated attackers.
-///
-/// Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
-/// set. Thus, for such payments we will claim any payments which do not under-pay.
+/// Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
+/// [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
+/// event matches your expectation. If you fail to do so and call this method, you may provide
+/// the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
 ///
 /// May panic if called except in response to a PaymentReceived event.
+///
+/// [`create_inbound_payment`]: Self::create_inbound_payment
+/// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelManager_claim_funds(this_arg: &ChannelManager, mut payment_preimage: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes, mut expected_amount: u64) -> bool {
-       let mut local_payment_secret = if payment_secret.data == [0; 32] { None } else { Some( { ::lightning::ln::channelmanager::PaymentSecret(payment_secret.data) }) };
-       let mut ret = unsafe { &*this_arg.inner }.claim_funds(::lightning::ln::channelmanager::PaymentPreimage(payment_preimage.data), &local_payment_secret, expected_amount);
+pub extern "C" fn ChannelManager_claim_funds(this_arg: &ChannelManager, mut payment_preimage: crate::c_types::ThirtyTwoBytes) -> bool {
+       let mut ret = unsafe { &*this_arg.inner }.claim_funds(::lightning::ln::PaymentPreimage(payment_preimage.data));
        ret
 }
 
@@ -945,6 +1041,85 @@ pub extern "C" fn ChannelManager_channel_monitor_updated(this_arg: &ChannelManag
        unsafe { &*this_arg.inner }.channel_monitor_updated(unsafe { &*funding_txo.inner }, highest_applied_update_id)
 }
 
+/// Gets a payment secret and payment hash for use in an invoice given to a third party wishing
+/// to pay us.
+///
+/// This differs from [`create_inbound_payment_for_hash`] only in that it generates the
+/// [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
+///
+/// The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
+/// will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
+/// passed directly to [`claim_funds`].
+///
+/// See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
+///
+/// [`claim_funds`]: Self::claim_funds
+/// [`PaymentReceived`]: events::Event::PaymentReceived
+/// [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
+/// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_create_inbound_payment(this_arg: &ChannelManager, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32, mut user_payment_id: u64) -> crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ {
+       let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None };
+       let mut ret = unsafe { &*this_arg.inner }.create_inbound_payment(local_min_value_msat, invoice_expiry_delta_secs, user_payment_id);
+       let (mut orig_ret_0, mut orig_ret_1) = ret; let mut local_ret = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_1.0 }).into();
+       local_ret
+}
+
+/// Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
+/// stored external to LDK.
+///
+/// A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
+/// payment secret fetched via this method or [`create_inbound_payment`], and which is at least
+/// the `min_value_msat` provided here, if one is provided.
+///
+/// The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
+/// method may return an Err if another payment with the same payment_hash is still pending.
+///
+/// `user_payment_id` will be provided back in [`PaymentReceived::user_payment_id`] events to
+/// allow tracking of which events correspond with which calls to this and
+/// [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
+/// copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
+/// with invoice metadata stored elsewhere.
+///
+/// `min_value_msat` should be set if the invoice being generated contains a value. Any payment
+/// received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
+/// before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
+/// sender \"proof-of-payment\" unless they have paid the required amount.
+///
+/// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
+/// in excess of the current time. This should roughly match the expiry time set in the invoice.
+/// After this many seconds, we will remove the inbound payment, resulting in any attempts to
+/// pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
+/// invoices when no timeout is set.
+///
+/// Note that we use block header time to time-out pending inbound payments (with some margin
+/// to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
+/// accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
+/// If you need exact expiry semantics, you should enforce them upon receipt of
+/// [`PaymentReceived`].
+///
+/// Pending inbound payments are stored in memory and in serialized versions of this
+/// [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
+/// space is limited, you may wish to rate-limit inbound payment creation.
+///
+/// May panic if `invoice_expiry_delta_secs` is greater than one year.
+///
+/// Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
+/// set to at least [`MIN_FINAL_CLTV_EXPIRY`].
+///
+/// [`create_inbound_payment`]: Self::create_inbound_payment
+/// [`PaymentReceived`]: events::Event::PaymentReceived
+/// [`PaymentReceived::user_payment_id`]: events::Event::PaymentReceived::user_payment_id
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_create_inbound_payment_for_hash(this_arg: &ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32, mut user_payment_id: u64) -> crate::c_types::derived::CResult_PaymentSecretAPIErrorZ {
+       let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None };
+       let mut ret = unsafe { &*this_arg.inner }.create_inbound_payment_for_hash(::lightning::ln::PaymentHash(payment_hash.data), local_min_value_msat, invoice_expiry_delta_secs, user_payment_id);
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
+       local_ret
+}
+
 impl From<nativeChannelManager> for crate::lightning::util::events::MessageSendEventsProvider {
        fn from(obj: nativeChannelManager) -> Self {
                let mut rust_obj = ChannelManager { inner: Box::into_raw(Box::new(obj)), is_owned: true };
@@ -990,15 +1165,12 @@ pub extern "C" fn ChannelManager_as_EventsProvider(this_arg: &ChannelManager) ->
        crate::lightning::util::events::EventsProvider {
                this_arg: unsafe { (*this_arg).inner as *mut c_void },
                free: None,
-               get_and_clear_pending_events: ChannelManager_EventsProvider_get_and_clear_pending_events,
+               process_pending_events: ChannelManager_EventsProvider_process_pending_events,
        }
 }
 
-#[must_use]
-extern "C" fn ChannelManager_EventsProvider_get_and_clear_pending_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_EventZ {
-       let mut ret = <nativeChannelManager as lightning::util::events::EventsProvider<>>::get_and_clear_pending_events(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, );
-       let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::util::events::Event::native_into(item) }); };
-       local_ret.into()
+extern "C" fn ChannelManager_EventsProvider_process_pending_events(this_arg: *const c_void, mut handler: crate::lightning::util::events::EventHandler) {
+       <nativeChannelManager as lightning::util::events::EventsProvider<>>::process_pending_events(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, handler)
 }
 
 impl From<nativeChannelManager> for crate::lightning::chain::Listen {
@@ -1030,91 +1202,45 @@ extern "C" fn ChannelManager_Listen_block_disconnected(this_arg: *const c_void,
        <nativeChannelManager as lightning::chain::Listen<>>::block_disconnected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height)
 }
 
-/// Updates channel state to take note of transactions which were confirmed in the given block
-/// at the given height.
-///
-/// Note that you must still call (or have called) [`update_best_block`] with the block
-/// information which is included here.
-///
-/// This method may be called before or after [`update_best_block`] for a given block's
-/// transaction data and may be called multiple times with additional transaction data for a
-/// given block.
-///
-/// This method may be called for a previous block after an [`update_best_block`] call has
-/// been made for a later block, however it must *not* be called with transaction data from a
-/// block which is no longer in the best chain (ie where [`update_best_block`] has already
-/// been informed about a blockchain reorganization which no longer includes the block which
-/// corresponds to `header`).
-///
-/// [`update_best_block`]: `Self::update_best_block`
-#[no_mangle]
-pub extern "C" fn ChannelManager_transactions_confirmed(this_arg: &ChannelManager, header: *const [u8; 80], mut height: u32, mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ) {
-       let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); };
-       unsafe { &*this_arg.inner }.transactions_confirmed(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height, &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..])
+impl From<nativeChannelManager> for crate::lightning::chain::Confirm {
+       fn from(obj: nativeChannelManager) -> Self {
+               let mut rust_obj = ChannelManager { inner: Box::into_raw(Box::new(obj)), is_owned: true };
+               let mut ret = ChannelManager_as_Confirm(&rust_obj);
+               // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn
+               rust_obj.inner = std::ptr::null_mut();
+               ret.free = Some(ChannelManager_free_void);
+               ret
+       }
 }
-
-/// Updates channel state with the current best blockchain tip. You should attempt to call this
-/// quickly after a new block becomes available, however if multiple new blocks become
-/// available at the same time, only a single `update_best_block()` call needs to be made.
-///
-/// This method should also be called immediately after any block disconnections, once at the
-/// reorganization fork point, and once with the new chain tip. Calling this method at the
-/// blockchain reorganization fork point ensures we learn when a funding transaction which was
-/// previously confirmed is reorganized out of the blockchain, ensuring we do not continue to
-/// accept payments which cannot be enforced on-chain.
-///
-/// In both the block-connection and block-disconnection case, this method may be called either
-/// once per block connected or disconnected, or simply at the fork point and new tip(s),
-/// skipping any intermediary blocks.
+/// Constructs a new Confirm which calls the relevant methods on this_arg.
+/// This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
 #[no_mangle]
-pub extern "C" fn ChannelManager_update_best_block(this_arg: &ChannelManager, header: *const [u8; 80], mut height: u32) {
-       unsafe { &*this_arg.inner }.update_best_block(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height)
+pub extern "C" fn ChannelManager_as_Confirm(this_arg: &ChannelManager) -> crate::lightning::chain::Confirm {
+       crate::lightning::chain::Confirm {
+               this_arg: unsafe { (*this_arg).inner as *mut c_void },
+               free: None,
+               transactions_confirmed: ChannelManager_Confirm_transactions_confirmed,
+               transaction_unconfirmed: ChannelManager_Confirm_transaction_unconfirmed,
+               best_block_updated: ChannelManager_Confirm_best_block_updated,
+               get_relevant_txids: ChannelManager_Confirm_get_relevant_txids,
+       }
 }
 
-/// Gets the set of txids which should be monitored for their confirmation state.
-///
-/// If you're providing information about reorganizations via [`transaction_unconfirmed`], this
-/// is the set of transactions which you may need to call [`transaction_unconfirmed`] for.
-///
-/// This may be useful to poll to determine the set of transactions which must be registered
-/// with an Electrum server or for which an Electrum server needs to be polled to determine
-/// transaction confirmation state.
-///
-/// This may update after any [`transactions_confirmed`] or [`block_connected`] call.
-///
-/// Note that this is NOT the set of transactions which must be included in calls to
-/// [`transactions_confirmed`] if they are confirmed, but a small subset of it.
-///
-/// [`transactions_confirmed`]: Self::transactions_confirmed
-/// [`transaction_unconfirmed`]: Self::transaction_unconfirmed
-/// [`block_connected`]: chain::Listen::block_connected
+extern "C" fn ChannelManager_Confirm_transactions_confirmed(this_arg: *const c_void, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32) {
+       let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); };
+       <nativeChannelManager as lightning::chain::Confirm<>>::transactions_confirmed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..], height)
+}
+extern "C" fn ChannelManager_Confirm_best_block_updated(this_arg: *const c_void, header: *const [u8; 80], mut height: u32) {
+       <nativeChannelManager as lightning::chain::Confirm<>>::best_block_updated(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height)
+}
 #[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelManager_get_relevant_txids(this_arg: &ChannelManager) -> crate::c_types::derived::CVec_TxidZ {
-       let mut ret = unsafe { &*this_arg.inner }.get_relevant_txids();
+extern "C" fn ChannelManager_Confirm_get_relevant_txids(this_arg: *const c_void) -> crate::c_types::derived::CVec_TxidZ {
+       let mut ret = <nativeChannelManager as lightning::chain::Confirm<>>::get_relevant_txids(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, );
        let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.into_inner() } }); };
        local_ret.into()
 }
-
-/// Marks a transaction as having been reorganized out of the blockchain.
-///
-/// If a transaction is included in [`get_relevant_txids`], and is no longer in the main branch
-/// of the blockchain, this function should be called to indicate that the transaction should
-/// be considered reorganized out.
-///
-/// Once this is called, the given transaction will no longer appear on [`get_relevant_txids`],
-/// though this may be called repeatedly for a given transaction without issue.
-///
-/// Note that if the transaction is confirmed on the main chain in a different block (indicated
-/// via a call to [`transactions_confirmed`]), it may re-appear in [`get_relevant_txids`], thus
-/// be very wary of race-conditions wherein the final state of a transaction indicated via
-/// these APIs is not the same as its state on the blockchain.
-///
-/// [`transactions_confirmed`]: Self::transactions_confirmed
-/// [`get_relevant_txids`]: Self::get_relevant_txids
-#[no_mangle]
-pub extern "C" fn ChannelManager_transaction_unconfirmed(this_arg: &ChannelManager, txid: *const [u8; 32]) {
-       unsafe { &*this_arg.inner }.transaction_unconfirmed(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*txid }[..]).unwrap())
+extern "C" fn ChannelManager_Confirm_transaction_unconfirmed(this_arg: *const c_void, txid: *const [u8; 32]) {
+       <nativeChannelManager as lightning::chain::Confirm<>>::transaction_unconfirmed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::hash_types::Txid::from_slice(&unsafe { &*txid }[..]).unwrap())
 }
 
 /// Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
@@ -1327,7 +1453,7 @@ impl ChannelManagerReadArgs {
 #[no_mangle]
 pub extern "C" fn ChannelManagerReadArgs_get_keys_manager(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::chain::keysinterface::KeysInterface {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.keys_manager;
-       &(*inner_val)
+       inner_val
 }
 /// The keys provider which will give us relevant keys. Some keys will be loaded during
 /// deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
@@ -1342,7 +1468,7 @@ pub extern "C" fn ChannelManagerReadArgs_set_keys_manager(this_ptr: &mut Channel
 #[no_mangle]
 pub extern "C" fn ChannelManagerReadArgs_get_fee_estimator(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::chain::chaininterface::FeeEstimator {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_estimator;
-       &(*inner_val)
+       inner_val
 }
 /// The fee_estimator for use in the ChannelManager in the future.
 ///
@@ -1359,7 +1485,7 @@ pub extern "C" fn ChannelManagerReadArgs_set_fee_estimator(this_ptr: &mut Channe
 #[no_mangle]
 pub extern "C" fn ChannelManagerReadArgs_get_chain_monitor(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::chain::Watch {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_monitor;
-       &(*inner_val)
+       inner_val
 }
 /// The chain::Watch for use in the ChannelManager in the future.
 ///
@@ -1376,7 +1502,7 @@ pub extern "C" fn ChannelManagerReadArgs_set_chain_monitor(this_ptr: &mut Channe
 #[no_mangle]
 pub extern "C" fn ChannelManagerReadArgs_get_tx_broadcaster(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::chain::chaininterface::BroadcasterInterface {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.tx_broadcaster;
-       &(*inner_val)
+       inner_val
 }
 /// The BroadcasterInterface which will be used in the ChannelManager in the future and may be
 /// used to broadcast the latest local commitment transactions of channels which must be
@@ -1390,7 +1516,7 @@ pub extern "C" fn ChannelManagerReadArgs_set_tx_broadcaster(this_ptr: &mut Chann
 #[no_mangle]
 pub extern "C" fn ChannelManagerReadArgs_get_logger(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::util::logger::Logger {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.logger;
-       &(*inner_val)
+       inner_val
 }
 /// The Logger for use in the ChannelManager and which may be used to log information during
 /// deserialization.
@@ -1403,7 +1529,7 @@ pub extern "C" fn ChannelManagerReadArgs_set_logger(this_ptr: &mut ChannelManage
 #[no_mangle]
 pub extern "C" fn ChannelManagerReadArgs_get_default_config(this_ptr: &ChannelManagerReadArgs) -> crate::lightning::util::config::UserConfig {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.default_config;
-       crate::lightning::util::config::UserConfig { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+       crate::lightning::util::config::UserConfig { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
 }
 /// Default settings used for new channels. Any existing channels will continue to use the
 /// runtime settings which were stored when the ChannelManager was serialized.