Expose ClaimId for each claim bump in BumpTransactionEvent
[rust-lightning] / lightning / src / events / bump_transaction.rs
index f56a99df8f280b955f43b9ee5561718cbf492dda..d627132eaced34606f35b55062b4159d7670d6c5 100644 (file)
@@ -9,6 +9,7 @@
 
 //! Utitilies for bumping transactions originating from [`super::Event`]s.
 
+use crate::chain::ClaimId;
 use crate::ln::PaymentPreimage;
 use crate::ln::chan_utils;
 use crate::ln::chan_utils::{ChannelTransactionParameters, HTLCOutputInCommitment};
@@ -24,13 +25,13 @@ pub struct AnchorDescriptor {
        /// A unique identifier used along with `channel_value_satoshis` to re-derive the
        /// [`InMemorySigner`] required to sign `input`.
        ///
-       /// [`InMemorySigner`]: crate::chain::keysinterface::InMemorySigner
+       /// [`InMemorySigner`]: crate::sign::InMemorySigner
        pub channel_keys_id: [u8; 32],
        /// The value in satoshis of the channel we're attempting to spend the anchor output of. This is
        /// used along with `channel_keys_id` to re-derive the [`InMemorySigner`] required to sign
        /// `input`.
        ///
-       /// [`InMemorySigner`]: crate::chain::keysinterface::InMemorySigner
+       /// [`InMemorySigner`]: crate::sign::InMemorySigner
        pub channel_value_satoshis: u64,
        /// The transaction input's outpoint corresponding to the commitment transaction's anchor
        /// output.
@@ -43,19 +44,19 @@ pub struct HTLCDescriptor {
        /// A unique identifier used along with `channel_value_satoshis` to re-derive the
        /// [`InMemorySigner`] required to sign `input`.
        ///
-       /// [`InMemorySigner`]: crate::chain::keysinterface::InMemorySigner
+       /// [`InMemorySigner`]: crate::sign::InMemorySigner
        pub channel_keys_id: [u8; 32],
        /// The value in satoshis of the channel we're attempting to spend the anchor output of. This is
        /// used along with `channel_keys_id` to re-derive the [`InMemorySigner`] required to sign
        /// `input`.
        ///
-       /// [`InMemorySigner`]: crate::chain::keysinterface::InMemorySigner
+       /// [`InMemorySigner`]: crate::sign::InMemorySigner
        pub channel_value_satoshis: u64,
        /// The necessary channel parameters that need to be provided to the re-derived
        /// [`InMemorySigner`] through [`ChannelSigner::provide_channel_parameters`].
        ///
-       /// [`InMemorySigner`]: crate::chain::keysinterface::InMemorySigner
-       /// [`ChannelSigner::provide_channel_parameters`]: crate::chain::keysinterface::ChannelSigner::provide_channel_parameters
+       /// [`InMemorySigner`]: crate::sign::InMemorySigner
+       /// [`ChannelSigner::provide_channel_parameters`]: crate::sign::ChannelSigner::provide_channel_parameters
        pub channel_parameters: ChannelTransactionParameters,
        /// The txid of the commitment transaction in which the HTLC output lives.
        pub commitment_txid: Txid,
@@ -168,11 +169,17 @@ pub enum BumpTransactionEvent {
        /// an empty `pending_htlcs`), confirmation of the commitment transaction can be considered to
        /// be not urgent.
        ///
-       /// [`InMemorySigner`]: crate::chain::keysinterface::InMemorySigner
-       /// [`KeysManager::derive_channel_keys`]: crate::chain::keysinterface::KeysManager::derive_channel_keys
-       /// [`EcdsaChannelSigner::sign_holder_anchor_input`]: crate::chain::keysinterface::EcdsaChannelSigner::sign_holder_anchor_input
+       /// [`InMemorySigner`]: crate::sign::InMemorySigner
+       /// [`KeysManager::derive_channel_keys`]: crate::sign::KeysManager::derive_channel_keys
+       /// [`EcdsaChannelSigner::sign_holder_anchor_input`]: crate::sign::EcdsaChannelSigner::sign_holder_anchor_input
        /// [`build_anchor_input_witness`]: crate::ln::chan_utils::build_anchor_input_witness
        ChannelClose {
+               /// The unique identifier for the claim of the anchor output in the commitment transaction.
+               ///
+               /// The identifier must map to the set of external UTXOs assigned to the claim, such that
+               /// they can be reused when a new claim with the same identifier needs to be made, resulting
+               /// in a fee-bumping attempt.
+               claim_id: ClaimId,
                /// The target feerate that the transaction package, which consists of the commitment
                /// transaction and the to-be-crafted child anchor transaction, must meet.
                package_target_feerate_sat_per_1000_weight: u32,
@@ -217,15 +224,24 @@ pub enum BumpTransactionEvent {
        /// longer able to commit external confirmed funds to the HTLC transaction or the fee committed
        /// to the HTLC transaction is greater in value than the HTLCs being claimed.
        ///
-       /// [`InMemorySigner`]: crate::chain::keysinterface::InMemorySigner
-       /// [`KeysManager::derive_channel_keys`]: crate::chain::keysinterface::KeysManager::derive_channel_keys
-       /// [`EcdsaChannelSigner::sign_holder_htlc_transaction`]: crate::chain::keysinterface::EcdsaChannelSigner::sign_holder_htlc_transaction
+       /// [`InMemorySigner`]: crate::sign::InMemorySigner
+       /// [`KeysManager::derive_channel_keys`]: crate::sign::KeysManager::derive_channel_keys
+       /// [`EcdsaChannelSigner::sign_holder_htlc_transaction`]: crate::sign::EcdsaChannelSigner::sign_holder_htlc_transaction
        /// [`HTLCDescriptor::tx_input_witness`]: HTLCDescriptor::tx_input_witness
        HTLCResolution {
+               /// The unique identifier for the claim of the HTLCs in the confirmed commitment
+               /// transaction.
+               ///
+               /// The identifier must map to the set of external UTXOs assigned to the claim, such that
+               /// they can be reused when a new claim with the same identifier needs to be made, resulting
+               /// in a fee-bumping attempt.
+               claim_id: ClaimId,
                /// The target feerate that the resulting HTLC transaction must meet.
                target_feerate_sat_per_1000_weight: u32,
                /// The set of pending HTLCs on the confirmed commitment that need to be claimed, preferably
                /// by the same transaction.
                htlc_descriptors: Vec<HTLCDescriptor>,
+               /// The locktime required for the resulting HTLC transaction.
+               tx_lock_time: PackedLockTime,
        },
 }