local_res
}
/// An event to be processed by the ChannelManager.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum MonitorEvent {
/// A monitor event containing an HTLCUpdate.
- HTLCEvent(crate::lightning::chain::channelmonitor::HTLCUpdate),
+ HTLCEvent(
+ crate::lightning::chain::channelmonitor::HTLCUpdate),
/// A monitor event that the Channel's commitment transaction was confirmed.
- CommitmentTxConfirmed(crate::lightning::chain::transaction::OutPoint),
+ CommitmentTxConfirmed(
+ crate::lightning::chain::transaction::OutPoint),
/// Indicates a [`ChannelMonitor`] update has completed. See
/// [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
///
/// [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
///
/// [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
- UpdateFailed(crate::lightning::chain::transaction::OutPoint),
+ UpdateFailed(
+ crate::lightning::chain::transaction::OutPoint),
}
-use lightning::chain::channelmonitor::MonitorEvent as nativeMonitorEvent;
+use lightning::chain::channelmonitor::MonitorEvent as MonitorEventImport;
+pub(crate) type nativeMonitorEvent = MonitorEventImport;
+
impl MonitorEvent {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeMonitorEvent {
///
/// See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
/// be provided.
-#[must_use]
#[derive(Clone)]
+#[must_use]
#[repr(C)]
pub enum Balance {
/// The channel is not yet closed (or the commitment or closing transaction has not yet
claimable_height: u32,
},
}
-use lightning::chain::channelmonitor::Balance as nativeBalance;
+use lightning::chain::channelmonitor::Balance as BalanceImport;
+pub(crate) type nativeBalance = BalanceImport;
+
impl Balance {
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeBalance {
/// panics if the given update is not the next update by update_id.
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelMonitor_update_monitor(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, updates: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, broadcaster: &crate::lightning::chain::chaininterface::BroadcasterInterface, fee_estimator: &crate::lightning::chain::chaininterface::FeeEstimator, logger: &crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_NoneNoneZ {
+pub extern "C" fn ChannelMonitor_update_monitor(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, updates: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, broadcaster: &crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, logger: &crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_NoneNoneZ {
let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_monitor(updates.get_native_ref(), broadcaster, fee_estimator, logger);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
local_ret.into()
}
+/// Gets the `node_id` of the counterparty for this channel.
+///
+/// Will be `None` for channels constructed on LDK versions prior to 0.0.110 and always `Some`
+/// otherwise.
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelMonitor_get_counterparty_node_id(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::PublicKey {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_counterparty_node_id();
+ let mut local_ret = if ret.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(ret.unwrap())) } };
+ local_ret
+}
+
/// Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
/// the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
/// fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows