@@ -2141,7 +2141,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
21412141 } = & event. event {
21422142 if event. transaction . as_ref ( ) . map ( |tx| tx. input . iter ( ) . any ( |inp| {
21432143 if let Some ( htlc_spend_txid) = htlc_spend_txid_opt {
2144- tx. txid ( ) == * htlc_spend_txid || inp. previous_output . txid == * htlc_spend_txid
2144+ tx. compute_txid ( ) == * htlc_spend_txid || inp. previous_output . txid == * htlc_spend_txid
21452145 } else {
21462146 Some ( inp. previous_output . txid ) == confirmed_txid &&
21472147 inp. previous_output . vout == htlc_commitment_tx_output_idx
@@ -2590,7 +2590,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
25902590macro_rules! fail_unbroadcast_htlcs {
25912591 ( $self: expr, $commitment_tx_type: expr, $commitment_txid_confirmed: expr, $commitment_tx_confirmed: expr,
25922592 $commitment_tx_conf_height: expr, $commitment_tx_conf_hash: expr, $confirmed_htlcs_list: expr, $logger: expr) => { {
2593- debug_assert_eq!( $commitment_tx_confirmed. txid ( ) , $commitment_txid_confirmed) ;
2593+ debug_assert_eq!( $commitment_tx_confirmed. compute_txid ( ) , $commitment_txid_confirmed) ;
25942594
25952595 macro_rules! check_htlc_fails {
25962596 ( $txid: expr, $commitment_tx: expr, $per_commitment_outpoints: expr) => {
@@ -3223,7 +3223,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
32233223 // introduced with v0.0.116. counterparty_node_id is guaranteed to be `Some`
32243224 // since v0.0.110.
32253225 let counterparty_node_id = self . counterparty_node_id . unwrap ( ) ;
3226- let commitment_txid = commitment_tx. txid ( ) ;
3226+ let commitment_txid = commitment_tx. compute_txid ( ) ;
32273227 debug_assert_eq ! ( self . current_holder_commitment_tx. txid, commitment_txid) ;
32283228 let pending_htlcs = self . current_holder_commitment_tx . non_dust_htlcs ( ) ;
32293229 let commitment_tx_fee_satoshis = self . channel_value_satoshis -
@@ -3403,7 +3403,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
34033403 let mut claimable_outpoints = Vec :: new ( ) ;
34043404 let mut to_counterparty_output_info = None ;
34053405
3406- let commitment_txid = tx. txid ( ) ; //TODO: This is gonna be a performance bottleneck for watchtowers!
3406+ let commitment_txid = tx. compute_txid ( ) ; //TODO: This is gonna be a performance bottleneck for watchtowers!
34073407 let per_commitment_option = self . counterparty_claimable_outpoints . get ( & commitment_txid) ;
34083408
34093409 macro_rules! ignore_error {
@@ -3589,7 +3589,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
35893589 } ;
35903590 let per_commitment_point = PublicKey :: from_secret_key ( & self . onchain_tx_handler . secp_ctx , & per_commitment_key) ;
35913591
3592- let htlc_txid = tx. txid ( ) ;
3592+ let htlc_txid = tx. compute_txid ( ) ;
35933593 let mut claimable_outpoints = vec ! [ ] ;
35943594 let mut outputs_to_watch = None ;
35953595 // Previously, we would only claim HTLCs from revoked HTLC transactions if they had 1 input
@@ -3681,7 +3681,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
36813681 /// Should not be used if check_spend_revoked_transaction succeeds.
36823682 /// Returns None unless the transaction is definitely one of our commitment transactions.
36833683 fn check_spend_holder_transaction < L : Deref > ( & mut self , tx : & Transaction , height : u32 , block_hash : & BlockHash , logger : & L ) -> Option < ( Vec < PackageTemplate > , TransactionOutputs ) > where L :: Target : Logger {
3684- let commitment_txid = tx. txid ( ) ;
3684+ let commitment_txid = tx. compute_txid ( ) ;
36853685 let mut claim_requests = Vec :: new ( ) ;
36863686 let mut watch_outputs = Vec :: new ( ) ;
36873687
@@ -3786,7 +3786,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
37863786 ) -> Vec < Transaction > where L :: Target : Logger {
37873787 log_debug ! ( logger, "Getting signed copy of latest holder commitment transaction!" ) ;
37883788 let commitment_tx = self . onchain_tx_handler . get_fully_signed_copy_holder_tx ( & self . funding_redeemscript ) ;
3789- let txid = commitment_tx. txid ( ) ;
3789+ let txid = commitment_tx. compute_txid ( ) ;
37903790 let mut holder_transactions = vec ! [ commitment_tx] ;
37913791 // When anchor outputs are present, the HTLC transactions are only final once the commitment
37923792 // transaction confirms due to the CSV 1 encumberance.
@@ -3885,7 +3885,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
38853885 let mut watch_outputs = Vec :: new ( ) ;
38863886 let mut claimable_outpoints = Vec :: new ( ) ;
38873887 ' tx_iter: for tx in & txn_matched {
3888- let txid = tx. txid ( ) ;
3888+ let txid = tx. compute_txid ( ) ;
38893889 log_trace ! ( logger, "Transaction {} confirmed in block {}" , txid , block_hash) ;
38903890 // If a transaction has already been confirmed, ensure we don't bother processing it duplicatively.
38913891 if Some ( txid) == self . funding_spend_confirmed {
@@ -4131,7 +4131,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
41314131 // make sure the registered scriptpubkey at the expected index match
41324132 // the actual transaction output one. We failed this case before #653.
41334133 for tx in & txn_matched {
4134- if let Some ( outputs) = self . get_outputs_to_watch ( ) . get ( & tx. txid ( ) ) {
4134+ if let Some ( outputs) = self . get_outputs_to_watch ( ) . get ( & tx. compute_txid ( ) ) {
41354135 for idx_and_script in outputs. iter ( ) {
41364136 assert ! ( ( idx_and_script. 0 as usize ) < tx. output. len( ) ) ;
41374137 assert_eq ! ( tx. output[ idx_and_script. 0 as usize ] . script_pubkey, idx_and_script. 1 ) ;
@@ -4206,7 +4206,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
42064206 }
42074207 }
42084208 if matches {
4209- matched_txn. insert ( tx. txid ( ) ) ;
4209+ matched_txn. insert ( tx. compute_txid ( ) ) ;
42104210 }
42114211 matches
42124212 } ) . map ( |( _, tx) | * tx) . collect ( )
@@ -4360,12 +4360,12 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
43604360 if ( $holder_tx && revocation_sig_claim) ||
43614361 ( outbound_htlc && !$source_avail && ( accepted_preimage_claim || offered_preimage_claim) ) {
43624362 log_error!( logger, "Input spending {} ({}:{}) in {} resolves {} HTLC with payment hash {} with {}!" ,
4363- $tx_info, input. previous_output. txid, input. previous_output. vout, tx. txid ( ) ,
4363+ $tx_info, input. previous_output. txid, input. previous_output. vout, tx. compute_txid ( ) ,
43644364 if outbound_htlc { "outbound" } else { "inbound" } , & $htlc. payment_hash,
43654365 if revocation_sig_claim { "revocation sig" } else { "preimage claim after we'd passed the HTLC resolution back. We can likely claim the HTLC output with a revocation claim" } ) ;
43664366 } else {
43674367 log_info!( logger, "Input spending {} ({}:{}) in {} resolves {} HTLC with payment hash {} with {}" ,
4368- $tx_info, input. previous_output. txid, input. previous_output. vout, tx. txid ( ) ,
4368+ $tx_info, input. previous_output. txid, input. previous_output. vout, tx. compute_txid ( ) ,
43694369 if outbound_htlc { "outbound" } else { "inbound" } , & $htlc. payment_hash,
43704370 if revocation_sig_claim { "revocation sig" } else if accepted_preimage_claim || offered_preimage_claim { "preimage" } else { "timeout" } ) ;
43714371 }
@@ -4412,7 +4412,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
44124412 log_claim!( $tx_info, $holder_tx, htlc_output, false ) ;
44134413 let outbound_htlc = $holder_tx == htlc_output. offered;
44144414 self . onchain_events_awaiting_threshold_conf. push( OnchainEventEntry {
4415- txid: tx. txid ( ) , height, block_hash: Some ( * block_hash) , transaction: Some ( tx. clone( ) ) ,
4415+ txid: tx. compute_txid ( ) , height, block_hash: Some ( * block_hash) , transaction: Some ( tx. clone( ) ) ,
44164416 event: OnchainEvent :: HTLCSpendConfirmation {
44174417 commitment_tx_output_idx: input. previous_output. vout,
44184418 preimage: if accepted_preimage_claim || offered_preimage_claim {
@@ -4454,7 +4454,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
44544454 if !self . pending_monitor_events . iter ( ) . any (
44554455 |update| if let & MonitorEvent :: HTLCEvent ( ref upd) = update { upd. source == source } else { false } ) {
44564456 self . onchain_events_awaiting_threshold_conf . push ( OnchainEventEntry {
4457- txid : tx. txid ( ) ,
4457+ txid : tx. compute_txid ( ) ,
44584458 height,
44594459 block_hash : Some ( * block_hash) ,
44604460 transaction : Some ( tx. clone ( ) ) ,
@@ -4477,7 +4477,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
44774477 upd. source == source
44784478 } else { false } ) {
44794479 self . onchain_events_awaiting_threshold_conf . push ( OnchainEventEntry {
4480- txid : tx. txid ( ) ,
4480+ txid : tx. compute_txid ( ) ,
44814481 transaction : Some ( tx. clone ( ) ) ,
44824482 height,
44834483 block_hash : Some ( * block_hash) ,
@@ -4505,7 +4505,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
45054505 }
45064506 } ) ;
45074507 let entry = OnchainEventEntry {
4508- txid : tx. txid ( ) ,
4508+ txid : tx. compute_txid ( ) ,
45094509 transaction : Some ( tx. clone ( ) ) ,
45104510 height,
45114511 block_hash : Some ( * block_hash) ,
@@ -4527,15 +4527,15 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
45274527 for ( i, outp) in tx. output . iter ( ) . enumerate ( ) {
45284528 if outp. script_pubkey == self . destination_script {
45294529 spendable_outputs. push ( SpendableOutputDescriptor :: StaticOutput {
4530- outpoint : OutPoint { txid : tx. txid ( ) , index : i as u16 } ,
4530+ outpoint : OutPoint { txid : tx. compute_txid ( ) , index : i as u16 } ,
45314531 output : outp. clone ( ) ,
45324532 channel_keys_id : Some ( self . channel_keys_id ) ,
45334533 } ) ;
45344534 }
45354535 if let Some ( ref broadcasted_holder_revokable_script) = self . broadcasted_holder_revokable_script {
45364536 if broadcasted_holder_revokable_script. 0 == outp. script_pubkey {
45374537 spendable_outputs. push ( SpendableOutputDescriptor :: DelayedPaymentOutput ( DelayedPaymentOutputDescriptor {
4538- outpoint : OutPoint { txid : tx. txid ( ) , index : i as u16 } ,
4538+ outpoint : OutPoint { txid : tx. compute_txid ( ) , index : i as u16 } ,
45394539 per_commitment_point : broadcasted_holder_revokable_script. 1 ,
45404540 to_self_delay : self . on_holder_tx_csv ,
45414541 output : outp. clone ( ) ,
@@ -4548,7 +4548,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
45484548 }
45494549 if self . counterparty_payment_script == outp. script_pubkey {
45504550 spendable_outputs. push ( SpendableOutputDescriptor :: StaticPaymentOutput ( StaticPaymentOutputDescriptor {
4551- outpoint : OutPoint { txid : tx. txid ( ) , index : i as u16 } ,
4551+ outpoint : OutPoint { txid : tx. compute_txid ( ) , index : i as u16 } ,
45524552 output : outp. clone ( ) ,
45534553 channel_keys_id : self . channel_keys_id ,
45544554 channel_value_satoshis : self . channel_value_satoshis ,
@@ -4557,7 +4557,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
45574557 }
45584558 if self . shutdown_script . as_ref ( ) == Some ( & outp. script_pubkey ) {
45594559 spendable_outputs. push ( SpendableOutputDescriptor :: StaticOutput {
4560- outpoint : OutPoint { txid : tx. txid ( ) , index : i as u16 } ,
4560+ outpoint : OutPoint { txid : tx. compute_txid ( ) , index : i as u16 } ,
45614561 output : outp. clone ( ) ,
45624562 channel_keys_id : Some ( self . channel_keys_id ) ,
45634563 } ) ;
@@ -4573,7 +4573,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
45734573 ) where L :: Target : Logger {
45744574 for spendable_output in self . get_spendable_outputs ( tx) {
45754575 let entry = OnchainEventEntry {
4576- txid : tx. txid ( ) ,
4576+ txid : tx. compute_txid ( ) ,
45774577 transaction : Some ( tx. clone ( ) ) ,
45784578 height,
45794579 block_hash : Some ( * block_hash) ,
@@ -5066,7 +5066,7 @@ mod tests {
50665066 assert ! ( txn_broadcasted. len( ) >= 2 ) ;
50675067 let htlc_txn = txn_broadcasted. iter ( ) . filter ( |tx| {
50685068 assert_eq ! ( tx. input. len( ) , 1 ) ;
5069- tx. input [ 0 ] . previous_output . txid == broadcast_tx. txid ( )
5069+ tx. input [ 0 ] . previous_output . txid == broadcast_tx. compute_txid ( )
50705070 } ) . collect :: < Vec < _ > > ( ) ;
50715071 assert_eq ! ( htlc_txn. len( ) , 2 ) ;
50725072 check_spends ! ( htlc_txn[ 0 ] , broadcast_tx) ;
0 commit comments