@@ -3018,7 +3018,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3018
3018
let commitment_package = PackageTemplate :: build_package (
3019
3019
self . funding_info . 0 . txid . clone ( ) , self . funding_info . 0 . index as u32 ,
3020
3020
PackageSolvingData :: HolderFundingOutput ( funding_outp) ,
3021
- self . best_block . height , self . best_block . height
3021
+ self . best_block . height ,
3022
3022
) ;
3023
3023
let mut claimable_outpoints = vec ! [ commitment_package] ;
3024
3024
let event = MonitorEvent :: HolderForceClosedWithInfo {
@@ -3041,7 +3041,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3041
3041
// assuming it gets confirmed in the next block. Sadly, we have code which considers
3042
3042
// "not yet confirmed" things as discardable, so we cannot do that here.
3043
3043
let ( mut new_outpoints, _) = self . get_broadcasted_holder_claims (
3044
- & self . current_holder_commitment_tx , self . best_block . height
3044
+ & self . current_holder_commitment_tx , self . best_block . height ,
3045
3045
) ;
3046
3046
let unsigned_commitment_tx = self . onchain_tx_handler . get_unsigned_holder_commitment_tx ( ) ;
3047
3047
let new_outputs = self . get_broadcasted_holder_watch_outputs (
@@ -3459,7 +3459,11 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3459
3459
for ( idx, outp) in tx. output . iter ( ) . enumerate ( ) {
3460
3460
if outp. script_pubkey == revokeable_p2wsh {
3461
3461
let revk_outp = RevokedOutput :: build ( per_commitment_point, self . counterparty_commitment_params . counterparty_delayed_payment_base_key , self . counterparty_commitment_params . counterparty_htlc_base_key , per_commitment_key, outp. value , self . counterparty_commitment_params . on_counterparty_tx_csv , self . onchain_tx_handler . channel_type_features ( ) . supports_anchors_zero_fee_htlc_tx ( ) ) ;
3462
- let justice_package = PackageTemplate :: build_package ( commitment_txid, idx as u32 , PackageSolvingData :: RevokedOutput ( revk_outp) , height + self . counterparty_commitment_params . on_counterparty_tx_csv as u32 , height) ;
3462
+ let justice_package = PackageTemplate :: build_package (
3463
+ commitment_txid, idx as u32 ,
3464
+ PackageSolvingData :: RevokedOutput ( revk_outp) ,
3465
+ height + self . counterparty_commitment_params . on_counterparty_tx_csv as u32 ,
3466
+ ) ;
3463
3467
claimable_outpoints. push ( justice_package) ;
3464
3468
to_counterparty_output_info =
3465
3469
Some ( ( idx. try_into ( ) . expect ( "Txn can't have more than 2^32 outputs" ) , outp. value ) ) ;
@@ -3476,7 +3480,12 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3476
3480
return ( claimable_outpoints, to_counterparty_output_info) ;
3477
3481
}
3478
3482
let revk_htlc_outp = RevokedHTLCOutput :: build ( per_commitment_point, self . counterparty_commitment_params . counterparty_delayed_payment_base_key , self . counterparty_commitment_params . counterparty_htlc_base_key , per_commitment_key, htlc. amount_msat / 1000 , htlc. clone ( ) , & self . onchain_tx_handler . channel_transaction_parameters . channel_type_features ) ;
3479
- let justice_package = PackageTemplate :: build_package ( commitment_txid, transaction_output_index, PackageSolvingData :: RevokedHTLCOutput ( revk_htlc_outp) , htlc. cltv_expiry , height) ;
3483
+ let justice_package = PackageTemplate :: build_package (
3484
+ commitment_txid,
3485
+ transaction_output_index,
3486
+ PackageSolvingData :: RevokedHTLCOutput ( revk_htlc_outp) ,
3487
+ htlc. cltv_expiry ,
3488
+ ) ;
3480
3489
claimable_outpoints. push ( justice_package) ;
3481
3490
}
3482
3491
}
@@ -3598,7 +3607,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3598
3607
self . counterparty_commitment_params . counterparty_htlc_base_key ,
3599
3608
htlc. clone ( ) , self . onchain_tx_handler . channel_type_features ( ) . clone ( ) ) )
3600
3609
} ;
3601
- let counterparty_package = PackageTemplate :: build_package ( commitment_txid, transaction_output_index, counterparty_htlc_outp, htlc. cltv_expiry , 0 ) ;
3610
+ let counterparty_package = PackageTemplate :: build_package ( commitment_txid, transaction_output_index, counterparty_htlc_outp, htlc. cltv_expiry ) ;
3602
3611
claimable_outpoints. push ( counterparty_package) ;
3603
3612
}
3604
3613
}
@@ -3642,7 +3651,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3642
3651
) ;
3643
3652
let justice_package = PackageTemplate :: build_package (
3644
3653
htlc_txid, idx as u32 , PackageSolvingData :: RevokedOutput ( revk_outp) ,
3645
- height + self . counterparty_commitment_params . on_counterparty_tx_csv as u32 , height
3654
+ height + self . counterparty_commitment_params . on_counterparty_tx_csv as u32 ,
3646
3655
) ;
3647
3656
claimable_outpoints. push ( justice_package) ;
3648
3657
if outputs_to_watch. is_none ( ) {
@@ -3665,11 +3674,11 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3665
3674
3666
3675
for & ( ref htlc, _, _) in holder_tx. htlc_outputs . iter ( ) {
3667
3676
if let Some ( transaction_output_index) = htlc. transaction_output_index {
3668
- let htlc_output = if htlc. offered {
3677
+ let ( htlc_output, counterparty_spendable_height ) = if htlc. offered {
3669
3678
let htlc_output = HolderHTLCOutput :: build_offered (
3670
3679
htlc. amount_msat , htlc. cltv_expiry , self . onchain_tx_handler . channel_type_features ( ) . clone ( )
3671
3680
) ;
3672
- htlc_output
3681
+ ( htlc_output, conf_height )
3673
3682
} else {
3674
3683
let payment_preimage = if let Some ( preimage) = self . payment_preimages . get ( & htlc. payment_hash ) {
3675
3684
preimage. clone ( )
@@ -3680,12 +3689,12 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3680
3689
let htlc_output = HolderHTLCOutput :: build_accepted (
3681
3690
payment_preimage, htlc. amount_msat , self . onchain_tx_handler . channel_type_features ( ) . clone ( )
3682
3691
) ;
3683
- htlc_output
3692
+ ( htlc_output, htlc . cltv_expiry )
3684
3693
} ;
3685
3694
let htlc_package = PackageTemplate :: build_package (
3686
3695
holder_tx. txid , transaction_output_index,
3687
3696
PackageSolvingData :: HolderHTLCOutput ( htlc_output) ,
3688
- htlc . cltv_expiry , conf_height
3697
+ counterparty_spendable_height ,
3689
3698
) ;
3690
3699
claim_requests. push ( htlc_package) ;
3691
3700
}
0 commit comments