Update auto-generated bindings
[ldk-c-bindings] / lightning-c-bindings / src / lightning / chain / channelmonitor.rs
index da82fb9de1c5fa6c7573eec212dd1ef9692823f9..1378873bb25a7fe0fd2fb81d7e3f276198160d30 100644 (file)
@@ -31,8 +31,13 @@ use alloc::{vec::Vec, boxed::Box};
 use lightning::chain::channelmonitor::ChannelMonitorUpdate as nativeChannelMonitorUpdateImport;
 pub(crate) type nativeChannelMonitorUpdate = nativeChannelMonitorUpdateImport;
 
-/// An update generated by the underlying Channel itself which contains some new information the
-/// ChannelMonitor should be made aware of.
+/// An update generated by the underlying channel itself which contains some new information the
+/// [`ChannelMonitor`] should be made aware of.
+///
+/// Because this represents only a small number of updates to the underlying state, it is generally
+/// much smaller than a full [`ChannelMonitor`]. However, for large single commitment transaction
+/// updates (e.g. ones during which there are hundreds of HTLCs pending on the commitment
+/// transaction), a single update may reach upwards of 1 MiB in serialized size.
 #[must_use]
 #[repr(C)]
 pub struct ChannelMonitorUpdate {
@@ -61,7 +66,7 @@ pub extern "C" fn ChannelMonitorUpdate_free(this_obj: ChannelMonitorUpdate) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
 pub(crate) extern "C" fn ChannelMonitorUpdate_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelMonitorUpdate); }
+       let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelMonitorUpdate) };
 }
 #[allow(unused)]
 impl ChannelMonitorUpdate {
@@ -84,12 +89,14 @@ impl ChannelMonitorUpdate {
 /// increasing and increase by one for each new update, with one exception specified below.
 ///
 /// This sequence number is also used to track up to which points updates which returned
-/// ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
+/// [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
 /// ChannelMonitor when ChannelManager::channel_monitor_updated is called.
 ///
 /// The only instance where update_id values are not strictly increasing is the case where we
 /// allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
 /// its docs for more details.
+///
+/// [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
 #[no_mangle]
 pub extern "C" fn ChannelMonitorUpdate_get_update_id(this_ptr: &ChannelMonitorUpdate) -> u64 {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().update_id;
@@ -100,12 +107,14 @@ pub extern "C" fn ChannelMonitorUpdate_get_update_id(this_ptr: &ChannelMonitorUp
 /// increasing and increase by one for each new update, with one exception specified below.
 ///
 /// This sequence number is also used to track up to which points updates which returned
-/// ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
+/// [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
 /// ChannelMonitor when ChannelManager::channel_monitor_updated is called.
 ///
 /// The only instance where update_id values are not strictly increasing is the case where we
 /// allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
 /// its docs for more details.
+///
+/// [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
 #[no_mangle]
 pub extern "C" fn ChannelMonitorUpdate_set_update_id(this_ptr: &mut ChannelMonitorUpdate, mut val: u64) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.update_id = val;
@@ -141,7 +150,7 @@ pub extern "C" fn ChannelMonitorUpdate_clone(orig: &ChannelMonitorUpdate) -> Cha
 pub static CLOSED_CHANNEL_UPDATE_ID: u64 = lightning::chain::channelmonitor::CLOSED_CHANNEL_UPDATE_ID;
 #[no_mangle]
 /// Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
-pub extern "C" fn ChannelMonitorUpdate_write(obj: &ChannelMonitorUpdate) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn ChannelMonitorUpdate_write(obj: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
 #[no_mangle]
@@ -152,23 +161,25 @@ pub(crate) extern "C" fn ChannelMonitorUpdate_write_void(obj: *const c_void) ->
 /// Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
 pub extern "C" fn ChannelMonitorUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelMonitorUpdateDecodeErrorZ {
        let res: Result<lightning::chain::channelmonitor::ChannelMonitorUpdate, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::channelmonitor::ChannelMonitorUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::channelmonitor::ChannelMonitorUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        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.
+       /// [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used.
        ///
-       /// [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
-       UpdateCompleted {
+       /// [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
+       Completed {
                /// The funding outpoint of the [`ChannelMonitor`] that was updated
                funding_txo: crate::lightning::chain::transaction::OutPoint,
                /// The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
@@ -179,38 +190,41 @@ pub enum MonitorEvent {
                monitor_update_id: u64,
        },
        /// Indicates a [`ChannelMonitor`] update has failed. See
-       /// [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
+       /// [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used.
        ///
-       /// [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
-       UpdateFailed(crate::lightning::chain::transaction::OutPoint),
+       /// [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
+       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 {
                match self {
                        MonitorEvent::HTLCEvent (ref a, ) => {
-                               let mut a_nonref = (*a).clone();
+                               let mut a_nonref = Clone::clone(a);
                                nativeMonitorEvent::HTLCEvent (
                                        *unsafe { Box::from_raw(a_nonref.take_inner()) },
                                )
                        },
                        MonitorEvent::CommitmentTxConfirmed (ref a, ) => {
-                               let mut a_nonref = (*a).clone();
+                               let mut a_nonref = Clone::clone(a);
                                nativeMonitorEvent::CommitmentTxConfirmed (
                                        *unsafe { Box::from_raw(a_nonref.take_inner()) },
                                )
                        },
-                       MonitorEvent::UpdateCompleted {ref funding_txo, ref monitor_update_id, } => {
-                               let mut funding_txo_nonref = (*funding_txo).clone();
-                               let mut monitor_update_id_nonref = (*monitor_update_id).clone();
-                               nativeMonitorEvent::UpdateCompleted {
+                       MonitorEvent::Completed {ref funding_txo, ref monitor_update_id, } => {
+                               let mut funding_txo_nonref = Clone::clone(funding_txo);
+                               let mut monitor_update_id_nonref = Clone::clone(monitor_update_id);
+                               nativeMonitorEvent::Completed {
                                        funding_txo: *unsafe { Box::from_raw(funding_txo_nonref.take_inner()) },
                                        monitor_update_id: monitor_update_id_nonref,
                                }
                        },
                        MonitorEvent::UpdateFailed (ref a, ) => {
-                               let mut a_nonref = (*a).clone();
+                               let mut a_nonref = Clone::clone(a);
                                nativeMonitorEvent::UpdateFailed (
                                        *unsafe { Box::from_raw(a_nonref.take_inner()) },
                                )
@@ -230,8 +244,8 @@ impl MonitorEvent {
                                        *unsafe { Box::from_raw(a.take_inner()) },
                                )
                        },
-                       MonitorEvent::UpdateCompleted {mut funding_txo, mut monitor_update_id, } => {
-                               nativeMonitorEvent::UpdateCompleted {
+                       MonitorEvent::Completed {mut funding_txo, mut monitor_update_id, } => {
+                               nativeMonitorEvent::Completed {
                                        funding_txo: *unsafe { Box::from_raw(funding_txo.take_inner()) },
                                        monitor_update_id: monitor_update_id,
                                }
@@ -247,27 +261,27 @@ impl MonitorEvent {
        pub(crate) fn from_native(native: &nativeMonitorEvent) -> Self {
                match native {
                        nativeMonitorEvent::HTLCEvent (ref a, ) => {
-                               let mut a_nonref = (*a).clone();
+                               let mut a_nonref = Clone::clone(a);
                                MonitorEvent::HTLCEvent (
                                        crate::lightning::chain::channelmonitor::HTLCUpdate { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
                                )
                        },
                        nativeMonitorEvent::CommitmentTxConfirmed (ref a, ) => {
-                               let mut a_nonref = (*a).clone();
+                               let mut a_nonref = Clone::clone(a);
                                MonitorEvent::CommitmentTxConfirmed (
                                        crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
                                )
                        },
-                       nativeMonitorEvent::UpdateCompleted {ref funding_txo, ref monitor_update_id, } => {
-                               let mut funding_txo_nonref = (*funding_txo).clone();
-                               let mut monitor_update_id_nonref = (*monitor_update_id).clone();
-                               MonitorEvent::UpdateCompleted {
+                       nativeMonitorEvent::Completed {ref funding_txo, ref monitor_update_id, } => {
+                               let mut funding_txo_nonref = Clone::clone(funding_txo);
+                               let mut monitor_update_id_nonref = Clone::clone(monitor_update_id);
+                               MonitorEvent::Completed {
                                        funding_txo: crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(funding_txo_nonref), is_owned: true },
                                        monitor_update_id: monitor_update_id_nonref,
                                }
                        },
                        nativeMonitorEvent::UpdateFailed (ref a, ) => {
-                               let mut a_nonref = (*a).clone();
+                               let mut a_nonref = Clone::clone(a);
                                MonitorEvent::UpdateFailed (
                                        crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
                                )
@@ -287,8 +301,8 @@ impl MonitorEvent {
                                        crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a), is_owned: true },
                                )
                        },
-                       nativeMonitorEvent::UpdateCompleted {mut funding_txo, mut monitor_update_id, } => {
-                               MonitorEvent::UpdateCompleted {
+                       nativeMonitorEvent::Completed {mut funding_txo, mut monitor_update_id, } => {
+                               MonitorEvent::Completed {
                                        funding_txo: crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(funding_txo), is_owned: true },
                                        monitor_update_id: monitor_update_id,
                                }
@@ -320,9 +334,9 @@ pub extern "C" fn MonitorEvent_commitment_tx_confirmed(a: crate::lightning::chai
        MonitorEvent::CommitmentTxConfirmed(a, )
 }
 #[no_mangle]
-/// Utility method to constructs a new UpdateCompleted-variant MonitorEvent
-pub extern "C" fn MonitorEvent_update_completed(funding_txo: crate::lightning::chain::transaction::OutPoint, monitor_update_id: u64) -> MonitorEvent {
-       MonitorEvent::UpdateCompleted {
+/// Utility method to constructs a new Completed-variant MonitorEvent
+pub extern "C" fn MonitorEvent_completed(funding_txo: crate::lightning::chain::transaction::OutPoint, monitor_update_id: u64) -> MonitorEvent {
+       MonitorEvent::Completed {
                funding_txo,
                monitor_update_id,
        }
@@ -332,16 +346,22 @@ pub extern "C" fn MonitorEvent_update_completed(funding_txo: crate::lightning::c
 pub extern "C" fn MonitorEvent_update_failed(a: crate::lightning::chain::transaction::OutPoint) -> MonitorEvent {
        MonitorEvent::UpdateFailed(a, )
 }
+/// Checks if two MonitorEvents contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn MonitorEvent_eq(a: &MonitorEvent, b: &MonitorEvent) -> bool {
+       if &a.to_native() == &b.to_native() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
-pub extern "C" fn MonitorEvent_write(obj: &MonitorEvent) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn MonitorEvent_write(obj: &crate::lightning::chain::channelmonitor::MonitorEvent) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
 }
 #[no_mangle]
 /// Read a MonitorEvent from a byte array, created by MonitorEvent_write
 pub extern "C" fn MonitorEvent_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_MonitorEventZDecodeErrorZ {
        let res: Result<Option<lightning::chain::channelmonitor::MonitorEvent>, lightning::ln::msgs::DecodeError> = crate::c_types::maybe_deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_MonitorEventZ::None } else { crate::c_types::derived::COption_MonitorEventZ::Some( { crate::lightning::chain::channelmonitor::MonitorEvent::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_MonitorEventZ::None } else { crate::c_types::derived::COption_MonitorEventZ::Some( { crate::lightning::chain::channelmonitor::MonitorEvent::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 
@@ -379,7 +399,7 @@ pub extern "C" fn HTLCUpdate_free(this_obj: HTLCUpdate) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
 pub(crate) extern "C" fn HTLCUpdate_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeHTLCUpdate); }
+       let _ = unsafe { Box::from_raw(this_ptr as *mut nativeHTLCUpdate) };
 }
 #[allow(unused)]
 impl HTLCUpdate {
@@ -416,9 +436,18 @@ pub(crate) extern "C" fn HTLCUpdate_clone_void(this_ptr: *const c_void) -> *mut
 pub extern "C" fn HTLCUpdate_clone(orig: &HTLCUpdate) -> HTLCUpdate {
        orig.clone()
 }
+/// Checks if two HTLCUpdates contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn HTLCUpdate_eq(a: &HTLCUpdate, b: &HTLCUpdate) -> bool {
+       if a.inner == b.inner { return true; }
+       if a.inner.is_null() || b.inner.is_null() { return false; }
+       if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
 #[no_mangle]
 /// Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
-pub extern "C" fn HTLCUpdate_write(obj: &HTLCUpdate) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn HTLCUpdate_write(obj: &crate::lightning::chain::channelmonitor::HTLCUpdate) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
 #[no_mangle]
@@ -429,7 +458,7 @@ pub(crate) extern "C" fn HTLCUpdate_write_void(obj: *const c_void) -> crate::c_t
 /// Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
 pub extern "C" fn HTLCUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_HTLCUpdateDecodeErrorZ {
        let res: Result<lightning::chain::channelmonitor::HTLCUpdate, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::channelmonitor::HTLCUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::channelmonitor::HTLCUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }
 /// Number of blocks we wait on seeing a HTLC output being solved before we fail corresponding
@@ -446,8 +475,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
@@ -486,50 +515,89 @@ pub enum Balance {
        /// HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
        /// fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
        /// likely to be claimed by our counterparty before we do.
-       MaybeClaimableHTLCAwaitingTimeout {
-               /// The amount available to claim, in satoshis, excluding the on-chain fees which will be
-               /// required to do so.
+       MaybeTimeoutClaimableHTLC {
+               /// The amount potentially available to claim, in satoshis, excluding the on-chain fees
+               /// which will be required to do so.
                claimable_amount_satoshis: u64,
                /// The height at which we will be able to claim the balance if our counterparty has not
                /// done so.
                claimable_height: u32,
        },
+       /// HTLCs which we received from our counterparty which are claimable with a preimage which we
+       /// do not currently have. This will only be claimable if we receive the preimage from the node
+       /// to which we forwarded this HTLC before the timeout.
+       MaybePreimageClaimableHTLC {
+               /// The amount potentially available to claim, in satoshis, excluding the on-chain fees
+               /// which will be required to do so.
+               claimable_amount_satoshis: u64,
+               /// The height at which our counterparty will be able to claim the balance if we have not
+               /// yet received the preimage and claimed it ourselves.
+               expiry_height: u32,
+       },
+       /// The channel has been closed, and our counterparty broadcasted a revoked commitment
+       /// transaction.
+       ///
+       /// Thus, we're able to claim all outputs in the commitment transaction, one of which has the
+       /// following amount.
+       CounterpartyRevokedOutputClaimable {
+               /// The amount, in satoshis, of the output which we can claim.
+               ///
+               /// Note that for outputs from HTLC balances this may be excluding some on-chain fees that
+               /// were already spent.
+               claimable_amount_satoshis: u64,
+       },
 }
-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 {
                match self {
                        Balance::ClaimableOnChannelClose {ref claimable_amount_satoshis, } => {
-                               let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone();
+                               let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis);
                                nativeBalance::ClaimableOnChannelClose {
                                        claimable_amount_satoshis: claimable_amount_satoshis_nonref,
                                }
                        },
                        Balance::ClaimableAwaitingConfirmations {ref claimable_amount_satoshis, ref confirmation_height, } => {
-                               let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone();
-                               let mut confirmation_height_nonref = (*confirmation_height).clone();
+                               let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis);
+                               let mut confirmation_height_nonref = Clone::clone(confirmation_height);
                                nativeBalance::ClaimableAwaitingConfirmations {
                                        claimable_amount_satoshis: claimable_amount_satoshis_nonref,
                                        confirmation_height: confirmation_height_nonref,
                                }
                        },
                        Balance::ContentiousClaimable {ref claimable_amount_satoshis, ref timeout_height, } => {
-                               let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone();
-                               let mut timeout_height_nonref = (*timeout_height).clone();
+                               let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis);
+                               let mut timeout_height_nonref = Clone::clone(timeout_height);
                                nativeBalance::ContentiousClaimable {
                                        claimable_amount_satoshis: claimable_amount_satoshis_nonref,
                                        timeout_height: timeout_height_nonref,
                                }
                        },
-                       Balance::MaybeClaimableHTLCAwaitingTimeout {ref claimable_amount_satoshis, ref claimable_height, } => {
-                               let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone();
-                               let mut claimable_height_nonref = (*claimable_height).clone();
-                               nativeBalance::MaybeClaimableHTLCAwaitingTimeout {
+                       Balance::MaybeTimeoutClaimableHTLC {ref claimable_amount_satoshis, ref claimable_height, } => {
+                               let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis);
+                               let mut claimable_height_nonref = Clone::clone(claimable_height);
+                               nativeBalance::MaybeTimeoutClaimableHTLC {
                                        claimable_amount_satoshis: claimable_amount_satoshis_nonref,
                                        claimable_height: claimable_height_nonref,
                                }
                        },
+                       Balance::MaybePreimageClaimableHTLC {ref claimable_amount_satoshis, ref expiry_height, } => {
+                               let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis);
+                               let mut expiry_height_nonref = Clone::clone(expiry_height);
+                               nativeBalance::MaybePreimageClaimableHTLC {
+                                       claimable_amount_satoshis: claimable_amount_satoshis_nonref,
+                                       expiry_height: expiry_height_nonref,
+                               }
+                       },
+                       Balance::CounterpartyRevokedOutputClaimable {ref claimable_amount_satoshis, } => {
+                               let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis);
+                               nativeBalance::CounterpartyRevokedOutputClaimable {
+                                       claimable_amount_satoshis: claimable_amount_satoshis_nonref,
+                               }
+                       },
                }
        }
        #[allow(unused)]
@@ -552,47 +620,72 @@ impl Balance {
                                        timeout_height: timeout_height,
                                }
                        },
-                       Balance::MaybeClaimableHTLCAwaitingTimeout {mut claimable_amount_satoshis, mut claimable_height, } => {
-                               nativeBalance::MaybeClaimableHTLCAwaitingTimeout {
+                       Balance::MaybeTimeoutClaimableHTLC {mut claimable_amount_satoshis, mut claimable_height, } => {
+                               nativeBalance::MaybeTimeoutClaimableHTLC {
                                        claimable_amount_satoshis: claimable_amount_satoshis,
                                        claimable_height: claimable_height,
                                }
                        },
+                       Balance::MaybePreimageClaimableHTLC {mut claimable_amount_satoshis, mut expiry_height, } => {
+                               nativeBalance::MaybePreimageClaimableHTLC {
+                                       claimable_amount_satoshis: claimable_amount_satoshis,
+                                       expiry_height: expiry_height,
+                               }
+                       },
+                       Balance::CounterpartyRevokedOutputClaimable {mut claimable_amount_satoshis, } => {
+                               nativeBalance::CounterpartyRevokedOutputClaimable {
+                                       claimable_amount_satoshis: claimable_amount_satoshis,
+                               }
+                       },
                }
        }
        #[allow(unused)]
        pub(crate) fn from_native(native: &nativeBalance) -> Self {
                match native {
                        nativeBalance::ClaimableOnChannelClose {ref claimable_amount_satoshis, } => {
-                               let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone();
+                               let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis);
                                Balance::ClaimableOnChannelClose {
                                        claimable_amount_satoshis: claimable_amount_satoshis_nonref,
                                }
                        },
                        nativeBalance::ClaimableAwaitingConfirmations {ref claimable_amount_satoshis, ref confirmation_height, } => {
-                               let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone();
-                               let mut confirmation_height_nonref = (*confirmation_height).clone();
+                               let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis);
+                               let mut confirmation_height_nonref = Clone::clone(confirmation_height);
                                Balance::ClaimableAwaitingConfirmations {
                                        claimable_amount_satoshis: claimable_amount_satoshis_nonref,
                                        confirmation_height: confirmation_height_nonref,
                                }
                        },
                        nativeBalance::ContentiousClaimable {ref claimable_amount_satoshis, ref timeout_height, } => {
-                               let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone();
-                               let mut timeout_height_nonref = (*timeout_height).clone();
+                               let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis);
+                               let mut timeout_height_nonref = Clone::clone(timeout_height);
                                Balance::ContentiousClaimable {
                                        claimable_amount_satoshis: claimable_amount_satoshis_nonref,
                                        timeout_height: timeout_height_nonref,
                                }
                        },
-                       nativeBalance::MaybeClaimableHTLCAwaitingTimeout {ref claimable_amount_satoshis, ref claimable_height, } => {
-                               let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone();
-                               let mut claimable_height_nonref = (*claimable_height).clone();
-                               Balance::MaybeClaimableHTLCAwaitingTimeout {
+                       nativeBalance::MaybeTimeoutClaimableHTLC {ref claimable_amount_satoshis, ref claimable_height, } => {
+                               let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis);
+                               let mut claimable_height_nonref = Clone::clone(claimable_height);
+                               Balance::MaybeTimeoutClaimableHTLC {
                                        claimable_amount_satoshis: claimable_amount_satoshis_nonref,
                                        claimable_height: claimable_height_nonref,
                                }
                        },
+                       nativeBalance::MaybePreimageClaimableHTLC {ref claimable_amount_satoshis, ref expiry_height, } => {
+                               let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis);
+                               let mut expiry_height_nonref = Clone::clone(expiry_height);
+                               Balance::MaybePreimageClaimableHTLC {
+                                       claimable_amount_satoshis: claimable_amount_satoshis_nonref,
+                                       expiry_height: expiry_height_nonref,
+                               }
+                       },
+                       nativeBalance::CounterpartyRevokedOutputClaimable {ref claimable_amount_satoshis, } => {
+                               let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis);
+                               Balance::CounterpartyRevokedOutputClaimable {
+                                       claimable_amount_satoshis: claimable_amount_satoshis_nonref,
+                               }
+                       },
                }
        }
        #[allow(unused)]
@@ -615,12 +708,23 @@ impl Balance {
                                        timeout_height: timeout_height,
                                }
                        },
-                       nativeBalance::MaybeClaimableHTLCAwaitingTimeout {mut claimable_amount_satoshis, mut claimable_height, } => {
-                               Balance::MaybeClaimableHTLCAwaitingTimeout {
+                       nativeBalance::MaybeTimeoutClaimableHTLC {mut claimable_amount_satoshis, mut claimable_height, } => {
+                               Balance::MaybeTimeoutClaimableHTLC {
                                        claimable_amount_satoshis: claimable_amount_satoshis,
                                        claimable_height: claimable_height,
                                }
                        },
+                       nativeBalance::MaybePreimageClaimableHTLC {mut claimable_amount_satoshis, mut expiry_height, } => {
+                               Balance::MaybePreimageClaimableHTLC {
+                                       claimable_amount_satoshis: claimable_amount_satoshis,
+                                       expiry_height: expiry_height,
+                               }
+                       },
+                       nativeBalance::CounterpartyRevokedOutputClaimable {mut claimable_amount_satoshis, } => {
+                               Balance::CounterpartyRevokedOutputClaimable {
+                                       claimable_amount_satoshis: claimable_amount_satoshis,
+                               }
+                       },
                }
        }
 }
@@ -656,13 +760,28 @@ pub extern "C" fn Balance_contentious_claimable(claimable_amount_satoshis: u64,
        }
 }
 #[no_mangle]
-/// Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
-pub extern "C" fn Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis: u64, claimable_height: u32) -> Balance {
-       Balance::MaybeClaimableHTLCAwaitingTimeout {
+/// Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance
+pub extern "C" fn Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis: u64, claimable_height: u32) -> Balance {
+       Balance::MaybeTimeoutClaimableHTLC {
                claimable_amount_satoshis,
                claimable_height,
        }
 }
+#[no_mangle]
+/// Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance
+pub extern "C" fn Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis: u64, expiry_height: u32) -> Balance {
+       Balance::MaybePreimageClaimableHTLC {
+               claimable_amount_satoshis,
+               expiry_height,
+       }
+}
+#[no_mangle]
+/// Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance
+pub extern "C" fn Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis: u64) -> Balance {
+       Balance::CounterpartyRevokedOutputClaimable {
+               claimable_amount_satoshis,
+       }
+}
 /// Checks if two Balances contain equal inner contents.
 /// This ignores pointers and is_owned flags and looks at the values in fields.
 #[no_mangle]
@@ -671,7 +790,7 @@ pub extern "C" fn Balance_eq(a: &Balance, b: &Balance) -> bool {
 }
 
 use lightning::chain::channelmonitor::ChannelMonitor as nativeChannelMonitorImport;
-pub(crate) type nativeChannelMonitor = nativeChannelMonitorImport<crate::lightning::chain::keysinterface::Sign>;
+pub(crate) type nativeChannelMonitor = nativeChannelMonitorImport<crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner>;
 
 /// A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
 /// on-chain transactions to ensure no loss of funds occurs.
@@ -717,7 +836,7 @@ pub extern "C" fn ChannelMonitor_free(this_obj: ChannelMonitor) { }
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
 pub(crate) extern "C" fn ChannelMonitor_free_void(this_ptr: *mut c_void) {
-       unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelMonitor); }
+       let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelMonitor) };
 }
 #[allow(unused)]
 impl ChannelMonitor {
@@ -737,7 +856,7 @@ impl ChannelMonitor {
 }
 #[no_mangle]
 /// Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
-pub extern "C" fn ChannelMonitor_write(obj: &ChannelMonitor) -> crate::c_types::derived::CVec_u8Z {
+pub extern "C" fn ChannelMonitor_write(obj: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
 #[no_mangle]
@@ -750,7 +869,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: &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
@@ -760,7 +879,7 @@ pub extern "C" fn ChannelMonitor_update_monitor(this_arg: &ChannelMonitor, updat
 /// ChannelMonitor.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_get_latest_update_id(this_arg: &ChannelMonitor) -> u64 {
+pub extern "C" fn ChannelMonitor_get_latest_update_id(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> u64 {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_latest_update_id();
        ret
 }
@@ -768,7 +887,7 @@ pub extern "C" fn ChannelMonitor_get_latest_update_id(this_arg: &ChannelMonitor)
 /// Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_get_funding_txo(this_arg: &ChannelMonitor) -> crate::c_types::derived::C2Tuple_OutPointScriptZ {
+pub extern "C" fn ChannelMonitor_get_funding_txo(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::C2Tuple_OutPointScriptZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_funding_txo();
        let (mut orig_ret_0, mut orig_ret_1) = ret; let mut local_ret = (crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(orig_ret_0), is_owned: true }, orig_ret_1.into_bytes().into()).into();
        local_ret
@@ -778,7 +897,7 @@ pub extern "C" fn ChannelMonitor_get_funding_txo(this_arg: &ChannelMonitor) -> c
 /// transaction), which we must learn about spends of via block_connected().
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_get_outputs_to_watch(this_arg: &ChannelMonitor) -> crate::c_types::derived::CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
+pub extern "C" fn ChannelMonitor_get_outputs_to_watch(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_outputs_to_watch();
        let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { let (mut orig_orig_ret_0_1_0_0, mut orig_orig_ret_0_1_0_1) = item; let mut local_orig_ret_0_1_0 = (orig_orig_ret_0_1_0_0, orig_orig_ret_0_1_0_1.into_bytes().into()).into(); local_orig_ret_0_1_0 }); }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1.into()).into(); local_ret_0 }); };
        local_ret.into()
@@ -788,7 +907,7 @@ pub extern "C" fn ChannelMonitor_get_outputs_to_watch(this_arg: &ChannelMonitor)
 /// calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
 /// have been registered.
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_load_outputs_to_watch(this_arg: &ChannelMonitor, filter: &crate::lightning::chain::Filter) {
+pub extern "C" fn ChannelMonitor_load_outputs_to_watch(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, filter: &crate::lightning::chain::Filter) {
        unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.load_outputs_to_watch(filter)
 }
 
@@ -796,7 +915,7 @@ pub extern "C" fn ChannelMonitor_load_outputs_to_watch(this_arg: &ChannelMonitor
 /// ChannelManager via [`chain::Watch::release_pending_monitor_events`].
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_get_and_clear_pending_monitor_events(this_arg: &ChannelMonitor) -> crate::c_types::derived::CVec_MonitorEventZ {
+pub extern "C" fn ChannelMonitor_get_and_clear_pending_monitor_events(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_MonitorEventZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_and_clear_pending_monitor_events();
        let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::chain::channelmonitor::MonitorEvent::native_into(item) }); };
        local_ret.into()
@@ -805,29 +924,51 @@ pub extern "C" fn ChannelMonitor_get_and_clear_pending_monitor_events(this_arg:
 /// Gets the list of pending events which were generated by previous actions, clearing the list
 /// in the process.
 ///
-/// This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
-/// EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
-/// no internal locking in ChannelMonitors.
+/// This is called by the [`EventsProvider::process_pending_events`] implementation for
+/// [`ChainMonitor`].
+///
+/// [`EventsProvider::process_pending_events`]: crate::util::events::EventsProvider::process_pending_events
+/// [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_get_and_clear_pending_events(this_arg: &ChannelMonitor) -> crate::c_types::derived::CVec_EventZ {
+pub extern "C" fn ChannelMonitor_get_and_clear_pending_events(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_EventZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_and_clear_pending_events();
        let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::util::events::Event::native_into(item) }); };
        local_ret.into()
 }
 
+/// 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
-/// a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
-/// transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
-/// broadcast them if counterparty don't close channel with his higher commitment transaction after a
-/// substantial amount of time (a month or even a year) to get back funds. Best may be to contact
-/// out-of-band the other node operator to coordinate with him if option is available to you.
-/// In any-case, choice is up to the user.
+/// the Channel was out-of-date.
+///
+/// You may also use this to broadcast the latest local commitment transaction, either because
+/// a monitor update failed with [`ChannelMonitorUpdateStatus::PermanentFailure`] or because we've
+/// fallen behind (i.e. we've received proof that our counterparty side knows a revocation
+/// secret we gave them that they shouldn't know).
+///
+/// Broadcasting these transactions in the second case is UNSAFE, as they allow counterparty
+/// side to punish you. Nevertheless you may want to broadcast them if counterparty doesn't
+/// close channel with their commitment transaction after a substantial amount of time. Best
+/// may be to contact the other node operator out-of-band to coordinate other options available
+/// to you. In any-case, the choice is up to you.
+///
+/// [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_get_latest_holder_commitment_txn(this_arg: &ChannelMonitor, logger: &crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionZ {
+pub extern "C" fn ChannelMonitor_get_latest_holder_commitment_txn(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, logger: &crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_latest_holder_commitment_txn(logger);
        let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::Transaction::from_bitcoin(&item) }); };
        local_ret.into()
@@ -846,7 +987,7 @@ pub extern "C" fn ChannelMonitor_get_latest_holder_commitment_txn(this_arg: &Cha
 /// [`get_outputs_to_watch`]: #method.get_outputs_to_watch
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_block_connected(this_arg: &ChannelMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionOutputsZ {
+pub extern "C" fn ChannelMonitor_block_connected(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionOutputsZ {
        let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); };
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.block_connected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..], height, broadcaster, fee_estimator, logger);
        let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { let (mut orig_orig_ret_0_1_0_0, mut orig_orig_ret_0_1_0_1) = item; let mut local_orig_ret_0_1_0 = (orig_orig_ret_0_1_0_0, crate::c_types::TxOut::from_rust(orig_orig_ret_0_1_0_1)).into(); local_orig_ret_0_1_0 }); }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1.into()).into(); local_ret_0 }); };
@@ -856,7 +997,7 @@ pub extern "C" fn ChannelMonitor_block_connected(this_arg: &ChannelMonitor, head
 /// Determines if the disconnected block contained any transactions of interest and updates
 /// appropriately.
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_block_disconnected(this_arg: &ChannelMonitor, header: *const [u8; 80], mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) {
+pub extern "C" fn ChannelMonitor_block_disconnected(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, header: *const [u8; 80], mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) {
        unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.block_disconnected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height, broadcaster, fee_estimator, logger)
 }
 
@@ -869,7 +1010,7 @@ pub extern "C" fn ChannelMonitor_block_disconnected(this_arg: &ChannelMonitor, h
 /// [`block_connected`]: Self::block_connected
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_transactions_confirmed(this_arg: &ChannelMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionOutputsZ {
+pub extern "C" fn ChannelMonitor_transactions_confirmed(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionOutputsZ {
        let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); };
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.transactions_confirmed(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..], height, broadcaster, fee_estimator, logger);
        let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { let (mut orig_orig_ret_0_1_0_0, mut orig_orig_ret_0_1_0_1) = item; let mut local_orig_ret_0_1_0 = (orig_orig_ret_0_1_0_0, crate::c_types::TxOut::from_rust(orig_orig_ret_0_1_0_1)).into(); local_orig_ret_0_1_0 }); }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1.into()).into(); local_ret_0 }); };
@@ -883,7 +1024,7 @@ pub extern "C" fn ChannelMonitor_transactions_confirmed(this_arg: &ChannelMonito
 ///
 /// [`block_disconnected`]: Self::block_disconnected
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_transaction_unconfirmed(this_arg: &ChannelMonitor, txid: *const [u8; 32], mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) {
+pub extern "C" fn ChannelMonitor_transaction_unconfirmed(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, txid: *const [u8; 32], mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) {
        unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.transaction_unconfirmed(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*txid }[..]).unwrap(), broadcaster, fee_estimator, logger)
 }
 
@@ -896,7 +1037,7 @@ pub extern "C" fn ChannelMonitor_transaction_unconfirmed(this_arg: &ChannelMonit
 /// [`block_connected`]: Self::block_connected
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_best_block_updated(this_arg: &ChannelMonitor, header: *const [u8; 80], mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionOutputsZ {
+pub extern "C" fn ChannelMonitor_best_block_updated(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, header: *const [u8; 80], mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionOutputsZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.best_block_updated(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height, broadcaster, fee_estimator, logger);
        let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { let (mut orig_orig_ret_0_1_0_0, mut orig_orig_ret_0_1_0_1) = item; let mut local_orig_ret_0_1_0 = (orig_orig_ret_0_1_0_0, crate::c_types::TxOut::from_rust(orig_orig_ret_0_1_0_1)).into(); local_orig_ret_0_1_0 }); }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1.into()).into(); local_ret_0 }); };
        local_ret.into()
@@ -905,9 +1046,9 @@ pub extern "C" fn ChannelMonitor_best_block_updated(this_arg: &ChannelMonitor, h
 /// Returns the set of txids that should be monitored for re-organization out of the chain.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_get_relevant_txids(this_arg: &ChannelMonitor) -> crate::c_types::derived::CVec_TxidZ {
+pub extern "C" fn ChannelMonitor_get_relevant_txids(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_C2Tuple_TxidBlockHashZZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_relevant_txids();
-       let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.into_inner() } }); };
+       let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = if orig_ret_0_1.is_none() { crate::c_types::ThirtyTwoBytes::null() } else {  { crate::c_types::ThirtyTwoBytes { data: (orig_ret_0_1.unwrap()).into_inner() } } }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1).into(); local_ret_0 }); };
        local_ret.into()
 }
 
@@ -915,7 +1056,7 @@ pub extern "C" fn ChannelMonitor_get_relevant_txids(this_arg: &ChannelMonitor) -
 /// [`chain::Confirm`] interfaces.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_current_best_block(this_arg: &ChannelMonitor) -> crate::lightning::chain::BestBlock {
+pub extern "C" fn ChannelMonitor_current_best_block(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::chain::BestBlock {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.current_best_block();
        crate::lightning::chain::BestBlock { inner: ObjOps::heap_alloc(ret), is_owned: true }
 }
@@ -929,14 +1070,15 @@ pub extern "C" fn ChannelMonitor_current_best_block(this_arg: &ChannelMonitor) -
 /// balance, or until our counterparty has claimed the balance and accrued several
 /// confirmations on the claim transaction.
 ///
-/// Note that the balances available when you or your counterparty have broadcasted revoked
-/// state(s) may not be fully captured here.
+/// Note that for `ChannelMonitors` which track a channel which went on-chain with versions of
+/// LDK prior to 0.0.111, balances may not be fully captured if our counterparty broadcasted
+/// a revoked state.
 ///
 /// See [`Balance`] for additional details on the types of claimable balances which
 /// may be returned here and their meanings.
 #[must_use]
 #[no_mangle]
-pub extern "C" fn ChannelMonitor_get_claimable_balances(this_arg: &ChannelMonitor) -> crate::c_types::derived::CVec_BalanceZ {
+pub extern "C" fn ChannelMonitor_get_claimable_balances(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_BalanceZ {
        let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_claimable_balances();
        let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::chain::channelmonitor::Balance::native_into(item) }); };
        local_ret.into()
@@ -944,9 +1086,11 @@ pub extern "C" fn ChannelMonitor_get_claimable_balances(this_arg: &ChannelMonito
 
 #[no_mangle]
 /// Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
-pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_read(ser: crate::c_types::u8slice, arg: &crate::lightning::chain::keysinterface::KeysInterface) -> crate::c_types::derived::CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
-       let arg_conv = arg;
-       let res: Result<(bitcoin::hash_types::BlockHash, lightning::chain::channelmonitor::ChannelMonitor<crate::lightning::chain::keysinterface::Sign>), lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv);
-       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_res_0_0, mut orig_res_0_1) = o; let mut local_res_0 = (crate::c_types::ThirtyTwoBytes { data: orig_res_0_0.into_inner() }, crate::lightning::chain::channelmonitor::ChannelMonitor { inner: ObjOps::heap_alloc(orig_res_0_1), is_owned: true }).into(); local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_read(ser: crate::c_types::u8slice, arg_a: &crate::lightning::chain::keysinterface::EntropySource, arg_b: &crate::lightning::chain::keysinterface::SignerProvider) -> crate::c_types::derived::CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
+       let arg_a_conv = arg_a;
+       let arg_b_conv = arg_b;
+       let arg_conv = (arg_a_conv, arg_b_conv);
+       let res: Result<(bitcoin::hash_types::BlockHash, lightning::chain::channelmonitor::ChannelMonitor<crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner>), lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_res_0_0, mut orig_res_0_1) = o; let mut local_res_0 = (crate::c_types::ThirtyTwoBytes { data: orig_res_0_0.into_inner() }, crate::lightning::chain::channelmonitor::ChannelMonitor { inner: ObjOps::heap_alloc(orig_res_0_1), is_owned: true }).into(); local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
        local_res
 }