@@ -1216,18 +1216,6 @@ impl<Signer: Sign> Channel<Signer> {
1216
1216
make_funding_redeemscript ( & self . get_holder_pubkeys ( ) . funding_pubkey , self . counterparty_funding_pubkey ( ) )
1217
1217
}
1218
1218
1219
- /// Builds the htlc-success or htlc-timeout transaction which spends a given HTLC output
1220
- /// @local is used only to convert relevant internal structures which refer to remote vs local
1221
- /// to decide value of outputs and direction of HTLCs.
1222
- fn build_htlc_transaction ( & self , prev_hash : & Txid , htlc : & HTLCOutputInCommitment , local : bool , keys : & TxCreationKeys , feerate_per_kw : u32 ) -> Transaction {
1223
- chan_utils:: build_htlc_transaction ( prev_hash, feerate_per_kw,
1224
- if local {
1225
- self . get_counterparty_selected_contest_delay ( ) . unwrap ( )
1226
- } else {
1227
- self . get_holder_selected_contest_delay ( )
1228
- } , htlc, & keys. broadcaster_delayed_payment_key , & keys. revocation_key )
1229
- }
1230
-
1231
1219
/// Per HTLC, only one get_update_fail_htlc or get_update_fulfill_htlc call may be made.
1232
1220
/// In such cases we debug_assert!(false) and return a ChannelError::Ignore. Thus, will always
1233
1221
/// return Ok(_) if debug assertions are turned on or preconditions are met.
@@ -2247,7 +2235,10 @@ impl<Signer: Sign> Channel<Signer> {
2247
2235
let mut htlcs_and_sigs = Vec :: with_capacity ( htlcs_cloned. len ( ) ) ;
2248
2236
for ( idx, ( htlc, source) ) in htlcs_cloned. drain ( ..) . enumerate ( ) {
2249
2237
if let Some ( _) = htlc. transaction_output_index {
2250
- let htlc_tx = self . build_htlc_transaction ( & commitment_txid, & htlc, true , & keys, feerate_per_kw) ;
2238
+ let htlc_tx = chan_utils:: build_htlc_transaction ( & commitment_txid, feerate_per_kw,
2239
+ self . get_counterparty_selected_contest_delay ( ) . unwrap ( ) , & htlc,
2240
+ & keys. broadcaster_delayed_payment_key , & keys. revocation_key ) ;
2241
+
2251
2242
let htlc_redeemscript = chan_utils:: get_htlc_redeemscript ( & htlc, & keys) ;
2252
2243
let htlc_sighash = hash_to_message ! ( & bip143:: SigHashCache :: new( & htlc_tx) . signature_hash( 0 , & htlc_redeemscript, htlc. amount_msat / 1000 , SigHashType :: All ) [ ..] ) ;
2253
2244
log_trace ! ( logger, "Checking HTLC tx signature {} by key {} against tx {} (sighash {}) with redeemscript {} in channel {}." ,
@@ -5420,7 +5411,9 @@ mod tests {
5420
5411
let remote_signature = Signature :: from_der( & hex:: decode( $counterparty_htlc_sig_hex) . unwrap( ) [ ..] ) . unwrap( ) ;
5421
5412
5422
5413
let ref htlc = htlcs[ $htlc_idx] ;
5423
- let htlc_tx = chan. build_htlc_transaction( & unsigned_tx. txid, & htlc, true , & keys, chan. feerate_per_kw) ;
5414
+ let htlc_tx = chan_utils:: build_htlc_transaction( & unsigned_tx. txid, chan. feerate_per_kw,
5415
+ chan. get_counterparty_selected_contest_delay( ) . unwrap( ) ,
5416
+ & htlc, & keys. broadcaster_delayed_payment_key, & keys. revocation_key) ;
5424
5417
let htlc_redeemscript = chan_utils:: get_htlc_redeemscript( & htlc, & keys) ;
5425
5418
let htlc_sighash = Message :: from_slice( & bip143:: SigHashCache :: new( & htlc_tx) . signature_hash( 0 , & htlc_redeemscript, htlc. amount_msat / 1000 , SigHashType :: All ) [ ..] ) . unwrap( ) ;
5426
5419
secp_ctx. verify( & htlc_sighash, & remote_signature, & keys. countersignatory_htlc_key) . unwrap( ) ;
0 commit comments