Update auto-generated bindings to LDK 0.0.110
[ldk-c-bindings] / lightning-c-bindings / src / lightning / chain / channelmonitor.rs
index 0fa366b7aa2c0cc620b8a33bf6be9ac0fbcd7b9f..1391178007b1454031183dd16060183b86b1ea12 100644 (file)
@@ -156,14 +156,16 @@ pub extern "C" fn ChannelMonitorUpdate_read(ser: crate::c_types::u8slice) -> cra
        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.
        ///
@@ -182,9 +184,12 @@ pub enum MonitorEvent {
        /// [`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 {
@@ -446,8 +451,8 @@ pub static ANTI_REORG_DELAY: u32 = lightning::chain::channelmonitor::ANTI_REORG_
 ///
 /// 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
@@ -495,7 +500,9 @@ pub enum Balance {
                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 {
@@ -750,7 +757,7 @@ pub(crate) extern "C" fn ChannelMonitor_write_void(obj: *const c_void) -> crate:
 /// 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
@@ -816,6 +823,20 @@ pub extern "C" fn ChannelMonitor_get_and_clear_pending_events(this_arg: &crate::
        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