@@ -525,12 +525,18 @@ pub fn make_funding_redeemscript(broadcaster: &PublicKey, countersignatory: &Pub
525
525
} . push_opcode ( opcodes:: all:: OP_PUSHNUM_2 ) . push_opcode ( opcodes:: all:: OP_CHECKMULTISIG ) . into_script ( )
526
526
}
527
527
528
- /// panics if htlc.transaction_output_index.is_none()!
529
- pub fn build_htlc_transaction ( prev_hash : & Txid , feerate_per_kw : u32 , contest_delay : u16 , htlc : & HTLCOutputInCommitment , broadcaster_delayed_payment_key : & PublicKey , revocation_key : & PublicKey ) -> Transaction {
528
+ /// Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
529
+ /// parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
530
+ /// transaction which needs signing, and can be used to construct an HTLC transaction which is
531
+ /// broadcastable given a counterparty HTLC signature.
532
+ ///
533
+ /// Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
534
+ /// commitment transaction).
535
+ pub fn build_htlc_transaction ( commitment_txid : & Txid , feerate_per_kw : u32 , contest_delay : u16 , htlc : & HTLCOutputInCommitment , broadcaster_delayed_payment_key : & PublicKey , revocation_key : & PublicKey ) -> Transaction {
530
536
let mut txins: Vec < TxIn > = Vec :: new ( ) ;
531
537
txins. push ( TxIn {
532
538
previous_output : OutPoint {
533
- txid : prev_hash . clone ( ) ,
539
+ txid : commitment_txid . clone ( ) ,
534
540
vout : htlc. transaction_output_index . expect ( "Can't build an HTLC transaction for a dust output" ) ,
535
541
} ,
536
542
script_sig : Script :: new ( ) ,
@@ -1177,7 +1183,12 @@ impl<'a> TrustedCommitmentTransaction<'a> {
1177
1183
}
1178
1184
}
1179
1185
1180
- /// Get the transaction number obscure factor
1186
+ /// Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
1187
+ /// shared secret first. This prevents on-chain observers from discovering how many commitment
1188
+ /// transactions occurred in a channel before it was closed.
1189
+ ///
1190
+ /// This function gets the shared secret from relevant channel public keys and can be used to
1191
+ /// "decrypt" the commitment transaction number given a commitment transaction on-chain.
1181
1192
pub fn get_commitment_transaction_number_obscure_factor (
1182
1193
broadcaster_payment_basepoint : & PublicKey ,
1183
1194
countersignatory_payment_basepoint : & PublicKey ,
0 commit comments