+/// Gets the counterparty's initial commitment transaction. The returned commitment
+/// transaction is unsigned. This is intended to be called during the initial persistence of
+/// the monitor (inside an implementation of [`Persist::persist_new_channel`]), to allow for
+/// watchtowers in the persistence pipeline to have enough data to form justice transactions.
+///
+/// This is similar to [`Self::counterparty_commitment_txs_from_update`], except
+/// that for the initial commitment transaction, we don't have a corresponding update.
+///
+/// This will only return `Some` for channel monitors that have been created after upgrading
+/// to LDK 0.0.117+.
+///
+/// [`Persist::persist_new_channel`]: crate::chain::chainmonitor::Persist::persist_new_channel
+///
+/// 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_initial_counterparty_commitment_tx(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::ln::chan_utils::CommitmentTransaction {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.initial_counterparty_commitment_tx();
+ let mut local_ret = crate::lightning::ln::chan_utils::CommitmentTransaction { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true };
+ local_ret
+}
+
+/// Gets all of the counterparty commitment transactions provided by the given update. This
+/// may be empty if the update doesn't include any new counterparty commitments. Returned
+/// commitment transactions are unsigned.
+///
+/// This is provided so that watchtower clients in the persistence pipeline are able to build
+/// justice transactions for each counterparty commitment upon each update. It's intended to be
+/// used within an implementation of [`Persist::update_persisted_channel`], which is provided
+/// with a monitor and an update. Once revoked, signing a justice transaction can be done using
+/// [`Self::sign_to_local_justice_tx`].
+///
+/// It is expected that a watchtower client may use this method to retrieve the latest counterparty
+/// commitment transaction(s), and then hold the necessary data until a later update in which
+/// the monitor has been updated with the corresponding revocation data, at which point the
+/// monitor can sign the justice transaction.
+///
+/// This will only return a non-empty list for monitor updates that have been created after
+/// upgrading to LDK 0.0.117+. Note that no restriction lies on the monitors themselves, which
+/// may have been created prior to upgrading.
+///
+/// [`Persist::update_persisted_channel`]: crate::chain::chainmonitor::Persist::update_persisted_channel
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelMonitor_counterparty_commitment_txs_from_update(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, update: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CVec_CommitmentTransactionZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.counterparty_commitment_txs_from_update(update.get_native_ref());
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::chan_utils::CommitmentTransaction { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
+ local_ret.into()
+}
+
+/// Wrapper around [`EcdsaChannelSigner::sign_justice_revoked_output`] to make
+/// signing the justice transaction easier for implementors of
+/// [`chain::chainmonitor::Persist`]. On success this method returns the provided transaction
+/// signing the input at `input_idx`. This method will only produce a valid signature for
+/// a transaction spending the `to_local` output of a commitment transaction, i.e. this cannot
+/// be used for revoked HTLC outputs.
+///
+/// `Value` is the value of the output being spent by the input at `input_idx`, committed
+/// in the BIP 143 signature.
+///
+/// This method will only succeed if this monitor has received the revocation secret for the
+/// provided `commitment_number`. If a commitment number is provided that does not correspond
+/// to the commitment transaction being revoked, this will return a signed transaction, but
+/// the signature will not be valid.
+///
+/// [`EcdsaChannelSigner::sign_justice_revoked_output`]: crate::sign::EcdsaChannelSigner::sign_justice_revoked_output
+/// [`Persist`]: crate::chain::chainmonitor::Persist
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelMonitor_sign_to_local_justice_tx(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, mut justice_tx: crate::c_types::Transaction, mut input_idx: usize, mut value: u64, mut commitment_number: u64) -> crate::c_types::derived::CResult_TransactionNoneZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign_to_local_justice_tx(justice_tx.into_bitcoin(), input_idx, value, commitment_number);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Transaction::from_bitcoin(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+ local_ret
+}
+