From 764d8a6a61a58e1c86e5eaf74706f522fc389020 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 4 Jan 2021 15:55:29 -0500 Subject: [PATCH] - bindings diff --- .../src/chain/chainmonitor.rs | 6 +- .../src/chain/channelmonitor.rs | 10 +- .../src/chain/keysinterface.rs | 18 +-- lightning-c-bindings/src/chain/mod.rs | 2 +- lightning-c-bindings/src/chain/transaction.rs | 2 +- lightning-c-bindings/src/ln/chan_utils.rs | 38 ++--- lightning-c-bindings/src/ln/channelmanager.rs | 24 +-- lightning-c-bindings/src/ln/features.rs | 6 +- lightning-c-bindings/src/ln/msgs.rs | 140 +++++++++--------- lightning-c-bindings/src/ln/peer_handler.rs | 8 +- .../src/routing/network_graph.rs | 54 +++---- lightning-c-bindings/src/routing/router.rs | 22 +-- lightning-c-bindings/src/util/config.rs | 20 +-- lightning-c-bindings/src/util/events.rs | 72 ++++----- 14 files changed, 211 insertions(+), 211 deletions(-) diff --git a/lightning-c-bindings/src/chain/chainmonitor.rs b/lightning-c-bindings/src/chain/chainmonitor.rs index 99961ffe6..a0a1b7621 100644 --- a/lightning-c-bindings/src/chain/chainmonitor.rs +++ b/lightning-c-bindings/src/chain/chainmonitor.rs @@ -64,7 +64,7 @@ extern "C" fn ChainMonitor_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChainMonitor { - pub(crate) fn take_ptr(mut self) -> *mut nativeChainMonitor { + pub(crate) fn take_inner(mut self) -> *mut nativeChainMonitor { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -140,13 +140,13 @@ pub extern "C" fn ChainMonitor_as_Watch(this_arg: *const ChainMonitor) -> crate: use lightning::chain::Watch as WatchTraitImport; #[must_use] extern "C" fn ChainMonitor_Watch_watch_channel(this_arg: *const c_void, mut funding_outpoint: crate::chain::transaction::OutPoint, mut monitor: crate::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ { - let mut ret = unsafe { &mut *(this_arg as *mut nativeChainMonitor) }.watch_channel(*unsafe { Box::from_raw(funding_outpoint.take_ptr()) }, *unsafe { Box::from_raw(monitor.take_ptr()) }); + let mut ret = unsafe { &mut *(this_arg as *mut nativeChainMonitor) }.watch_channel(*unsafe { Box::from_raw(funding_outpoint.take_inner()) }, *unsafe { Box::from_raw(monitor.take_inner()) }); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::chain::channelmonitor::ChannelMonitorUpdateErr::native_into(e) }) }; local_ret } #[must_use] extern "C" fn ChainMonitor_Watch_update_channel(this_arg: *const c_void, mut funding_txo: crate::chain::transaction::OutPoint, mut update: crate::chain::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ { - let mut ret = unsafe { &mut *(this_arg as *mut nativeChainMonitor) }.update_channel(*unsafe { Box::from_raw(funding_txo.take_ptr()) }, *unsafe { Box::from_raw(update.take_ptr()) }); + let mut ret = unsafe { &mut *(this_arg as *mut nativeChainMonitor) }.update_channel(*unsafe { Box::from_raw(funding_txo.take_inner()) }, *unsafe { Box::from_raw(update.take_inner()) }); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::chain::channelmonitor::ChannelMonitorUpdateErr::native_into(e) }) }; local_ret } diff --git a/lightning-c-bindings/src/chain/channelmonitor.rs b/lightning-c-bindings/src/chain/channelmonitor.rs index a9bd48b89..3b64fd4d1 100644 --- a/lightning-c-bindings/src/chain/channelmonitor.rs +++ b/lightning-c-bindings/src/chain/channelmonitor.rs @@ -49,7 +49,7 @@ extern "C" fn ChannelMonitorUpdate_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChannelMonitorUpdate { - pub(crate) fn take_ptr(mut self) -> *mut nativeChannelMonitorUpdate { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelMonitorUpdate { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -259,7 +259,7 @@ extern "C" fn MonitorUpdateError_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl MonitorUpdateError { - pub(crate) fn take_ptr(mut self) -> *mut nativeMonitorUpdateError { + pub(crate) fn take_inner(mut self) -> *mut nativeMonitorUpdateError { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -297,7 +297,7 @@ extern "C" fn MonitorEvent_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl MonitorEvent { - pub(crate) fn take_ptr(mut self) -> *mut nativeMonitorEvent { + pub(crate) fn take_inner(mut self) -> *mut nativeMonitorEvent { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -356,7 +356,7 @@ extern "C" fn HTLCUpdate_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl HTLCUpdate { - pub(crate) fn take_ptr(mut self) -> *mut nativeHTLCUpdate { + pub(crate) fn take_inner(mut self) -> *mut nativeHTLCUpdate { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -442,7 +442,7 @@ extern "C" fn ChannelMonitor_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChannelMonitor { - pub(crate) fn take_ptr(mut self) -> *mut nativeChannelMonitor { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelMonitor { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); diff --git a/lightning-c-bindings/src/chain/keysinterface.rs b/lightning-c-bindings/src/chain/keysinterface.rs index 3103a283b..48f649e64 100644 --- a/lightning-c-bindings/src/chain/keysinterface.rs +++ b/lightning-c-bindings/src/chain/keysinterface.rs @@ -82,7 +82,7 @@ impl SpendableOutputDescriptor { let mut outpoint_nonref = (*outpoint).clone(); let mut output_nonref = (*output).clone(); nativeSpendableOutputDescriptor::StaticOutput { - outpoint: *unsafe { Box::from_raw(outpoint_nonref.take_ptr()) }, + outpoint: *unsafe { Box::from_raw(outpoint_nonref.take_inner()) }, output: output_nonref.into_rust(), } }, @@ -95,7 +95,7 @@ impl SpendableOutputDescriptor { let (mut orig_key_derivation_params_nonref_0, mut orig_key_derivation_params_nonref_1) = key_derivation_params_nonref.to_rust(); let mut local_key_derivation_params_nonref = (orig_key_derivation_params_nonref_0, orig_key_derivation_params_nonref_1); let mut revocation_pubkey_nonref = (*revocation_pubkey).clone(); nativeSpendableOutputDescriptor::DynamicOutputP2WSH { - outpoint: *unsafe { Box::from_raw(outpoint_nonref.take_ptr()) }, + outpoint: *unsafe { Box::from_raw(outpoint_nonref.take_inner()) }, per_commitment_point: per_commitment_point_nonref.into_rust(), to_self_delay: to_self_delay_nonref, output: output_nonref.into_rust(), @@ -109,7 +109,7 @@ impl SpendableOutputDescriptor { let mut key_derivation_params_nonref = (*key_derivation_params).clone(); let (mut orig_key_derivation_params_nonref_0, mut orig_key_derivation_params_nonref_1) = key_derivation_params_nonref.to_rust(); let mut local_key_derivation_params_nonref = (orig_key_derivation_params_nonref_0, orig_key_derivation_params_nonref_1); nativeSpendableOutputDescriptor::StaticOutputCounterpartyPayment { - outpoint: *unsafe { Box::from_raw(outpoint_nonref.take_ptr()) }, + outpoint: *unsafe { Box::from_raw(outpoint_nonref.take_inner()) }, output: output_nonref.into_rust(), key_derivation_params: local_key_derivation_params_nonref, } @@ -121,14 +121,14 @@ impl SpendableOutputDescriptor { match self { SpendableOutputDescriptor::StaticOutput {mut outpoint, mut output, } => { nativeSpendableOutputDescriptor::StaticOutput { - outpoint: *unsafe { Box::from_raw(outpoint.take_ptr()) }, + outpoint: *unsafe { Box::from_raw(outpoint.take_inner()) }, output: output.into_rust(), } }, SpendableOutputDescriptor::DynamicOutputP2WSH {mut outpoint, mut per_commitment_point, mut to_self_delay, mut output, mut key_derivation_params, mut revocation_pubkey, } => { let (mut orig_key_derivation_params_0, mut orig_key_derivation_params_1) = key_derivation_params.to_rust(); let mut local_key_derivation_params = (orig_key_derivation_params_0, orig_key_derivation_params_1); nativeSpendableOutputDescriptor::DynamicOutputP2WSH { - outpoint: *unsafe { Box::from_raw(outpoint.take_ptr()) }, + outpoint: *unsafe { Box::from_raw(outpoint.take_inner()) }, per_commitment_point: per_commitment_point.into_rust(), to_self_delay: to_self_delay, output: output.into_rust(), @@ -139,7 +139,7 @@ impl SpendableOutputDescriptor { SpendableOutputDescriptor::StaticOutputCounterpartyPayment {mut outpoint, mut output, mut key_derivation_params, } => { let (mut orig_key_derivation_params_0, mut orig_key_derivation_params_1) = key_derivation_params.to_rust(); let mut local_key_derivation_params = (orig_key_derivation_params_0, orig_key_derivation_params_1); nativeSpendableOutputDescriptor::StaticOutputCounterpartyPayment { - outpoint: *unsafe { Box::from_raw(outpoint.take_ptr()) }, + outpoint: *unsafe { Box::from_raw(outpoint.take_inner()) }, output: output.into_rust(), key_derivation_params: local_key_derivation_params, } @@ -546,7 +546,7 @@ impl rustKeysInterface for KeysInterface { fn read_chan_signer(&self, reader: &[u8]) -> Result { let mut local_reader = crate::c_types::u8slice::from_slice(reader); let mut ret = (self.read_chan_signer)(self.this_arg, local_reader); - let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(ret.contents.result.take_ptr()) }) }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).take_ptr()) } })}; + let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(ret.contents.result.take_ptr()) }) }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).take_inner()) } })}; local_ret } } @@ -603,7 +603,7 @@ extern "C" fn InMemoryChannelKeys_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl InMemoryChannelKeys { - pub(crate) fn take_ptr(mut self) -> *mut nativeInMemoryChannelKeys { + pub(crate) fn take_inner(mut self) -> *mut nativeInMemoryChannelKeys { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -924,7 +924,7 @@ extern "C" fn KeysManager_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl KeysManager { - pub(crate) fn take_ptr(mut self) -> *mut nativeKeysManager { + pub(crate) fn take_inner(mut self) -> *mut nativeKeysManager { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); diff --git a/lightning-c-bindings/src/chain/mod.rs b/lightning-c-bindings/src/chain/mod.rs index 5e19de7e6..1d23a3730 100644 --- a/lightning-c-bindings/src/chain/mod.rs +++ b/lightning-c-bindings/src/chain/mod.rs @@ -168,7 +168,7 @@ impl rustWatch for Watch { } fn release_pending_monitor_events(&self) -> Vec { let mut ret = (self.release_pending_monitor_events)(self.this_arg); - let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { *unsafe { Box::from_raw(item.take_ptr()) } }); }; + 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 } } diff --git a/lightning-c-bindings/src/chain/transaction.rs b/lightning-c-bindings/src/chain/transaction.rs index 698e90131..ff7aff7e9 100644 --- a/lightning-c-bindings/src/chain/transaction.rs +++ b/lightning-c-bindings/src/chain/transaction.rs @@ -38,7 +38,7 @@ extern "C" fn OutPoint_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl OutPoint { - pub(crate) fn take_ptr(mut self) -> *mut nativeOutPoint { + pub(crate) fn take_inner(mut self) -> *mut nativeOutPoint { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); diff --git a/lightning-c-bindings/src/ln/chan_utils.rs b/lightning-c-bindings/src/ln/chan_utils.rs index 888f7912a..5bd272070 100644 --- a/lightning-c-bindings/src/ln/chan_utils.rs +++ b/lightning-c-bindings/src/ln/chan_utils.rs @@ -113,7 +113,7 @@ extern "C" fn TxCreationKeys_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl TxCreationKeys { - pub(crate) fn take_ptr(mut self) -> *mut nativeTxCreationKeys { + pub(crate) fn take_inner(mut self) -> *mut nativeTxCreationKeys { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -254,7 +254,7 @@ extern "C" fn ChannelPublicKeys_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChannelPublicKeys { - pub(crate) fn take_ptr(mut self) -> *mut nativeChannelPublicKeys { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelPublicKeys { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -438,7 +438,7 @@ extern "C" fn HTLCOutputInCommitment_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl HTLCOutputInCommitment { - pub(crate) fn take_ptr(mut self) -> *mut nativeHTLCOutputInCommitment { + pub(crate) fn take_inner(mut self) -> *mut nativeHTLCOutputInCommitment { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -589,7 +589,7 @@ extern "C" fn ChannelTransactionParameters_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChannelTransactionParameters { - pub(crate) fn take_ptr(mut self) -> *mut nativeChannelTransactionParameters { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelTransactionParameters { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -622,7 +622,7 @@ pub extern "C" fn ChannelTransactionParameters_get_holder_pubkeys(this_ptr: &Cha /// Holder public keys #[no_mangle] pub extern "C" fn ChannelTransactionParameters_set_holder_pubkeys(this_ptr: &mut ChannelTransactionParameters, mut val: crate::ln::chan_utils::ChannelPublicKeys) { - unsafe { &mut *this_ptr.inner }.holder_pubkeys = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.holder_pubkeys = *unsafe { Box::from_raw(val.take_inner()) }; } /// The contest delay selected by the holder, which applies to counterparty-broadcast transactions #[no_mangle] @@ -660,7 +660,7 @@ pub extern "C" fn ChannelTransactionParameters_get_counterparty_parameters(this_ /// These parameters are populated at the point in the protocol where the counterparty provides them. #[no_mangle] pub extern "C" fn ChannelTransactionParameters_set_counterparty_parameters(this_ptr: &mut ChannelTransactionParameters, mut val: crate::ln::chan_utils::CounterpartyChannelTransactionParameters) { - let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_ptr()) } }) }; + let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) }; unsafe { &mut *this_ptr.inner }.counterparty_parameters = local_val; } /// The late-bound funding outpoint @@ -673,16 +673,16 @@ pub extern "C" fn ChannelTransactionParameters_get_funding_outpoint(this_ptr: &C /// The late-bound funding outpoint #[no_mangle] pub extern "C" fn ChannelTransactionParameters_set_funding_outpoint(this_ptr: &mut ChannelTransactionParameters, mut val: crate::chain::transaction::OutPoint) { - let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_ptr()) } }) }; + 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_outpoint = local_val; } #[must_use] #[no_mangle] pub extern "C" fn ChannelTransactionParameters_new(mut holder_pubkeys_arg: crate::ln::chan_utils::ChannelPublicKeys, mut holder_selected_contest_delay_arg: u16, mut is_outbound_from_holder_arg: bool, mut counterparty_parameters_arg: crate::ln::chan_utils::CounterpartyChannelTransactionParameters, mut funding_outpoint_arg: crate::chain::transaction::OutPoint) -> ChannelTransactionParameters { - let mut local_counterparty_parameters_arg = if counterparty_parameters_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(counterparty_parameters_arg.take_ptr()) } }) }; - let mut local_funding_outpoint_arg = if funding_outpoint_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(funding_outpoint_arg.take_ptr()) } }) }; + let mut local_counterparty_parameters_arg = if counterparty_parameters_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(counterparty_parameters_arg.take_inner()) } }) }; + let mut local_funding_outpoint_arg = if funding_outpoint_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(funding_outpoint_arg.take_inner()) } }) }; ChannelTransactionParameters { inner: Box::into_raw(Box::new(nativeChannelTransactionParameters { - holder_pubkeys: *unsafe { Box::from_raw(holder_pubkeys_arg.take_ptr()) }, + holder_pubkeys: *unsafe { Box::from_raw(holder_pubkeys_arg.take_inner()) }, holder_selected_contest_delay: holder_selected_contest_delay_arg, is_outbound_from_holder: is_outbound_from_holder_arg, counterparty_parameters: local_counterparty_parameters_arg, @@ -720,7 +720,7 @@ extern "C" fn CounterpartyChannelTransactionParameters_free_void(this_ptr: *mut #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl CounterpartyChannelTransactionParameters { - pub(crate) fn take_ptr(mut self) -> *mut nativeCounterpartyChannelTransactionParameters { + pub(crate) fn take_inner(mut self) -> *mut nativeCounterpartyChannelTransactionParameters { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -753,7 +753,7 @@ pub extern "C" fn CounterpartyChannelTransactionParameters_get_pubkeys(this_ptr: /// Counter-party public keys #[no_mangle] pub extern "C" fn CounterpartyChannelTransactionParameters_set_pubkeys(this_ptr: &mut CounterpartyChannelTransactionParameters, mut val: crate::ln::chan_utils::ChannelPublicKeys) { - unsafe { &mut *this_ptr.inner }.pubkeys = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.pubkeys = *unsafe { Box::from_raw(val.take_inner()) }; } /// The contest delay selected by the counterparty, which applies to holder-broadcast transactions #[no_mangle] @@ -770,7 +770,7 @@ pub extern "C" fn CounterpartyChannelTransactionParameters_set_selected_contest_ #[no_mangle] pub extern "C" fn CounterpartyChannelTransactionParameters_new(mut pubkeys_arg: crate::ln::chan_utils::ChannelPublicKeys, mut selected_contest_delay_arg: u16) -> CounterpartyChannelTransactionParameters { CounterpartyChannelTransactionParameters { inner: Box::into_raw(Box::new(nativeCounterpartyChannelTransactionParameters { - pubkeys: *unsafe { Box::from_raw(pubkeys_arg.take_ptr()) }, + pubkeys: *unsafe { Box::from_raw(pubkeys_arg.take_inner()) }, selected_contest_delay: selected_contest_delay_arg, })), is_owned: true } } @@ -871,7 +871,7 @@ extern "C" fn DirectedChannelTransactionParameters_free_void(this_ptr: *mut c_vo #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl DirectedChannelTransactionParameters { - pub(crate) fn take_ptr(mut self) -> *mut nativeDirectedChannelTransactionParameters { + pub(crate) fn take_inner(mut self) -> *mut nativeDirectedChannelTransactionParameters { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -955,7 +955,7 @@ extern "C" fn HolderCommitmentTransaction_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl HolderCommitmentTransaction { - pub(crate) fn take_ptr(mut self) -> *mut nativeHolderCommitmentTransaction { + pub(crate) fn take_inner(mut self) -> *mut nativeHolderCommitmentTransaction { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -1018,7 +1018,7 @@ pub extern "C" fn HolderCommitmentTransaction_read(ser: crate::c_types::u8slice) #[no_mangle] pub extern "C" fn HolderCommitmentTransaction_new(mut commitment_tx: crate::ln::chan_utils::CommitmentTransaction, mut counterparty_sig: crate::c_types::Signature, mut counterparty_htlc_sigs: crate::c_types::derived::CVec_SignatureZ, mut holder_funding_key: crate::c_types::PublicKey, mut counterparty_funding_key: crate::c_types::PublicKey) -> HolderCommitmentTransaction { let mut local_counterparty_htlc_sigs = Vec::new(); for mut item in counterparty_htlc_sigs.into_rust().drain(..) { local_counterparty_htlc_sigs.push( { item.into_rust() }); }; - let mut ret = lightning::ln::chan_utils::HolderCommitmentTransaction::new(*unsafe { Box::from_raw(commitment_tx.take_ptr()) }, counterparty_sig.into_rust(), local_counterparty_htlc_sigs, &holder_funding_key.into_rust(), &counterparty_funding_key.into_rust()); + let mut ret = lightning::ln::chan_utils::HolderCommitmentTransaction::new(*unsafe { Box::from_raw(commitment_tx.take_inner()) }, counterparty_sig.into_rust(), local_counterparty_htlc_sigs, &holder_funding_key.into_rust(), &counterparty_funding_key.into_rust()); HolderCommitmentTransaction { inner: Box::into_raw(Box::new(ret)), is_owned: true } } @@ -1053,7 +1053,7 @@ extern "C" fn BuiltCommitmentTransaction_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl BuiltCommitmentTransaction { - pub(crate) fn take_ptr(mut self) -> *mut nativeBuiltCommitmentTransaction { + pub(crate) fn take_inner(mut self) -> *mut nativeBuiltCommitmentTransaction { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -1185,7 +1185,7 @@ extern "C" fn CommitmentTransaction_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl CommitmentTransaction { - pub(crate) fn take_ptr(mut self) -> *mut nativeCommitmentTransaction { + pub(crate) fn take_inner(mut self) -> *mut nativeCommitmentTransaction { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -1320,7 +1320,7 @@ extern "C" fn TrustedCommitmentTransaction_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl TrustedCommitmentTransaction { - pub(crate) fn take_ptr(mut self) -> *mut nativeTrustedCommitmentTransaction { + pub(crate) fn take_inner(mut self) -> *mut nativeTrustedCommitmentTransaction { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); diff --git a/lightning-c-bindings/src/ln/channelmanager.rs b/lightning-c-bindings/src/ln/channelmanager.rs index 28f0d7fc6..f61e4335c 100644 --- a/lightning-c-bindings/src/ln/channelmanager.rs +++ b/lightning-c-bindings/src/ln/channelmanager.rs @@ -79,7 +79,7 @@ extern "C" fn ChannelManager_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChannelManager { - pub(crate) fn take_ptr(mut self) -> *mut nativeChannelManager { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelManager { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -117,7 +117,7 @@ extern "C" fn ChannelDetails_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChannelDetails { - pub(crate) fn take_ptr(mut self) -> *mut nativeChannelDetails { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelDetails { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -182,7 +182,7 @@ pub extern "C" fn ChannelDetails_get_counterparty_features(this_ptr: &ChannelDet /// many routing-relevant features are present in the init context. #[no_mangle] pub extern "C" fn ChannelDetails_set_counterparty_features(this_ptr: &mut ChannelDetails, mut val: crate::ln::features::InitFeatures) { - unsafe { &mut *this_ptr.inner }.counterparty_features = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.counterparty_features = *unsafe { Box::from_raw(val.take_inner()) }; } /// The value, in satoshis, of this channel as appears in the funding output #[no_mangle] @@ -288,7 +288,7 @@ extern "C" fn PaymentSendFailure_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl PaymentSendFailure { - pub(crate) fn take_ptr(mut self) -> *mut nativePaymentSendFailure { + pub(crate) fn take_inner(mut self) -> *mut nativePaymentSendFailure { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -312,7 +312,7 @@ impl PaymentSendFailure { #[must_use] #[no_mangle] pub extern "C" fn ChannelManager_new(mut network: crate::bitcoin::network::Network, mut fee_est: crate::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::chain::Watch, mut tx_broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut logger: crate::util::logger::Logger, mut keys_manager: crate::chain::keysinterface::KeysInterface, mut config: crate::util::config::UserConfig, mut current_blockchain_height: usize) -> ChannelManager { - let mut ret = lightning::ln::channelmanager::ChannelManager::new(network.into_bitcoin(), fee_est, chain_monitor, tx_broadcaster, logger, keys_manager, *unsafe { Box::from_raw(config.take_ptr()) }, current_blockchain_height); + let mut ret = lightning::ln::channelmanager::ChannelManager::new(network.into_bitcoin(), fee_est, chain_monitor, tx_broadcaster, logger, keys_manager, *unsafe { Box::from_raw(config.take_inner()) }, current_blockchain_height); ChannelManager { inner: Box::into_raw(Box::new(ret)), is_owned: true } } @@ -331,7 +331,7 @@ pub extern "C" fn ChannelManager_new(mut network: crate::bitcoin::network::Netwo #[must_use] #[no_mangle] 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::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_ptr()) } }) }; + 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*/ }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::util::errors::APIError::native_into(e) }) }; local_ret @@ -446,7 +446,7 @@ pub extern "C" fn ChannelManager_send_payment(this_arg: &ChannelManager, route: /// be trivially prevented by using unique funding transaction keys per-channel). #[no_mangle] pub extern "C" fn ChannelManager_funding_transaction_generated(this_arg: &ChannelManager, temporary_channel_id: *const [u8; 32], mut funding_txo: crate::chain::transaction::OutPoint) { - unsafe { &*this_arg.inner }.funding_transaction_generated(unsafe { &*temporary_channel_id}, *unsafe { Box::from_raw(funding_txo.take_ptr()) }) + unsafe { &*this_arg.inner }.funding_transaction_generated(unsafe { &*temporary_channel_id}, *unsafe { Box::from_raw(funding_txo.take_inner()) }) } /// Generates a signed node_announcement from the given arguments and creates a @@ -667,10 +667,10 @@ pub extern "C" fn ChannelManager_as_ChannelMessageHandler(this_arg: *const Chann } use lightning::ln::msgs::ChannelMessageHandler as ChannelMessageHandlerTraitImport; extern "C" fn ChannelManager_ChannelMessageHandler_handle_open_channel(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, mut their_features: crate::ln::features::InitFeatures, msg: &crate::ln::msgs::OpenChannel) { - unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_open_channel(&counterparty_node_id.into_rust(), *unsafe { Box::from_raw(their_features.take_ptr()) }, unsafe { &*msg.inner }) + unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_open_channel(&counterparty_node_id.into_rust(), *unsafe { Box::from_raw(their_features.take_inner()) }, unsafe { &*msg.inner }) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_accept_channel(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, mut their_features: crate::ln::features::InitFeatures, msg: &crate::ln::msgs::AcceptChannel) { - unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_accept_channel(&counterparty_node_id.into_rust(), *unsafe { Box::from_raw(their_features.take_ptr()) }, unsafe { &*msg.inner }) + unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_accept_channel(&counterparty_node_id.into_rust(), *unsafe { Box::from_raw(their_features.take_inner()) }, unsafe { &*msg.inner }) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_funding_created(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingCreated) { unsafe { &mut *(this_arg as *mut nativeChannelManager) }.handle_funding_created(&counterparty_node_id.into_rust(), unsafe { &*msg.inner }) @@ -775,7 +775,7 @@ extern "C" fn ChannelManagerReadArgs_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChannelManagerReadArgs { - pub(crate) fn take_ptr(mut self) -> *mut nativeChannelManagerReadArgs { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelManagerReadArgs { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -870,7 +870,7 @@ pub extern "C" fn ChannelManagerReadArgs_get_default_config(this_ptr: &ChannelMa /// runtime settings which were stored when the ChannelManager was serialized. #[no_mangle] pub extern "C" fn ChannelManagerReadArgs_set_default_config(this_ptr: &mut ChannelManagerReadArgs, mut val: crate::util::config::UserConfig) { - unsafe { &mut *this_ptr.inner }.default_config = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.default_config = *unsafe { Box::from_raw(val.take_inner()) }; } /// Simple utility function to create a ChannelManagerReadArgs which creates the monitor /// HashMap for you. This is primarily useful for C bindings where it is not practical to @@ -879,7 +879,7 @@ pub extern "C" fn ChannelManagerReadArgs_set_default_config(this_ptr: &mut Chann #[no_mangle] pub extern "C" fn ChannelManagerReadArgs_new(mut keys_manager: crate::chain::keysinterface::KeysInterface, mut fee_estimator: crate::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::chain::Watch, mut tx_broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut logger: crate::util::logger::Logger, mut default_config: crate::util::config::UserConfig, mut channel_monitors: crate::c_types::derived::CVec_ChannelMonitorZ) -> ChannelManagerReadArgs { let mut local_channel_monitors = Vec::new(); for mut item in channel_monitors.into_rust().drain(..) { local_channel_monitors.push( { unsafe { &mut *item.inner } }); }; - let mut ret = lightning::ln::channelmanager::ChannelManagerReadArgs::new(keys_manager, fee_estimator, chain_monitor, tx_broadcaster, logger, *unsafe { Box::from_raw(default_config.take_ptr()) }, local_channel_monitors); + let mut ret = lightning::ln::channelmanager::ChannelManagerReadArgs::new(keys_manager, fee_estimator, chain_monitor, tx_broadcaster, logger, *unsafe { Box::from_raw(default_config.take_inner()) }, local_channel_monitors); ChannelManagerReadArgs { inner: Box::into_raw(Box::new(ret)), is_owned: true } } diff --git a/lightning-c-bindings/src/ln/features.rs b/lightning-c-bindings/src/ln/features.rs index 6a6be2845..b01b011a5 100644 --- a/lightning-c-bindings/src/ln/features.rs +++ b/lightning-c-bindings/src/ln/features.rs @@ -51,7 +51,7 @@ extern "C" fn InitFeatures_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl InitFeatures { - pub(crate) fn take_ptr(mut self) -> *mut nativeInitFeatures { + pub(crate) fn take_inner(mut self) -> *mut nativeInitFeatures { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -89,7 +89,7 @@ extern "C" fn NodeFeatures_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl NodeFeatures { - pub(crate) fn take_ptr(mut self) -> *mut nativeNodeFeatures { + pub(crate) fn take_inner(mut self) -> *mut nativeNodeFeatures { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -127,7 +127,7 @@ extern "C" fn ChannelFeatures_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChannelFeatures { - pub(crate) fn take_ptr(mut self) -> *mut nativeChannelFeatures { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelFeatures { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); diff --git a/lightning-c-bindings/src/ln/msgs.rs b/lightning-c-bindings/src/ln/msgs.rs index 6dfc94bfa..a32ed3c06 100644 --- a/lightning-c-bindings/src/ln/msgs.rs +++ b/lightning-c-bindings/src/ln/msgs.rs @@ -50,7 +50,7 @@ extern "C" fn DecodeError_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl DecodeError { - pub(crate) fn take_ptr(mut self) -> *mut nativeDecodeError { + pub(crate) fn take_inner(mut self) -> *mut nativeDecodeError { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -88,7 +88,7 @@ extern "C" fn Init_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl Init { - pub(crate) fn take_ptr(mut self) -> *mut nativeInit { + pub(crate) fn take_inner(mut self) -> *mut nativeInit { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -143,7 +143,7 @@ extern "C" fn ErrorMessage_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ErrorMessage { - pub(crate) fn take_ptr(mut self) -> *mut nativeErrorMessage { + pub(crate) fn take_inner(mut self) -> *mut nativeErrorMessage { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -234,7 +234,7 @@ extern "C" fn Ping_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl Ping { - pub(crate) fn take_ptr(mut self) -> *mut nativePing { + pub(crate) fn take_inner(mut self) -> *mut nativePing { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -321,7 +321,7 @@ extern "C" fn Pong_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl Pong { - pub(crate) fn take_ptr(mut self) -> *mut nativePong { + pub(crate) fn take_inner(mut self) -> *mut nativePong { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -396,7 +396,7 @@ extern "C" fn OpenChannel_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl OpenChannel { - pub(crate) fn take_ptr(mut self) -> *mut nativeOpenChannel { + pub(crate) fn take_inner(mut self) -> *mut nativeOpenChannel { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -649,7 +649,7 @@ extern "C" fn AcceptChannel_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl AcceptChannel { - pub(crate) fn take_ptr(mut self) -> *mut nativeAcceptChannel { + pub(crate) fn take_inner(mut self) -> *mut nativeAcceptChannel { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -858,7 +858,7 @@ extern "C" fn FundingCreated_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl FundingCreated { - pub(crate) fn take_ptr(mut self) -> *mut nativeFundingCreated { + pub(crate) fn take_inner(mut self) -> *mut nativeFundingCreated { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -967,7 +967,7 @@ extern "C" fn FundingSigned_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl FundingSigned { - pub(crate) fn take_ptr(mut self) -> *mut nativeFundingSigned { + pub(crate) fn take_inner(mut self) -> *mut nativeFundingSigned { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -1052,7 +1052,7 @@ extern "C" fn FundingLocked_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl FundingLocked { - pub(crate) fn take_ptr(mut self) -> *mut nativeFundingLocked { + pub(crate) fn take_inner(mut self) -> *mut nativeFundingLocked { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -1137,7 +1137,7 @@ extern "C" fn Shutdown_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl Shutdown { - pub(crate) fn take_ptr(mut self) -> *mut nativeShutdown { + pub(crate) fn take_inner(mut self) -> *mut nativeShutdown { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -1224,7 +1224,7 @@ extern "C" fn ClosingSigned_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ClosingSigned { - pub(crate) fn take_ptr(mut self) -> *mut nativeClosingSigned { + pub(crate) fn take_inner(mut self) -> *mut nativeClosingSigned { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -1321,7 +1321,7 @@ extern "C" fn UpdateAddHTLC_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl UpdateAddHTLC { - pub(crate) fn take_ptr(mut self) -> *mut nativeUpdateAddHTLC { + pub(crate) fn take_inner(mut self) -> *mut nativeUpdateAddHTLC { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -1431,7 +1431,7 @@ extern "C" fn UpdateFulfillHTLC_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl UpdateFulfillHTLC { - pub(crate) fn take_ptr(mut self) -> *mut nativeUpdateFulfillHTLC { + pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFulfillHTLC { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -1528,7 +1528,7 @@ extern "C" fn UpdateFailHTLC_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl UpdateFailHTLC { - pub(crate) fn take_ptr(mut self) -> *mut nativeUpdateFailHTLC { + pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFailHTLC { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -1605,7 +1605,7 @@ extern "C" fn UpdateFailMalformedHTLC_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl UpdateFailMalformedHTLC { - pub(crate) fn take_ptr(mut self) -> *mut nativeUpdateFailMalformedHTLC { + pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFailMalformedHTLC { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -1693,7 +1693,7 @@ extern "C" fn CommitmentSigned_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl CommitmentSigned { - pub(crate) fn take_ptr(mut self) -> *mut nativeCommitmentSigned { + pub(crate) fn take_inner(mut self) -> *mut nativeCommitmentSigned { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -1786,7 +1786,7 @@ extern "C" fn RevokeAndACK_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl RevokeAndACK { - pub(crate) fn take_ptr(mut self) -> *mut nativeRevokeAndACK { + pub(crate) fn take_inner(mut self) -> *mut nativeRevokeAndACK { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -1883,7 +1883,7 @@ extern "C" fn UpdateFee_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl UpdateFee { - pub(crate) fn take_ptr(mut self) -> *mut nativeUpdateFee { + pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFee { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -1971,7 +1971,7 @@ extern "C" fn DataLossProtect_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl DataLossProtect { - pub(crate) fn take_ptr(mut self) -> *mut nativeDataLossProtect { + pub(crate) fn take_inner(mut self) -> *mut nativeDataLossProtect { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -2058,7 +2058,7 @@ extern "C" fn ChannelReestablish_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChannelReestablish { - pub(crate) fn take_ptr(mut self) -> *mut nativeChannelReestablish { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelReestablish { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -2146,7 +2146,7 @@ extern "C" fn AnnouncementSignatures_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl AnnouncementSignatures { - pub(crate) fn take_ptr(mut self) -> *mut nativeAnnouncementSignatures { + pub(crate) fn take_inner(mut self) -> *mut nativeAnnouncementSignatures { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -2438,7 +2438,7 @@ extern "C" fn UnsignedNodeAnnouncement_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl UnsignedNodeAnnouncement { - pub(crate) fn take_ptr(mut self) -> *mut nativeUnsignedNodeAnnouncement { + pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedNodeAnnouncement { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -2471,7 +2471,7 @@ pub extern "C" fn UnsignedNodeAnnouncement_get_features(this_ptr: &UnsignedNodeA /// The advertised features #[no_mangle] pub extern "C" fn UnsignedNodeAnnouncement_set_features(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::ln::features::NodeFeatures) { - unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) }; } /// A strictly monotonic announcement counter, with gaps allowed #[no_mangle] @@ -2558,7 +2558,7 @@ extern "C" fn NodeAnnouncement_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl NodeAnnouncement { - pub(crate) fn take_ptr(mut self) -> *mut nativeNodeAnnouncement { + pub(crate) fn take_inner(mut self) -> *mut nativeNodeAnnouncement { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -2602,14 +2602,14 @@ pub extern "C" fn NodeAnnouncement_get_contents(this_ptr: &NodeAnnouncement) -> /// The actual content of the announcement #[no_mangle] pub extern "C" fn NodeAnnouncement_set_contents(this_ptr: &mut NodeAnnouncement, mut val: crate::ln::msgs::UnsignedNodeAnnouncement) { - unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_inner()) }; } #[must_use] #[no_mangle] pub extern "C" fn NodeAnnouncement_new(mut signature_arg: crate::c_types::Signature, mut contents_arg: crate::ln::msgs::UnsignedNodeAnnouncement) -> NodeAnnouncement { NodeAnnouncement { inner: Box::into_raw(Box::new(nativeNodeAnnouncement { signature: signature_arg.into_rust(), - contents: *unsafe { Box::from_raw(contents_arg.take_ptr()) }, + contents: *unsafe { Box::from_raw(contents_arg.take_inner()) }, })), is_owned: true } } @@ -2643,7 +2643,7 @@ extern "C" fn UnsignedChannelAnnouncement_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl UnsignedChannelAnnouncement { - pub(crate) fn take_ptr(mut self) -> *mut nativeUnsignedChannelAnnouncement { + pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedChannelAnnouncement { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -2676,7 +2676,7 @@ pub extern "C" fn UnsignedChannelAnnouncement_get_features(this_ptr: &UnsignedCh /// The advertised channel features #[no_mangle] pub extern "C" fn UnsignedChannelAnnouncement_set_features(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::ln::features::ChannelFeatures) { - unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) }; } /// The genesis hash of the blockchain where the channel is to be opened #[no_mangle] @@ -2775,7 +2775,7 @@ extern "C" fn ChannelAnnouncement_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChannelAnnouncement { - pub(crate) fn take_ptr(mut self) -> *mut nativeChannelAnnouncement { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelAnnouncement { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -2852,7 +2852,7 @@ pub extern "C" fn ChannelAnnouncement_get_contents(this_ptr: &ChannelAnnouncemen /// The actual announcement #[no_mangle] pub extern "C" fn ChannelAnnouncement_set_contents(this_ptr: &mut ChannelAnnouncement, mut val: crate::ln::msgs::UnsignedChannelAnnouncement) { - unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_inner()) }; } #[must_use] #[no_mangle] @@ -2862,7 +2862,7 @@ pub extern "C" fn ChannelAnnouncement_new(mut node_signature_1_arg: crate::c_typ node_signature_2: node_signature_2_arg.into_rust(), bitcoin_signature_1: bitcoin_signature_1_arg.into_rust(), bitcoin_signature_2: bitcoin_signature_2_arg.into_rust(), - contents: *unsafe { Box::from_raw(contents_arg.take_ptr()) }, + contents: *unsafe { Box::from_raw(contents_arg.take_inner()) }, })), is_owned: true } } @@ -2896,7 +2896,7 @@ extern "C" fn UnsignedChannelUpdate_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl UnsignedChannelUpdate { - pub(crate) fn take_ptr(mut self) -> *mut nativeUnsignedChannelUpdate { + pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedChannelUpdate { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -3039,7 +3039,7 @@ extern "C" fn ChannelUpdate_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChannelUpdate { - pub(crate) fn take_ptr(mut self) -> *mut nativeChannelUpdate { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelUpdate { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -3083,14 +3083,14 @@ pub extern "C" fn ChannelUpdate_get_contents(this_ptr: &ChannelUpdate) -> crate: /// The actual channel update #[no_mangle] pub extern "C" fn ChannelUpdate_set_contents(this_ptr: &mut ChannelUpdate, mut val: crate::ln::msgs::UnsignedChannelUpdate) { - unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_inner()) }; } #[must_use] #[no_mangle] pub extern "C" fn ChannelUpdate_new(mut signature_arg: crate::c_types::Signature, mut contents_arg: crate::ln::msgs::UnsignedChannelUpdate) -> ChannelUpdate { ChannelUpdate { inner: Box::into_raw(Box::new(nativeChannelUpdate { signature: signature_arg.into_rust(), - contents: *unsafe { Box::from_raw(contents_arg.take_ptr()) }, + contents: *unsafe { Box::from_raw(contents_arg.take_inner()) }, })), is_owned: true } } @@ -3127,7 +3127,7 @@ extern "C" fn QueryChannelRange_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl QueryChannelRange { - pub(crate) fn take_ptr(mut self) -> *mut nativeQueryChannelRange { + pub(crate) fn take_inner(mut self) -> *mut nativeQueryChannelRange { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -3230,7 +3230,7 @@ extern "C" fn ReplyChannelRange_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ReplyChannelRange { - pub(crate) fn take_ptr(mut self) -> *mut nativeReplyChannelRange { + pub(crate) fn take_inner(mut self) -> *mut nativeReplyChannelRange { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -3356,7 +3356,7 @@ extern "C" fn QueryShortChannelIds_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl QueryShortChannelIds { - pub(crate) fn take_ptr(mut self) -> *mut nativeQueryShortChannelIds { + pub(crate) fn take_inner(mut self) -> *mut nativeQueryShortChannelIds { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -3440,7 +3440,7 @@ extern "C" fn ReplyShortChannelIdsEnd_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ReplyShortChannelIdsEnd { - pub(crate) fn take_ptr(mut self) -> *mut nativeReplyShortChannelIdsEnd { + pub(crate) fn take_inner(mut self) -> *mut nativeReplyShortChannelIdsEnd { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -3529,7 +3529,7 @@ extern "C" fn GossipTimestampFilter_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl GossipTimestampFilter { - pub(crate) fn take_ptr(mut self) -> *mut nativeGossipTimestampFilter { + pub(crate) fn take_inner(mut self) -> *mut nativeGossipTimestampFilter { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -3618,7 +3618,7 @@ impl ErrorAction { match self { ErrorAction::DisconnectPeer {ref msg, } => { let mut msg_nonref = (*msg).clone(); - let mut local_msg_nonref = if msg_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg_nonref.take_ptr()) } }) }; + let mut local_msg_nonref = if msg_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg_nonref.take_inner()) } }) }; nativeErrorAction::DisconnectPeer { msg: local_msg_nonref, } @@ -3627,7 +3627,7 @@ impl ErrorAction { ErrorAction::SendErrorMessage {ref msg, } => { let mut msg_nonref = (*msg).clone(); nativeErrorAction::SendErrorMessage { - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, } @@ -3636,7 +3636,7 @@ impl ErrorAction { pub(crate) fn into_native(self) -> nativeErrorAction { match self { ErrorAction::DisconnectPeer {mut msg, } => { - let mut local_msg = if msg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg.take_ptr()) } }) }; + let mut local_msg = if msg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg.take_inner()) } }) }; nativeErrorAction::DisconnectPeer { msg: local_msg, } @@ -3644,7 +3644,7 @@ impl ErrorAction { ErrorAction::IgnoreError => nativeErrorAction::IgnoreError, ErrorAction::SendErrorMessage {mut msg, } => { nativeErrorAction::SendErrorMessage { - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, } @@ -3723,7 +3723,7 @@ extern "C" fn LightningError_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl LightningError { - pub(crate) fn take_ptr(mut self) -> *mut nativeLightningError { + pub(crate) fn take_inner(mut self) -> *mut nativeLightningError { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -3792,7 +3792,7 @@ extern "C" fn CommitmentUpdate_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl CommitmentUpdate { - pub(crate) fn take_ptr(mut self) -> *mut nativeCommitmentUpdate { + pub(crate) fn take_inner(mut self) -> *mut nativeCommitmentUpdate { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -3819,25 +3819,25 @@ pub extern "C" fn CommitmentUpdate_clone(orig: &CommitmentUpdate) -> CommitmentU /// update_add_htlc messages which should be sent #[no_mangle] pub extern "C" fn CommitmentUpdate_set_update_add_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateAddHTLCZ) { - let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_ptr()) } }); }; + let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; unsafe { &mut *this_ptr.inner }.update_add_htlcs = local_val; } /// update_fulfill_htlc messages which should be sent #[no_mangle] pub extern "C" fn CommitmentUpdate_set_update_fulfill_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFulfillHTLCZ) { - let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_ptr()) } }); }; + let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; unsafe { &mut *this_ptr.inner }.update_fulfill_htlcs = local_val; } /// update_fail_htlc messages which should be sent #[no_mangle] pub extern "C" fn CommitmentUpdate_set_update_fail_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFailHTLCZ) { - let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_ptr()) } }); }; + let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; unsafe { &mut *this_ptr.inner }.update_fail_htlcs = local_val; } /// update_fail_malformed_htlc messages which should be sent #[no_mangle] pub extern "C" fn CommitmentUpdate_set_update_fail_malformed_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFailMalformedHTLCZ) { - let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_ptr()) } }); }; + let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; unsafe { &mut *this_ptr.inner }.update_fail_malformed_htlcs = local_val; } /// An update_fee message which should be sent @@ -3850,7 +3850,7 @@ pub extern "C" fn CommitmentUpdate_get_update_fee(this_ptr: &CommitmentUpdate) - /// An update_fee message which should be sent #[no_mangle] pub extern "C" fn CommitmentUpdate_set_update_fee(this_ptr: &mut CommitmentUpdate, mut val: crate::ln::msgs::UpdateFee) { - let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_ptr()) } }) }; + let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) }; unsafe { &mut *this_ptr.inner }.update_fee = local_val; } /// Finally, the commitment_signed message which should be sent @@ -3862,23 +3862,23 @@ pub extern "C" fn CommitmentUpdate_get_commitment_signed(this_ptr: &CommitmentUp /// Finally, the commitment_signed message which should be sent #[no_mangle] pub extern "C" fn CommitmentUpdate_set_commitment_signed(this_ptr: &mut CommitmentUpdate, mut val: crate::ln::msgs::CommitmentSigned) { - unsafe { &mut *this_ptr.inner }.commitment_signed = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.commitment_signed = *unsafe { Box::from_raw(val.take_inner()) }; } #[must_use] #[no_mangle] pub extern "C" fn CommitmentUpdate_new(mut update_add_htlcs_arg: crate::c_types::derived::CVec_UpdateAddHTLCZ, mut update_fulfill_htlcs_arg: crate::c_types::derived::CVec_UpdateFulfillHTLCZ, mut update_fail_htlcs_arg: crate::c_types::derived::CVec_UpdateFailHTLCZ, mut update_fail_malformed_htlcs_arg: crate::c_types::derived::CVec_UpdateFailMalformedHTLCZ, mut update_fee_arg: crate::ln::msgs::UpdateFee, mut commitment_signed_arg: crate::ln::msgs::CommitmentSigned) -> CommitmentUpdate { - let mut local_update_add_htlcs_arg = Vec::new(); for mut item in update_add_htlcs_arg.into_rust().drain(..) { local_update_add_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_ptr()) } }); }; - let mut local_update_fulfill_htlcs_arg = Vec::new(); for mut item in update_fulfill_htlcs_arg.into_rust().drain(..) { local_update_fulfill_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_ptr()) } }); }; - let mut local_update_fail_htlcs_arg = Vec::new(); for mut item in update_fail_htlcs_arg.into_rust().drain(..) { local_update_fail_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_ptr()) } }); }; - let mut local_update_fail_malformed_htlcs_arg = Vec::new(); for mut item in update_fail_malformed_htlcs_arg.into_rust().drain(..) { local_update_fail_malformed_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_ptr()) } }); }; - let mut local_update_fee_arg = if update_fee_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(update_fee_arg.take_ptr()) } }) }; + let mut local_update_add_htlcs_arg = Vec::new(); for mut item in update_add_htlcs_arg.into_rust().drain(..) { local_update_add_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_update_fulfill_htlcs_arg = Vec::new(); for mut item in update_fulfill_htlcs_arg.into_rust().drain(..) { local_update_fulfill_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_update_fail_htlcs_arg = Vec::new(); for mut item in update_fail_htlcs_arg.into_rust().drain(..) { local_update_fail_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_update_fail_malformed_htlcs_arg = Vec::new(); for mut item in update_fail_malformed_htlcs_arg.into_rust().drain(..) { local_update_fail_malformed_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_update_fee_arg = if update_fee_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(update_fee_arg.take_inner()) } }) }; CommitmentUpdate { inner: Box::into_raw(Box::new(nativeCommitmentUpdate { update_add_htlcs: local_update_add_htlcs_arg, update_fulfill_htlcs: local_update_fulfill_htlcs_arg, update_fail_htlcs: local_update_fail_htlcs_arg, update_fail_malformed_htlcs: local_update_fail_malformed_htlcs_arg, update_fee: local_update_fee_arg, - commitment_signed: *unsafe { Box::from_raw(commitment_signed_arg.take_ptr()) }, + commitment_signed: *unsafe { Box::from_raw(commitment_signed_arg.take_inner()) }, })), is_owned: true } } /// The information we received from a peer along the route of a payment we originated. This is @@ -3911,7 +3911,7 @@ impl HTLCFailChannelUpdate { HTLCFailChannelUpdate::ChannelUpdateMessage {ref msg, } => { let mut msg_nonref = (*msg).clone(); nativeHTLCFailChannelUpdate::ChannelUpdateMessage { - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, HTLCFailChannelUpdate::ChannelClosed {ref short_channel_id, ref is_permanent, } => { @@ -3937,7 +3937,7 @@ impl HTLCFailChannelUpdate { match self { HTLCFailChannelUpdate::ChannelUpdateMessage {mut msg, } => { nativeHTLCFailChannelUpdate::ChannelUpdateMessage { - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, HTLCFailChannelUpdate::ChannelClosed {mut short_channel_id, mut is_permanent, } => { @@ -4221,17 +4221,17 @@ use lightning::ln::msgs::RoutingMessageHandler as rustRoutingMessageHandler; impl rustRoutingMessageHandler for RoutingMessageHandler { fn handle_node_announcement(&self, msg: &lightning::ln::msgs::NodeAnnouncement) -> Result { let mut ret = (self.handle_node_announcement)(self.this_arg, &crate::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(ret.contents.result.take_ptr()) }) }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).take_ptr()) } })}; + let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(ret.contents.result.take_ptr()) }) }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).take_inner()) } })}; local_ret } fn handle_channel_announcement(&self, msg: &lightning::ln::msgs::ChannelAnnouncement) -> Result { let mut ret = (self.handle_channel_announcement)(self.this_arg, &crate::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(ret.contents.result.take_ptr()) }) }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).take_ptr()) } })}; + let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(ret.contents.result.take_ptr()) }) }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).take_inner()) } })}; local_ret } fn handle_channel_update(&self, msg: &lightning::ln::msgs::ChannelUpdate) -> Result { let mut ret = (self.handle_channel_update)(self.this_arg, &crate::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(ret.contents.result.take_ptr()) }) }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).take_ptr()) } })}; + let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(ret.contents.result.take_ptr()) }) }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).take_inner()) } })}; local_ret } fn handle_htlc_fail_channel_update(&self, update: &lightning::ln::msgs::HTLCFailChannelUpdate) { @@ -4239,13 +4239,13 @@ impl rustRoutingMessageHandler for RoutingMessageHandler { } fn get_next_channel_announcements(&self, starting_point: u64, batch_amount: u8) -> Vec<(lightning::ln::msgs::ChannelAnnouncement, Option, Option)> { 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_ptr()) } }) }; 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_ptr()) } }) }; let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_ptr()) }, local_orig_ret_0_1, local_orig_ret_0_2); local_ret_0 }); }; + 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 { 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_ptr()) } }); }; + 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) { @@ -4253,22 +4253,22 @@ impl rustRoutingMessageHandler for RoutingMessageHandler { } fn handle_reply_channel_range(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, 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::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(ret.contents.result.take_ptr()) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).take_ptr()) } })}; + let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(ret.contents.result.take_ptr()) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).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> { let mut ret = (self.handle_reply_short_channel_ids_end)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::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(ret.contents.result.take_ptr()) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).take_ptr()) } })}; + let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(ret.contents.result.take_ptr()) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).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> { let mut ret = (self.handle_query_channel_range)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::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(ret.contents.result.take_ptr()) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).take_ptr()) } })}; + let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(ret.contents.result.take_ptr()) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).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> { let mut ret = (self.handle_query_short_channel_ids)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::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(ret.contents.result.take_ptr()) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).take_ptr()) } })}; + let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(ret.contents.result.take_ptr()) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(ret.contents.err.take_ptr()) }).take_inner()) } })}; local_ret } } diff --git a/lightning-c-bindings/src/ln/peer_handler.rs b/lightning-c-bindings/src/ln/peer_handler.rs index 50e1c3696..047294b98 100644 --- a/lightning-c-bindings/src/ln/peer_handler.rs +++ b/lightning-c-bindings/src/ln/peer_handler.rs @@ -41,7 +41,7 @@ extern "C" fn MessageHandler_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl MessageHandler { - pub(crate) fn take_ptr(mut self) -> *mut nativeMessageHandler { + pub(crate) fn take_inner(mut self) -> *mut nativeMessageHandler { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -213,7 +213,7 @@ extern "C" fn PeerHandleError_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl PeerHandleError { - pub(crate) fn take_ptr(mut self) -> *mut nativePeerHandleError { + pub(crate) fn take_inner(mut self) -> *mut nativePeerHandleError { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -278,7 +278,7 @@ extern "C" fn PeerManager_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl PeerManager { - pub(crate) fn take_ptr(mut self) -> *mut nativePeerManager { + pub(crate) fn take_inner(mut self) -> *mut nativePeerManager { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -291,7 +291,7 @@ impl PeerManager { #[must_use] #[no_mangle] pub extern "C" fn PeerManager_new(mut message_handler: crate::ln::peer_handler::MessageHandler, mut our_node_secret: crate::c_types::SecretKey, ephemeral_random_data: *const [u8; 32], mut logger: crate::util::logger::Logger) -> PeerManager { - let mut ret = lightning::ln::peer_handler::PeerManager::new(*unsafe { Box::from_raw(message_handler.take_ptr()) }, our_node_secret.into_rust(), unsafe { &*ephemeral_random_data}, logger); + let mut ret = lightning::ln::peer_handler::PeerManager::new(*unsafe { Box::from_raw(message_handler.take_inner()) }, our_node_secret.into_rust(), unsafe { &*ephemeral_random_data}, logger); PeerManager { inner: Box::into_raw(Box::new(ret)), is_owned: true } } diff --git a/lightning-c-bindings/src/routing/network_graph.rs b/lightning-c-bindings/src/routing/network_graph.rs index 9f80bc6d9..f70b2e41e 100644 --- a/lightning-c-bindings/src/routing/network_graph.rs +++ b/lightning-c-bindings/src/routing/network_graph.rs @@ -35,7 +35,7 @@ extern "C" fn NetworkGraph_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl NetworkGraph { - pub(crate) fn take_ptr(mut self) -> *mut nativeNetworkGraph { + pub(crate) fn take_inner(mut self) -> *mut nativeNetworkGraph { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -75,7 +75,7 @@ extern "C" fn LockedNetworkGraph_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl LockedNetworkGraph { - pub(crate) fn take_ptr(mut self) -> *mut nativeLockedNetworkGraph { + pub(crate) fn take_inner(mut self) -> *mut nativeLockedNetworkGraph { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -117,7 +117,7 @@ extern "C" fn NetGraphMsgHandler_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl NetGraphMsgHandler { - pub(crate) fn take_ptr(mut self) -> *mut nativeNetGraphMsgHandler { + pub(crate) fn take_inner(mut self) -> *mut nativeNetGraphMsgHandler { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -143,7 +143,7 @@ pub extern "C" fn NetGraphMsgHandler_new(mut genesis_hash: crate::c_types::Thirt #[no_mangle] pub extern "C" fn NetGraphMsgHandler_from_net_graph(chain_access: *mut crate::chain::Access, mut logger: crate::util::logger::Logger, mut network_graph: crate::routing::network_graph::NetworkGraph) -> NetGraphMsgHandler { let mut local_chain_access = if chain_access == std::ptr::null_mut() { None } else { Some( { unsafe { *Box::from_raw(chain_access) } }) }; - let mut ret = lightning::routing::network_graph::NetGraphMsgHandler::from_net_graph(local_chain_access, logger, *unsafe { Box::from_raw(network_graph.take_ptr()) }); + let mut ret = lightning::routing::network_graph::NetGraphMsgHandler::from_net_graph(local_chain_access, logger, *unsafe { Box::from_raw(network_graph.take_inner()) }); NetGraphMsgHandler { inner: Box::into_raw(Box::new(ret)), is_owned: true } } @@ -239,25 +239,25 @@ extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_sync_routing_table(this_a } #[must_use] extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_reply_channel_range(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ { - let mut ret = unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }.handle_reply_channel_range(&their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_ptr()) }); + let mut ret = unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }.handle_reply_channel_range(&their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; local_ret } #[must_use] extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_reply_short_channel_ids_end(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::ln::msgs::ReplyShortChannelIdsEnd) -> crate::c_types::derived::CResult_NoneLightningErrorZ { - let mut ret = unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }.handle_reply_short_channel_ids_end(&their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_ptr()) }); + let mut ret = unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }.handle_reply_short_channel_ids_end(&their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; local_ret } #[must_use] extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_query_channel_range(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ { - let mut ret = unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }.handle_query_channel_range(&_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_ptr()) }); + let mut ret = unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }.handle_query_channel_range(&_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) }); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; local_ret } #[must_use] extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_query_short_channel_ids(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::ln::msgs::QueryShortChannelIds) -> crate::c_types::derived::CResult_NoneLightningErrorZ { - let mut ret = unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }.handle_query_short_channel_ids(&_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_ptr()) }); + let mut ret = unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }.handle_query_short_channel_ids(&_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) }); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; local_ret } @@ -327,7 +327,7 @@ extern "C" fn DirectionalChannelInfo_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl DirectionalChannelInfo { - pub(crate) fn take_ptr(mut self) -> *mut nativeDirectionalChannelInfo { + pub(crate) fn take_inner(mut self) -> *mut nativeDirectionalChannelInfo { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -389,7 +389,7 @@ pub extern "C" fn DirectionalChannelInfo_get_fees(this_ptr: &DirectionalChannelI /// Fees charged when the channel is used for routing #[no_mangle] pub extern "C" fn DirectionalChannelInfo_set_fees(this_ptr: &mut DirectionalChannelInfo, mut val: crate::routing::network_graph::RoutingFees) { - unsafe { &mut *this_ptr.inner }.fees = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.fees = *unsafe { Box::from_raw(val.take_inner()) }; } /// Most recent update for the channel received from the network /// Mostly redundant with the data we store in fields explicitly. @@ -407,7 +407,7 @@ pub extern "C" fn DirectionalChannelInfo_get_last_update_message(this_ptr: &Dire /// Not stored if contains excess data to prevent DoS. #[no_mangle] pub extern "C" fn DirectionalChannelInfo_set_last_update_message(this_ptr: &mut DirectionalChannelInfo, mut val: crate::ln::msgs::ChannelUpdate) { - let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_ptr()) } }) }; + let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) }; unsafe { &mut *this_ptr.inner }.last_update_message = local_val; } #[no_mangle] @@ -458,7 +458,7 @@ extern "C" fn ChannelInfo_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChannelInfo { - pub(crate) fn take_ptr(mut self) -> *mut nativeChannelInfo { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelInfo { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -474,7 +474,7 @@ pub extern "C" fn ChannelInfo_get_features(this_ptr: &ChannelInfo) -> crate::ln: /// Protocol features of a channel communicated during its announcement #[no_mangle] pub extern "C" fn ChannelInfo_set_features(this_ptr: &mut ChannelInfo, mut val: crate::ln::features::ChannelFeatures) { - unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) }; } /// Source node of the first direction of a channel #[no_mangle] @@ -497,7 +497,7 @@ pub extern "C" fn ChannelInfo_get_one_to_two(this_ptr: &ChannelInfo) -> crate::r /// Details about the first direction of a channel #[no_mangle] pub extern "C" fn ChannelInfo_set_one_to_two(this_ptr: &mut ChannelInfo, mut val: crate::routing::network_graph::DirectionalChannelInfo) { - let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_ptr()) } }) }; + let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) }; unsafe { &mut *this_ptr.inner }.one_to_two = local_val; } /// Source node of the second direction of a channel @@ -521,7 +521,7 @@ pub extern "C" fn ChannelInfo_get_two_to_one(this_ptr: &ChannelInfo) -> crate::r /// Details about the second direction of a channel #[no_mangle] pub extern "C" fn ChannelInfo_set_two_to_one(this_ptr: &mut ChannelInfo, mut val: crate::routing::network_graph::DirectionalChannelInfo) { - let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_ptr()) } }) }; + let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) }; unsafe { &mut *this_ptr.inner }.two_to_one = local_val; } /// An initial announcement of the channel @@ -540,7 +540,7 @@ pub extern "C" fn ChannelInfo_get_announcement_message(this_ptr: &ChannelInfo) - /// Not stored if contains excess data to prevent DoS. #[no_mangle] pub extern "C" fn ChannelInfo_set_announcement_message(this_ptr: &mut ChannelInfo, mut val: crate::ln::msgs::ChannelAnnouncement) { - let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_ptr()) } }) }; + let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) }; unsafe { &mut *this_ptr.inner }.announcement_message = local_val; } #[no_mangle] @@ -590,7 +590,7 @@ extern "C" fn RoutingFees_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl RoutingFees { - pub(crate) fn take_ptr(mut self) -> *mut nativeRoutingFees { + pub(crate) fn take_inner(mut self) -> *mut nativeRoutingFees { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -693,7 +693,7 @@ extern "C" fn NodeAnnouncementInfo_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl NodeAnnouncementInfo { - pub(crate) fn take_ptr(mut self) -> *mut nativeNodeAnnouncementInfo { + pub(crate) fn take_inner(mut self) -> *mut nativeNodeAnnouncementInfo { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -709,7 +709,7 @@ pub extern "C" fn NodeAnnouncementInfo_get_features(this_ptr: &NodeAnnouncementI /// Protocol features the node announced support for #[no_mangle] pub extern "C" fn NodeAnnouncementInfo_set_features(this_ptr: &mut NodeAnnouncementInfo, mut val: crate::ln::features::NodeFeatures) { - unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) }; } /// When the last known update to the node state was issued. /// Value is opaque, as set in the announcement. @@ -772,16 +772,16 @@ pub extern "C" fn NodeAnnouncementInfo_get_announcement_message(this_ptr: &NodeA /// Not stored if contains excess data to prevent DoS. #[no_mangle] pub extern "C" fn NodeAnnouncementInfo_set_announcement_message(this_ptr: &mut NodeAnnouncementInfo, mut val: crate::ln::msgs::NodeAnnouncement) { - let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_ptr()) } }) }; + let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) }; unsafe { &mut *this_ptr.inner }.announcement_message = local_val; } #[must_use] #[no_mangle] pub extern "C" fn NodeAnnouncementInfo_new(mut features_arg: crate::ln::features::NodeFeatures, mut last_update_arg: u32, mut rgb_arg: crate::c_types::ThreeBytes, mut alias_arg: crate::c_types::ThirtyTwoBytes, mut addresses_arg: crate::c_types::derived::CVec_NetAddressZ, mut announcement_message_arg: crate::ln::msgs::NodeAnnouncement) -> NodeAnnouncementInfo { let mut local_addresses_arg = Vec::new(); for mut item in addresses_arg.into_rust().drain(..) { local_addresses_arg.push( { item.into_native() }); }; - let mut local_announcement_message_arg = if announcement_message_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(announcement_message_arg.take_ptr()) } }) }; + let mut local_announcement_message_arg = if announcement_message_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(announcement_message_arg.take_inner()) } }) }; NodeAnnouncementInfo { inner: Box::into_raw(Box::new(nativeNodeAnnouncementInfo { - features: *unsafe { Box::from_raw(features_arg.take_ptr()) }, + features: *unsafe { Box::from_raw(features_arg.take_inner()) }, last_update: last_update_arg, rgb: rgb_arg.data, alias: alias_arg.data, @@ -836,7 +836,7 @@ extern "C" fn NodeInfo_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl NodeInfo { - pub(crate) fn take_ptr(mut self) -> *mut nativeNodeInfo { + pub(crate) fn take_inner(mut self) -> *mut nativeNodeInfo { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -863,7 +863,7 @@ pub extern "C" fn NodeInfo_get_lowest_inbound_channel_fees(this_ptr: &NodeInfo) /// meaning they don't have to refer to the same channel. #[no_mangle] pub extern "C" fn NodeInfo_set_lowest_inbound_channel_fees(this_ptr: &mut NodeInfo, mut val: crate::routing::network_graph::RoutingFees) { - let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_ptr()) } }) }; + let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) }; unsafe { &mut *this_ptr.inner }.lowest_inbound_channel_fees = local_val; } /// More information about a node from node_announcement. @@ -880,15 +880,15 @@ pub extern "C" fn NodeInfo_get_announcement_info(this_ptr: &NodeInfo) -> crate:: /// a channel announcement, but before receiving a node announcement. #[no_mangle] pub extern "C" fn NodeInfo_set_announcement_info(this_ptr: &mut NodeInfo, mut val: crate::routing::network_graph::NodeAnnouncementInfo) { - let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_ptr()) } }) }; + let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) }; unsafe { &mut *this_ptr.inner }.announcement_info = local_val; } #[must_use] #[no_mangle] pub extern "C" fn NodeInfo_new(mut channels_arg: crate::c_types::derived::CVec_u64Z, mut lowest_inbound_channel_fees_arg: crate::routing::network_graph::RoutingFees, mut announcement_info_arg: crate::routing::network_graph::NodeAnnouncementInfo) -> NodeInfo { let mut local_channels_arg = Vec::new(); for mut item in channels_arg.into_rust().drain(..) { local_channels_arg.push( { item }); }; - let mut local_lowest_inbound_channel_fees_arg = if lowest_inbound_channel_fees_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(lowest_inbound_channel_fees_arg.take_ptr()) } }) }; - let mut local_announcement_info_arg = if announcement_info_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(announcement_info_arg.take_ptr()) } }) }; + let mut local_lowest_inbound_channel_fees_arg = if lowest_inbound_channel_fees_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(lowest_inbound_channel_fees_arg.take_inner()) } }) }; + let mut local_announcement_info_arg = if announcement_info_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(announcement_info_arg.take_inner()) } }) }; NodeInfo { inner: Box::into_raw(Box::new(nativeNodeInfo { channels: local_channels_arg, lowest_inbound_channel_fees: local_lowest_inbound_channel_fees_arg, diff --git a/lightning-c-bindings/src/routing/router.rs b/lightning-c-bindings/src/routing/router.rs index 095c1598a..47f89af45 100644 --- a/lightning-c-bindings/src/routing/router.rs +++ b/lightning-c-bindings/src/routing/router.rs @@ -38,7 +38,7 @@ extern "C" fn RouteHop_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl RouteHop { - pub(crate) fn take_ptr(mut self) -> *mut nativeRouteHop { + pub(crate) fn take_inner(mut self) -> *mut nativeRouteHop { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -84,7 +84,7 @@ pub extern "C" fn RouteHop_get_node_features(this_ptr: &RouteHop) -> crate::ln:: /// amended to match the features present in the invoice this node generated. #[no_mangle] pub extern "C" fn RouteHop_set_node_features(this_ptr: &mut RouteHop, mut val: crate::ln::features::NodeFeatures) { - unsafe { &mut *this_ptr.inner }.node_features = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.node_features = *unsafe { Box::from_raw(val.take_inner()) }; } /// The channel that should be used from the previous hop to reach this node. #[no_mangle] @@ -108,7 +108,7 @@ pub extern "C" fn RouteHop_get_channel_features(this_ptr: &RouteHop) -> crate::l /// to reach this node. #[no_mangle] pub extern "C" fn RouteHop_set_channel_features(this_ptr: &mut RouteHop, mut val: crate::ln::features::ChannelFeatures) { - unsafe { &mut *this_ptr.inner }.channel_features = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.channel_features = *unsafe { Box::from_raw(val.take_inner()) }; } /// The fee taken on this hop. For the last hop, this should be the full value of the payment. #[no_mangle] @@ -139,9 +139,9 @@ pub extern "C" fn RouteHop_set_cltv_expiry_delta(this_ptr: &mut RouteHop, mut va pub extern "C" fn RouteHop_new(mut pubkey_arg: crate::c_types::PublicKey, mut node_features_arg: crate::ln::features::NodeFeatures, mut short_channel_id_arg: u64, mut channel_features_arg: crate::ln::features::ChannelFeatures, mut fee_msat_arg: u64, mut cltv_expiry_delta_arg: u32) -> RouteHop { RouteHop { inner: Box::into_raw(Box::new(nativeRouteHop { pubkey: pubkey_arg.into_rust(), - node_features: *unsafe { Box::from_raw(node_features_arg.take_ptr()) }, + node_features: *unsafe { Box::from_raw(node_features_arg.take_inner()) }, short_channel_id: short_channel_id_arg, - channel_features: *unsafe { Box::from_raw(channel_features_arg.take_ptr()) }, + channel_features: *unsafe { Box::from_raw(channel_features_arg.take_inner()) }, fee_msat: fee_msat_arg, cltv_expiry_delta: cltv_expiry_delta_arg, })), is_owned: true } @@ -178,7 +178,7 @@ extern "C" fn Route_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl Route { - pub(crate) fn take_ptr(mut self) -> *mut nativeRoute { + pub(crate) fn take_inner(mut self) -> *mut nativeRoute { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -210,13 +210,13 @@ pub extern "C" fn Route_clone(orig: &Route) -> Route { /// ensure it is viable. #[no_mangle] pub extern "C" fn Route_set_paths(this_ptr: &mut Route, mut val: crate::c_types::derived::CVec_CVec_RouteHopZZ) { - let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { let mut local_val_0 = Vec::new(); for mut item in item.into_rust().drain(..) { local_val_0.push( { *unsafe { Box::from_raw(item.take_ptr()) } }); }; local_val_0 }); }; + let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { let mut local_val_0 = Vec::new(); for mut item in item.into_rust().drain(..) { local_val_0.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_val_0 }); }; unsafe { &mut *this_ptr.inner }.paths = local_val; } #[must_use] #[no_mangle] pub extern "C" fn Route_new(mut paths_arg: crate::c_types::derived::CVec_CVec_RouteHopZZ) -> Route { - let mut local_paths_arg = Vec::new(); for mut item in paths_arg.into_rust().drain(..) { local_paths_arg.push( { let mut local_paths_arg_0 = Vec::new(); for mut item in item.into_rust().drain(..) { local_paths_arg_0.push( { *unsafe { Box::from_raw(item.take_ptr()) } }); }; local_paths_arg_0 }); }; + let mut local_paths_arg = Vec::new(); for mut item in paths_arg.into_rust().drain(..) { local_paths_arg.push( { let mut local_paths_arg_0 = Vec::new(); for mut item in item.into_rust().drain(..) { local_paths_arg_0.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_paths_arg_0 }); }; Route { inner: Box::into_raw(Box::new(nativeRoute { paths: local_paths_arg, })), is_owned: true } @@ -268,7 +268,7 @@ extern "C" fn RouteHint_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl RouteHint { - pub(crate) fn take_ptr(mut self) -> *mut nativeRouteHint { + pub(crate) fn take_inner(mut self) -> *mut nativeRouteHint { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -323,7 +323,7 @@ pub extern "C" fn RouteHint_get_fees(this_ptr: &RouteHint) -> crate::routing::ne /// The fees which must be paid to use this channel #[no_mangle] pub extern "C" fn RouteHint_set_fees(this_ptr: &mut RouteHint, mut val: crate::routing::network_graph::RoutingFees) { - unsafe { &mut *this_ptr.inner }.fees = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.fees = *unsafe { Box::from_raw(val.take_inner()) }; } /// The difference in CLTV values between this node and the next node. #[no_mangle] @@ -353,7 +353,7 @@ pub extern "C" fn RouteHint_new(mut src_node_id_arg: crate::c_types::PublicKey, RouteHint { inner: Box::into_raw(Box::new(nativeRouteHint { src_node_id: src_node_id_arg.into_rust(), short_channel_id: short_channel_id_arg, - fees: *unsafe { Box::from_raw(fees_arg.take_ptr()) }, + fees: *unsafe { Box::from_raw(fees_arg.take_inner()) }, cltv_expiry_delta: cltv_expiry_delta_arg, htlc_minimum_msat: htlc_minimum_msat_arg, })), is_owned: true } diff --git a/lightning-c-bindings/src/util/config.rs b/lightning-c-bindings/src/util/config.rs index d4ffe1fbb..a9bcd6aee 100644 --- a/lightning-c-bindings/src/util/config.rs +++ b/lightning-c-bindings/src/util/config.rs @@ -38,7 +38,7 @@ extern "C" fn ChannelHandshakeConfig_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChannelHandshakeConfig { - pub(crate) fn take_ptr(mut self) -> *mut nativeChannelHandshakeConfig { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelHandshakeConfig { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -192,7 +192,7 @@ extern "C" fn ChannelHandshakeLimits_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChannelHandshakeLimits { - pub(crate) fn take_ptr(mut self) -> *mut nativeChannelHandshakeLimits { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelHandshakeLimits { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -465,7 +465,7 @@ extern "C" fn ChannelConfig_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl ChannelConfig { - pub(crate) fn take_ptr(mut self) -> *mut nativeChannelConfig { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelConfig { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -634,7 +634,7 @@ extern "C" fn UserConfig_free_void(this_ptr: *mut c_void) { #[allow(unused)] /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy impl UserConfig { - pub(crate) fn take_ptr(mut self) -> *mut nativeUserConfig { + pub(crate) fn take_inner(mut self) -> *mut nativeUserConfig { assert!(self.is_owned); let ret = self.inner; self.inner = std::ptr::null_mut(); @@ -667,7 +667,7 @@ pub extern "C" fn UserConfig_get_own_channel_config(this_ptr: &UserConfig) -> cr /// Channel config that we propose to our counterparty. #[no_mangle] pub extern "C" fn UserConfig_set_own_channel_config(this_ptr: &mut UserConfig, mut val: crate::util::config::ChannelHandshakeConfig) { - unsafe { &mut *this_ptr.inner }.own_channel_config = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.own_channel_config = *unsafe { Box::from_raw(val.take_inner()) }; } /// Limits applied to our counterparty's proposed channel config settings. #[no_mangle] @@ -678,7 +678,7 @@ pub extern "C" fn UserConfig_get_peer_channel_config_limits(this_ptr: &UserConfi /// Limits applied to our counterparty's proposed channel config settings. #[no_mangle] pub extern "C" fn UserConfig_set_peer_channel_config_limits(this_ptr: &mut UserConfig, mut val: crate::util::config::ChannelHandshakeLimits) { - unsafe { &mut *this_ptr.inner }.peer_channel_config_limits = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.peer_channel_config_limits = *unsafe { Box::from_raw(val.take_inner()) }; } /// Channel config which affects behavior during channel lifetime. #[no_mangle] @@ -689,15 +689,15 @@ pub extern "C" fn UserConfig_get_channel_options(this_ptr: &UserConfig) -> crate /// Channel config which affects behavior during channel lifetime. #[no_mangle] pub extern "C" fn UserConfig_set_channel_options(this_ptr: &mut UserConfig, mut val: crate::util::config::ChannelConfig) { - unsafe { &mut *this_ptr.inner }.channel_options = *unsafe { Box::from_raw(val.take_ptr()) }; + unsafe { &mut *this_ptr.inner }.channel_options = *unsafe { Box::from_raw(val.take_inner()) }; } #[must_use] #[no_mangle] pub extern "C" fn UserConfig_new(mut own_channel_config_arg: crate::util::config::ChannelHandshakeConfig, mut peer_channel_config_limits_arg: crate::util::config::ChannelHandshakeLimits, mut channel_options_arg: crate::util::config::ChannelConfig) -> UserConfig { UserConfig { inner: Box::into_raw(Box::new(nativeUserConfig { - own_channel_config: *unsafe { Box::from_raw(own_channel_config_arg.take_ptr()) }, - peer_channel_config_limits: *unsafe { Box::from_raw(peer_channel_config_limits_arg.take_ptr()) }, - channel_options: *unsafe { Box::from_raw(channel_options_arg.take_ptr()) }, + own_channel_config: *unsafe { Box::from_raw(own_channel_config_arg.take_inner()) }, + peer_channel_config_limits: *unsafe { Box::from_raw(peer_channel_config_limits_arg.take_inner()) }, + channel_options: *unsafe { Box::from_raw(channel_options_arg.take_inner()) }, })), is_owned: true } } #[must_use] diff --git a/lightning-c-bindings/src/util/events.rs b/lightning-c-bindings/src/util/events.rs index 8ee99485b..eef634762 100644 --- a/lightning-c-bindings/src/util/events.rs +++ b/lightning-c-bindings/src/util/events.rs @@ -100,7 +100,7 @@ impl Event { let mut funding_txo_nonref = (*funding_txo).clone(); let mut user_channel_id_nonref = (*user_channel_id).clone(); nativeEvent::FundingBroadcastSafe { - funding_txo: *unsafe { Box::from_raw(funding_txo_nonref.take_ptr()) }, + funding_txo: *unsafe { Box::from_raw(funding_txo_nonref.take_inner()) }, user_channel_id: user_channel_id_nonref, } }, @@ -157,7 +157,7 @@ impl Event { }, Event::FundingBroadcastSafe {mut funding_txo, mut user_channel_id, } => { nativeEvent::FundingBroadcastSafe { - funding_txo: *unsafe { Box::from_raw(funding_txo.take_ptr()) }, + funding_txo: *unsafe { Box::from_raw(funding_txo.take_inner()) }, user_channel_id: user_channel_id, } }, @@ -429,7 +429,7 @@ impl MessageSendEvent { let mut msg_nonref = (*msg).clone(); nativeMessageSendEvent::SendAcceptChannel { node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendOpenChannel {ref node_id, ref msg, } => { @@ -437,7 +437,7 @@ impl MessageSendEvent { let mut msg_nonref = (*msg).clone(); nativeMessageSendEvent::SendOpenChannel { node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendFundingCreated {ref node_id, ref msg, } => { @@ -445,7 +445,7 @@ impl MessageSendEvent { let mut msg_nonref = (*msg).clone(); nativeMessageSendEvent::SendFundingCreated { node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendFundingSigned {ref node_id, ref msg, } => { @@ -453,7 +453,7 @@ impl MessageSendEvent { let mut msg_nonref = (*msg).clone(); nativeMessageSendEvent::SendFundingSigned { node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendFundingLocked {ref node_id, ref msg, } => { @@ -461,7 +461,7 @@ impl MessageSendEvent { let mut msg_nonref = (*msg).clone(); nativeMessageSendEvent::SendFundingLocked { node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendAnnouncementSignatures {ref node_id, ref msg, } => { @@ -469,7 +469,7 @@ impl MessageSendEvent { let mut msg_nonref = (*msg).clone(); nativeMessageSendEvent::SendAnnouncementSignatures { node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::UpdateHTLCs {ref node_id, ref updates, } => { @@ -477,7 +477,7 @@ impl MessageSendEvent { let mut updates_nonref = (*updates).clone(); nativeMessageSendEvent::UpdateHTLCs { node_id: node_id_nonref.into_rust(), - updates: *unsafe { Box::from_raw(updates_nonref.take_ptr()) }, + updates: *unsafe { Box::from_raw(updates_nonref.take_inner()) }, } }, MessageSendEvent::SendRevokeAndACK {ref node_id, ref msg, } => { @@ -485,7 +485,7 @@ impl MessageSendEvent { let mut msg_nonref = (*msg).clone(); nativeMessageSendEvent::SendRevokeAndACK { node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendClosingSigned {ref node_id, ref msg, } => { @@ -493,7 +493,7 @@ impl MessageSendEvent { let mut msg_nonref = (*msg).clone(); nativeMessageSendEvent::SendClosingSigned { node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendShutdown {ref node_id, ref msg, } => { @@ -501,7 +501,7 @@ impl MessageSendEvent { let mut msg_nonref = (*msg).clone(); nativeMessageSendEvent::SendShutdown { node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendChannelReestablish {ref node_id, ref msg, } => { @@ -509,27 +509,27 @@ impl MessageSendEvent { let mut msg_nonref = (*msg).clone(); nativeMessageSendEvent::SendChannelReestablish { node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::BroadcastChannelAnnouncement {ref msg, ref update_msg, } => { let mut msg_nonref = (*msg).clone(); let mut update_msg_nonref = (*update_msg).clone(); nativeMessageSendEvent::BroadcastChannelAnnouncement { - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, - update_msg: *unsafe { Box::from_raw(update_msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + update_msg: *unsafe { Box::from_raw(update_msg_nonref.take_inner()) }, } }, MessageSendEvent::BroadcastNodeAnnouncement {ref msg, } => { let mut msg_nonref = (*msg).clone(); nativeMessageSendEvent::BroadcastNodeAnnouncement { - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::BroadcastChannelUpdate {ref msg, } => { let mut msg_nonref = (*msg).clone(); nativeMessageSendEvent::BroadcastChannelUpdate { - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::HandleError {ref node_id, ref action, } => { @@ -551,7 +551,7 @@ impl MessageSendEvent { let mut msg_nonref = (*msg).clone(); nativeMessageSendEvent::SendChannelRangeQuery { node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendShortIdsQuery {ref node_id, ref msg, } => { @@ -559,7 +559,7 @@ impl MessageSendEvent { let mut msg_nonref = (*msg).clone(); nativeMessageSendEvent::SendShortIdsQuery { node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, } @@ -570,83 +570,83 @@ impl MessageSendEvent { MessageSendEvent::SendAcceptChannel {mut node_id, mut msg, } => { nativeMessageSendEvent::SendAcceptChannel { node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, MessageSendEvent::SendOpenChannel {mut node_id, mut msg, } => { nativeMessageSendEvent::SendOpenChannel { node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, MessageSendEvent::SendFundingCreated {mut node_id, mut msg, } => { nativeMessageSendEvent::SendFundingCreated { node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, MessageSendEvent::SendFundingSigned {mut node_id, mut msg, } => { nativeMessageSendEvent::SendFundingSigned { node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, MessageSendEvent::SendFundingLocked {mut node_id, mut msg, } => { nativeMessageSendEvent::SendFundingLocked { node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, MessageSendEvent::SendAnnouncementSignatures {mut node_id, mut msg, } => { nativeMessageSendEvent::SendAnnouncementSignatures { node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, MessageSendEvent::UpdateHTLCs {mut node_id, mut updates, } => { nativeMessageSendEvent::UpdateHTLCs { node_id: node_id.into_rust(), - updates: *unsafe { Box::from_raw(updates.take_ptr()) }, + updates: *unsafe { Box::from_raw(updates.take_inner()) }, } }, MessageSendEvent::SendRevokeAndACK {mut node_id, mut msg, } => { nativeMessageSendEvent::SendRevokeAndACK { node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, MessageSendEvent::SendClosingSigned {mut node_id, mut msg, } => { nativeMessageSendEvent::SendClosingSigned { node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, MessageSendEvent::SendShutdown {mut node_id, mut msg, } => { nativeMessageSendEvent::SendShutdown { node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, MessageSendEvent::SendChannelReestablish {mut node_id, mut msg, } => { nativeMessageSendEvent::SendChannelReestablish { node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, MessageSendEvent::BroadcastChannelAnnouncement {mut msg, mut update_msg, } => { nativeMessageSendEvent::BroadcastChannelAnnouncement { - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, - update_msg: *unsafe { Box::from_raw(update_msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + update_msg: *unsafe { Box::from_raw(update_msg.take_inner()) }, } }, MessageSendEvent::BroadcastNodeAnnouncement {mut msg, } => { nativeMessageSendEvent::BroadcastNodeAnnouncement { - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, MessageSendEvent::BroadcastChannelUpdate {mut msg, } => { nativeMessageSendEvent::BroadcastChannelUpdate { - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, MessageSendEvent::HandleError {mut node_id, mut action, } => { @@ -663,13 +663,13 @@ impl MessageSendEvent { MessageSendEvent::SendChannelRangeQuery {mut node_id, mut msg, } => { nativeMessageSendEvent::SendChannelRangeQuery { node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, MessageSendEvent::SendShortIdsQuery {mut node_id, mut msg, } => { nativeMessageSendEvent::SendShortIdsQuery { node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_ptr()) }, + msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, } -- 2.39.5