@@ -2143,7 +2143,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
2143
2143
} = & event. event {
2144
2144
if event. transaction . as_ref ( ) . map ( |tx| tx. input . iter ( ) . any ( |inp| {
2145
2145
if let Some ( htlc_spend_txid) = htlc_spend_txid_opt {
2146
- tx. txid ( ) == * htlc_spend_txid || inp. previous_output . txid == * htlc_spend_txid
2146
+ tx. compute_txid ( ) == * htlc_spend_txid || inp. previous_output . txid == * htlc_spend_txid
2147
2147
} else {
2148
2148
Some ( inp. previous_output . txid ) == confirmed_txid &&
2149
2149
inp. previous_output . vout == htlc_commitment_tx_output_idx
@@ -2592,7 +2592,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
2592
2592
macro_rules! fail_unbroadcast_htlcs {
2593
2593
( $self: expr, $commitment_tx_type: expr, $commitment_txid_confirmed: expr, $commitment_tx_confirmed: expr,
2594
2594
$commitment_tx_conf_height: expr, $commitment_tx_conf_hash: expr, $confirmed_htlcs_list: expr, $logger: expr) => { {
2595
- debug_assert_eq!( $commitment_tx_confirmed. txid ( ) , $commitment_txid_confirmed) ;
2595
+ debug_assert_eq!( $commitment_tx_confirmed. compute_txid ( ) , $commitment_txid_confirmed) ;
2596
2596
2597
2597
macro_rules! check_htlc_fails {
2598
2598
( $txid: expr, $commitment_tx: expr, $per_commitment_outpoints: expr) => {
@@ -3225,7 +3225,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3225
3225
// introduced with v0.0.116. counterparty_node_id is guaranteed to be `Some`
3226
3226
// since v0.0.110.
3227
3227
let counterparty_node_id = self . counterparty_node_id . unwrap ( ) ;
3228
- let commitment_txid = commitment_tx. txid ( ) ;
3228
+ let commitment_txid = commitment_tx. compute_txid ( ) ;
3229
3229
debug_assert_eq ! ( self . current_holder_commitment_tx. txid, commitment_txid) ;
3230
3230
let pending_htlcs = self . current_holder_commitment_tx . non_dust_htlcs ( ) ;
3231
3231
let commitment_tx_fee_satoshis = self . channel_value_satoshis -
@@ -3405,7 +3405,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3405
3405
let mut claimable_outpoints = Vec :: new ( ) ;
3406
3406
let mut to_counterparty_output_info = None ;
3407
3407
3408
- let commitment_txid = tx. txid ( ) ; //TODO: This is gonna be a performance bottleneck for watchtowers!
3408
+ let commitment_txid = tx. compute_txid ( ) ; //TODO: This is gonna be a performance bottleneck for watchtowers!
3409
3409
let per_commitment_option = self . counterparty_claimable_outpoints . get ( & commitment_txid) ;
3410
3410
3411
3411
macro_rules! ignore_error {
@@ -3591,7 +3591,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3591
3591
} ;
3592
3592
let per_commitment_point = PublicKey :: from_secret_key ( & self . onchain_tx_handler . secp_ctx , & per_commitment_key) ;
3593
3593
3594
- let htlc_txid = tx. txid ( ) ;
3594
+ let htlc_txid = tx. compute_txid ( ) ;
3595
3595
let mut claimable_outpoints = vec ! [ ] ;
3596
3596
let mut outputs_to_watch = None ;
3597
3597
// Previously, we would only claim HTLCs from revoked HTLC transactions if they had 1 input
@@ -3683,7 +3683,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3683
3683
/// Should not be used if check_spend_revoked_transaction succeeds.
3684
3684
/// Returns None unless the transaction is definitely one of our commitment transactions.
3685
3685
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 {
3686
- let commitment_txid = tx. txid ( ) ;
3686
+ let commitment_txid = tx. compute_txid ( ) ;
3687
3687
let mut claim_requests = Vec :: new ( ) ;
3688
3688
let mut watch_outputs = Vec :: new ( ) ;
3689
3689
@@ -3788,7 +3788,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3788
3788
) -> Vec < Transaction > where L :: Target : Logger {
3789
3789
log_debug ! ( logger, "Getting signed copy of latest holder commitment transaction!" ) ;
3790
3790
let commitment_tx = self . onchain_tx_handler . get_fully_signed_copy_holder_tx ( & self . funding_redeemscript ) ;
3791
- let txid = commitment_tx. txid ( ) ;
3791
+ let txid = commitment_tx. compute_txid ( ) ;
3792
3792
let mut holder_transactions = vec ! [ commitment_tx] ;
3793
3793
// When anchor outputs are present, the HTLC transactions are only final once the commitment
3794
3794
// transaction confirms due to the CSV 1 encumberance.
@@ -3887,7 +3887,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3887
3887
let mut watch_outputs = Vec :: new ( ) ;
3888
3888
let mut claimable_outpoints = Vec :: new ( ) ;
3889
3889
' tx_iter: for tx in & txn_matched {
3890
- let txid = tx. txid ( ) ;
3890
+ let txid = tx. compute_txid ( ) ;
3891
3891
log_trace ! ( logger, "Transaction {} confirmed in block {}" , txid , block_hash) ;
3892
3892
// If a transaction has already been confirmed, ensure we don't bother processing it duplicatively.
3893
3893
if Some ( txid) == self . funding_spend_confirmed {
@@ -4133,7 +4133,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4133
4133
// make sure the registered scriptpubkey at the expected index match
4134
4134
// the actual transaction output one. We failed this case before #653.
4135
4135
for tx in & txn_matched {
4136
- if let Some ( outputs) = self . get_outputs_to_watch ( ) . get ( & tx. txid ( ) ) {
4136
+ if let Some ( outputs) = self . get_outputs_to_watch ( ) . get ( & tx. compute_txid ( ) ) {
4137
4137
for idx_and_script in outputs. iter ( ) {
4138
4138
assert ! ( ( idx_and_script. 0 as usize ) < tx. output. len( ) ) ;
4139
4139
assert_eq ! ( tx. output[ idx_and_script. 0 as usize ] . script_pubkey, idx_and_script. 1 ) ;
@@ -4208,7 +4208,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4208
4208
}
4209
4209
}
4210
4210
if matches {
4211
- matched_txn. insert ( tx. txid ( ) ) ;
4211
+ matched_txn. insert ( tx. compute_txid ( ) ) ;
4212
4212
}
4213
4213
matches
4214
4214
} ) . map ( |( _, tx) | * tx) . collect ( )
@@ -4362,12 +4362,12 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4362
4362
if ( $holder_tx && revocation_sig_claim) ||
4363
4363
( outbound_htlc && !$source_avail && ( accepted_preimage_claim || offered_preimage_claim) ) {
4364
4364
log_error!( logger, "Input spending {} ({}:{}) in {} resolves {} HTLC with payment hash {} with {}!" ,
4365
- $tx_info, input. previous_output. txid, input. previous_output. vout, tx. txid ( ) ,
4365
+ $tx_info, input. previous_output. txid, input. previous_output. vout, tx. compute_txid ( ) ,
4366
4366
if outbound_htlc { "outbound" } else { "inbound" } , & $htlc. payment_hash,
4367
4367
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" } ) ;
4368
4368
} else {
4369
4369
log_info!( logger, "Input spending {} ({}:{}) in {} resolves {} HTLC with payment hash {} with {}" ,
4370
- $tx_info, input. previous_output. txid, input. previous_output. vout, tx. txid ( ) ,
4370
+ $tx_info, input. previous_output. txid, input. previous_output. vout, tx. compute_txid ( ) ,
4371
4371
if outbound_htlc { "outbound" } else { "inbound" } , & $htlc. payment_hash,
4372
4372
if revocation_sig_claim { "revocation sig" } else if accepted_preimage_claim || offered_preimage_claim { "preimage" } else { "timeout" } ) ;
4373
4373
}
@@ -4414,7 +4414,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4414
4414
log_claim!( $tx_info, $holder_tx, htlc_output, false ) ;
4415
4415
let outbound_htlc = $holder_tx == htlc_output. offered;
4416
4416
self . onchain_events_awaiting_threshold_conf. push( OnchainEventEntry {
4417
- txid: tx. txid ( ) , height, block_hash: Some ( * block_hash) , transaction: Some ( tx. clone( ) ) ,
4417
+ txid: tx. compute_txid ( ) , height, block_hash: Some ( * block_hash) , transaction: Some ( tx. clone( ) ) ,
4418
4418
event: OnchainEvent :: HTLCSpendConfirmation {
4419
4419
commitment_tx_output_idx: input. previous_output. vout,
4420
4420
preimage: if accepted_preimage_claim || offered_preimage_claim {
@@ -4456,7 +4456,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4456
4456
if !self . pending_monitor_events . iter ( ) . any (
4457
4457
|update| if let & MonitorEvent :: HTLCEvent ( ref upd) = update { upd. source == source } else { false } ) {
4458
4458
self . onchain_events_awaiting_threshold_conf . push ( OnchainEventEntry {
4459
- txid : tx. txid ( ) ,
4459
+ txid : tx. compute_txid ( ) ,
4460
4460
height,
4461
4461
block_hash : Some ( * block_hash) ,
4462
4462
transaction : Some ( tx. clone ( ) ) ,
@@ -4479,7 +4479,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4479
4479
upd. source == source
4480
4480
} else { false } ) {
4481
4481
self . onchain_events_awaiting_threshold_conf . push ( OnchainEventEntry {
4482
- txid : tx. txid ( ) ,
4482
+ txid : tx. compute_txid ( ) ,
4483
4483
transaction : Some ( tx. clone ( ) ) ,
4484
4484
height,
4485
4485
block_hash : Some ( * block_hash) ,
@@ -4507,7 +4507,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4507
4507
}
4508
4508
} ) ;
4509
4509
let entry = OnchainEventEntry {
4510
- txid : tx. txid ( ) ,
4510
+ txid : tx. compute_txid ( ) ,
4511
4511
transaction : Some ( tx. clone ( ) ) ,
4512
4512
height,
4513
4513
block_hash : Some ( * block_hash) ,
@@ -4529,15 +4529,15 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4529
4529
for ( i, outp) in tx. output . iter ( ) . enumerate ( ) {
4530
4530
if outp. script_pubkey == self . destination_script {
4531
4531
spendable_outputs. push ( SpendableOutputDescriptor :: StaticOutput {
4532
- outpoint : OutPoint { txid : tx. txid ( ) , index : i as u16 } ,
4532
+ outpoint : OutPoint { txid : tx. compute_txid ( ) , index : i as u16 } ,
4533
4533
output : outp. clone ( ) ,
4534
4534
channel_keys_id : Some ( self . channel_keys_id ) ,
4535
4535
} ) ;
4536
4536
}
4537
4537
if let Some ( ref broadcasted_holder_revokable_script) = self . broadcasted_holder_revokable_script {
4538
4538
if broadcasted_holder_revokable_script. 0 == outp. script_pubkey {
4539
4539
spendable_outputs. push ( SpendableOutputDescriptor :: DelayedPaymentOutput ( DelayedPaymentOutputDescriptor {
4540
- outpoint : OutPoint { txid : tx. txid ( ) , index : i as u16 } ,
4540
+ outpoint : OutPoint { txid : tx. compute_txid ( ) , index : i as u16 } ,
4541
4541
per_commitment_point : broadcasted_holder_revokable_script. 1 ,
4542
4542
to_self_delay : self . on_holder_tx_csv ,
4543
4543
output : outp. clone ( ) ,
@@ -4550,7 +4550,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4550
4550
}
4551
4551
if self . counterparty_payment_script == outp. script_pubkey {
4552
4552
spendable_outputs. push ( SpendableOutputDescriptor :: StaticPaymentOutput ( StaticPaymentOutputDescriptor {
4553
- outpoint : OutPoint { txid : tx. txid ( ) , index : i as u16 } ,
4553
+ outpoint : OutPoint { txid : tx. compute_txid ( ) , index : i as u16 } ,
4554
4554
output : outp. clone ( ) ,
4555
4555
channel_keys_id : self . channel_keys_id ,
4556
4556
channel_value_satoshis : self . channel_value_satoshis ,
@@ -4559,7 +4559,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4559
4559
}
4560
4560
if self . shutdown_script . as_ref ( ) == Some ( & outp. script_pubkey ) {
4561
4561
spendable_outputs. push ( SpendableOutputDescriptor :: StaticOutput {
4562
- outpoint : OutPoint { txid : tx. txid ( ) , index : i as u16 } ,
4562
+ outpoint : OutPoint { txid : tx. compute_txid ( ) , index : i as u16 } ,
4563
4563
output : outp. clone ( ) ,
4564
4564
channel_keys_id : Some ( self . channel_keys_id ) ,
4565
4565
} ) ;
@@ -4575,7 +4575,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4575
4575
) where L :: Target : Logger {
4576
4576
for spendable_output in self . get_spendable_outputs ( tx) {
4577
4577
let entry = OnchainEventEntry {
4578
- txid : tx. txid ( ) ,
4578
+ txid : tx. compute_txid ( ) ,
4579
4579
transaction : Some ( tx. clone ( ) ) ,
4580
4580
height,
4581
4581
block_hash : Some ( * block_hash) ,
@@ -5068,7 +5068,7 @@ mod tests {
5068
5068
assert ! ( txn_broadcasted. len( ) >= 2 ) ;
5069
5069
let htlc_txn = txn_broadcasted. iter ( ) . filter ( |tx| {
5070
5070
assert_eq ! ( tx. input. len( ) , 1 ) ;
5071
- tx. input [ 0 ] . previous_output . txid == broadcast_tx. txid ( )
5071
+ tx. input [ 0 ] . previous_output . txid == broadcast_tx. compute_txid ( )
5072
5072
} ) . collect :: < Vec < _ > > ( ) ;
5073
5073
assert_eq ! ( htlc_txn. len( ) , 2 ) ;
5074
5074
check_spends ! ( htlc_txn[ 0 ] , broadcast_tx) ;
0 commit comments