#[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();
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
}
#[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();
#[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();
#[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();
#[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();
#[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();
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(),
}
},
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(),
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,
}
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(),
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,
}
fn read_chan_signer(&self, reader: &[u8]) -> Result<crate::chain::keysinterface::ChannelKeys, lightning::ln::msgs::DecodeError> {
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
}
}
#[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();
#[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();
}
fn release_pending_monitor_events(&self) -> Vec<lightning::chain::channelmonitor::MonitorEvent> {
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
}
}
#[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();
#[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();
#[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();
#[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();
#[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();
/// 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]
/// 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
/// 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,
#[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();
/// 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]
#[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 }
}
#[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();
#[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();
#[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 }
}
#[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();
#[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();
#[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();
#[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();
#[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();
/// 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]
#[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();
#[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 }
}
#[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
/// 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
}
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 })
#[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();
/// 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
#[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 }
}
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
#[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();
/// 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]
#[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();
/// 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 }
}
#[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();
/// 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]
#[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();
/// 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]
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 }
}
#[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();
#[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();
/// 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 }
}
#[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();
#[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();
#[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();
#[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();
#[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();
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,
}
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()) },
}
},
}
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,
}
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()) },
}
},
}
#[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();
#[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();
/// 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
/// 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
/// 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
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, } => {
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, } => {
impl rustRoutingMessageHandler for RoutingMessageHandler {
fn handle_node_announcement(&self, msg: &lightning::ln::msgs::NodeAnnouncement) -> Result<bool, lightning::ln::msgs::LightningError> {
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<bool, lightning::ln::msgs::LightningError> {
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<bool, lightning::ln::msgs::LightningError> {
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) {
}
fn get_next_channel_announcements(&self, starting_point: u64, batch_amount: u8) -> Vec<(lightning::ln::msgs::ChannelAnnouncement, Option<lightning::ln::msgs::ChannelUpdate>, Option<lightning::ln::msgs::ChannelUpdate>)> {
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<lightning::ln::msgs::NodeAnnouncement> {
let mut local_starting_point = if starting_point.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(starting_point.unwrap())) } };
let mut ret = (self.get_next_node_announcements)(self.this_arg, local_starting_point, batch_amount);
- let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { *unsafe { Box::from_raw(item.take_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) {
}
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
}
}
#[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();
#[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();
#[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();
#[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 }
}
#[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();
#[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();
#[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();
#[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 }
}
}
#[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
}
#[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();
/// 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.
/// 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]
#[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();
/// 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]
/// 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
/// 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
/// 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]
#[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();
#[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();
/// 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.
/// 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,
#[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();
/// 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.
/// 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,
#[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();
/// 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]
/// 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]
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 }
#[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();
/// 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 }
#[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();
/// 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]
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 }
#[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();
#[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();
#[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();
#[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();
/// 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]
/// 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]
/// 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]
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,
}
},
},
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,
}
},
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, } => {
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, } => {
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, } => {
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, } => {
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, } => {
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, } => {
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, } => {
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, } => {
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, } => {
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, } => {
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, } => {
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, } => {
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()) },
}
},
}
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, } => {
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()) },
}
},
}