-/// We use this to track local commitment transactions and put off signing them until we are ready
-/// to broadcast. Eventually this will require a signer which is possibly external, but for now we
-/// just pass in the SecretKeys required.
-pub struct LocalCommitmentTransaction {
- tx: Transaction,
- pub(crate) local_keys: TxCreationKeys,
- pub(crate) feerate_per_kw: u64,
- pub(crate) per_htlc: Vec<(HTLCOutputInCommitment, Option<Signature>)>,
+/// We use this to track holder commitment transactions and put off signing them until we are ready
+/// to broadcast. This class can be used inside a signer implementation to generate a signature
+/// given the relevant secret key.
+pub struct HolderCommitmentTransaction {
+ // TODO: We should migrate away from providing the transaction, instead providing enough to
+ // allow the ChannelKeys to construct it from scratch. Luckily we already have HTLC data here,
+ // so we're probably most of the way there.
+ /// The commitment transaction itself, in unsigned form.
+ pub unsigned_tx: Transaction,
+ /// Our counterparty's signature for the transaction, above.
+ pub counterparty_sig: Signature,
+ // Which order the signatures should go in when constructing the final commitment tx witness.
+ // The user should be able to reconstruc this themselves, so we don't bother to expose it.
+ holder_sig_first: bool,
+ pub(crate) keys: TxCreationKeys,
+ /// The feerate paid per 1000-weight-unit in this commitment transaction. This value is
+ /// controlled by the channel initiator.
+ pub feerate_per_kw: u32,
+ /// The HTLCs and counterparty htlc signatures which were included in this commitment transaction.
+ ///
+ /// Note that this includes all HTLCs, including ones which were considered dust and not
+ /// actually included in the transaction as it appears on-chain, but who's value is burned as
+ /// fees and not included in the to_holder or to_counterparty outputs.
+ ///
+ /// The counterparty HTLC signatures in the second element will always be set for non-dust HTLCs, ie
+ /// those for which transaction_output_index.is_some().
+ pub per_htlc: Vec<(HTLCOutputInCommitment, Option<Signature>)>,