@@ -2141,7 +2141,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
2141
2141
} = & event. event {
2142
2142
if event. transaction . as_ref ( ) . map ( |tx| tx. input . iter ( ) . any ( |inp| {
2143
2143
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
2145
2145
} else {
2146
2146
Some ( inp. previous_output . txid ) == confirmed_txid &&
2147
2147
inp. previous_output . vout == htlc_commitment_tx_output_idx
@@ -2590,7 +2590,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
2590
2590
macro_rules! fail_unbroadcast_htlcs {
2591
2591
( $self: expr, $commitment_tx_type: expr, $commitment_txid_confirmed: expr, $commitment_tx_confirmed: expr,
2592
2592
$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) ;
2594
2594
2595
2595
macro_rules! check_htlc_fails {
2596
2596
( $txid: expr, $commitment_tx: expr, $per_commitment_outpoints: expr) => {
@@ -3223,7 +3223,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3223
3223
// introduced with v0.0.116. counterparty_node_id is guaranteed to be `Some`
3224
3224
// since v0.0.110.
3225
3225
let counterparty_node_id = self . counterparty_node_id . unwrap ( ) ;
3226
- let commitment_txid = commitment_tx. txid ( ) ;
3226
+ let commitment_txid = commitment_tx. compute_txid ( ) ;
3227
3227
debug_assert_eq ! ( self . current_holder_commitment_tx. txid, commitment_txid) ;
3228
3228
let pending_htlcs = self . current_holder_commitment_tx . non_dust_htlcs ( ) ;
3229
3229
let commitment_tx_fee_satoshis = self . channel_value_satoshis -
@@ -3403,7 +3403,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3403
3403
let mut claimable_outpoints = Vec :: new ( ) ;
3404
3404
let mut to_counterparty_output_info = None ;
3405
3405
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!
3407
3407
let per_commitment_option = self . counterparty_claimable_outpoints . get ( & commitment_txid) ;
3408
3408
3409
3409
macro_rules! ignore_error {
@@ -3589,7 +3589,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3589
3589
} ;
3590
3590
let per_commitment_point = PublicKey :: from_secret_key ( & self . onchain_tx_handler . secp_ctx , & per_commitment_key) ;
3591
3591
3592
- let htlc_txid = tx. txid ( ) ;
3592
+ let htlc_txid = tx. compute_txid ( ) ;
3593
3593
let mut claimable_outpoints = vec ! [ ] ;
3594
3594
let mut outputs_to_watch = None ;
3595
3595
// Previously, we would only claim HTLCs from revoked HTLC transactions if they had 1 input
@@ -3681,7 +3681,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3681
3681
/// Should not be used if check_spend_revoked_transaction succeeds.
3682
3682
/// Returns None unless the transaction is definitely one of our commitment transactions.
3683
3683
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 ( ) ;
3685
3685
let mut claim_requests = Vec :: new ( ) ;
3686
3686
let mut watch_outputs = Vec :: new ( ) ;
3687
3687
@@ -3786,7 +3786,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3786
3786
) -> Vec < Transaction > where L :: Target : Logger {
3787
3787
log_debug ! ( logger, "Getting signed copy of latest holder commitment transaction!" ) ;
3788
3788
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 ( ) ;
3790
3790
let mut holder_transactions = vec ! [ commitment_tx] ;
3791
3791
// When anchor outputs are present, the HTLC transactions are only final once the commitment
3792
3792
// transaction confirms due to the CSV 1 encumberance.
@@ -3885,7 +3885,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3885
3885
let mut watch_outputs = Vec :: new ( ) ;
3886
3886
let mut claimable_outpoints = Vec :: new ( ) ;
3887
3887
' tx_iter: for tx in & txn_matched {
3888
- let txid = tx. txid ( ) ;
3888
+ let txid = tx. compute_txid ( ) ;
3889
3889
log_trace ! ( logger, "Transaction {} confirmed in block {}" , txid , block_hash) ;
3890
3890
// If a transaction has already been confirmed, ensure we don't bother processing it duplicatively.
3891
3891
if Some ( txid) == self . funding_spend_confirmed {
@@ -4131,7 +4131,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4131
4131
// make sure the registered scriptpubkey at the expected index match
4132
4132
// the actual transaction output one. We failed this case before #653.
4133
4133
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 ( ) ) {
4135
4135
for idx_and_script in outputs. iter ( ) {
4136
4136
assert ! ( ( idx_and_script. 0 as usize ) < tx. output. len( ) ) ;
4137
4137
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> {
4206
4206
}
4207
4207
}
4208
4208
if matches {
4209
- matched_txn. insert ( tx. txid ( ) ) ;
4209
+ matched_txn. insert ( tx. compute_txid ( ) ) ;
4210
4210
}
4211
4211
matches
4212
4212
} ) . map ( |( _, tx) | * tx) . collect ( )
@@ -4360,12 +4360,12 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4360
4360
if ( $holder_tx && revocation_sig_claim) ||
4361
4361
( outbound_htlc && !$source_avail && ( accepted_preimage_claim || offered_preimage_claim) ) {
4362
4362
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 ( ) ,
4364
4364
if outbound_htlc { "outbound" } else { "inbound" } , & $htlc. payment_hash,
4365
4365
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" } ) ;
4366
4366
} else {
4367
4367
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 ( ) ,
4369
4369
if outbound_htlc { "outbound" } else { "inbound" } , & $htlc. payment_hash,
4370
4370
if revocation_sig_claim { "revocation sig" } else if accepted_preimage_claim || offered_preimage_claim { "preimage" } else { "timeout" } ) ;
4371
4371
}
@@ -4412,7 +4412,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4412
4412
log_claim!( $tx_info, $holder_tx, htlc_output, false ) ;
4413
4413
let outbound_htlc = $holder_tx == htlc_output. offered;
4414
4414
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( ) ) ,
4416
4416
event: OnchainEvent :: HTLCSpendConfirmation {
4417
4417
commitment_tx_output_idx: input. previous_output. vout,
4418
4418
preimage: if accepted_preimage_claim || offered_preimage_claim {
@@ -4454,7 +4454,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4454
4454
if !self . pending_monitor_events . iter ( ) . any (
4455
4455
|update| if let & MonitorEvent :: HTLCEvent ( ref upd) = update { upd. source == source } else { false } ) {
4456
4456
self . onchain_events_awaiting_threshold_conf . push ( OnchainEventEntry {
4457
- txid : tx. txid ( ) ,
4457
+ txid : tx. compute_txid ( ) ,
4458
4458
height,
4459
4459
block_hash : Some ( * block_hash) ,
4460
4460
transaction : Some ( tx. clone ( ) ) ,
@@ -4477,7 +4477,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4477
4477
upd. source == source
4478
4478
} else { false } ) {
4479
4479
self . onchain_events_awaiting_threshold_conf . push ( OnchainEventEntry {
4480
- txid : tx. txid ( ) ,
4480
+ txid : tx. compute_txid ( ) ,
4481
4481
transaction : Some ( tx. clone ( ) ) ,
4482
4482
height,
4483
4483
block_hash : Some ( * block_hash) ,
@@ -4505,7 +4505,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4505
4505
}
4506
4506
} ) ;
4507
4507
let entry = OnchainEventEntry {
4508
- txid : tx. txid ( ) ,
4508
+ txid : tx. compute_txid ( ) ,
4509
4509
transaction : Some ( tx. clone ( ) ) ,
4510
4510
height,
4511
4511
block_hash : Some ( * block_hash) ,
@@ -4527,15 +4527,15 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4527
4527
for ( i, outp) in tx. output . iter ( ) . enumerate ( ) {
4528
4528
if outp. script_pubkey == self . destination_script {
4529
4529
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 } ,
4531
4531
output : outp. clone ( ) ,
4532
4532
channel_keys_id : Some ( self . channel_keys_id ) ,
4533
4533
} ) ;
4534
4534
}
4535
4535
if let Some ( ref broadcasted_holder_revokable_script) = self . broadcasted_holder_revokable_script {
4536
4536
if broadcasted_holder_revokable_script. 0 == outp. script_pubkey {
4537
4537
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 } ,
4539
4539
per_commitment_point : broadcasted_holder_revokable_script. 1 ,
4540
4540
to_self_delay : self . on_holder_tx_csv ,
4541
4541
output : outp. clone ( ) ,
@@ -4548,7 +4548,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4548
4548
}
4549
4549
if self . counterparty_payment_script == outp. script_pubkey {
4550
4550
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 } ,
4552
4552
output : outp. clone ( ) ,
4553
4553
channel_keys_id : self . channel_keys_id ,
4554
4554
channel_value_satoshis : self . channel_value_satoshis ,
@@ -4557,7 +4557,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4557
4557
}
4558
4558
if self . shutdown_script . as_ref ( ) == Some ( & outp. script_pubkey ) {
4559
4559
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 } ,
4561
4561
output : outp. clone ( ) ,
4562
4562
channel_keys_id : Some ( self . channel_keys_id ) ,
4563
4563
} ) ;
@@ -4573,7 +4573,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4573
4573
) where L :: Target : Logger {
4574
4574
for spendable_output in self . get_spendable_outputs ( tx) {
4575
4575
let entry = OnchainEventEntry {
4576
- txid : tx. txid ( ) ,
4576
+ txid : tx. compute_txid ( ) ,
4577
4577
transaction : Some ( tx. clone ( ) ) ,
4578
4578
height,
4579
4579
block_hash : Some ( * block_hash) ,
@@ -5066,7 +5066,7 @@ mod tests {
5066
5066
assert ! ( txn_broadcasted. len( ) >= 2 ) ;
5067
5067
let htlc_txn = txn_broadcasted. iter ( ) . filter ( |tx| {
5068
5068
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 ( )
5070
5070
} ) . collect :: < Vec < _ > > ( ) ;
5071
5071
assert_eq ! ( htlc_txn. len( ) , 2 ) ;
5072
5072
check_spends ! ( htlc_txn[ 0 ] , broadcast_tx) ;
0 commit comments