@@ -4733,7 +4733,6 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4733
4733
}
4734
4734
4735
4735
/// Returns the HTLC claim package templates and the counterparty output info
4736
- #[ rustfmt:: skip]
4737
4736
fn get_counterparty_output_claim_info (
4738
4737
& self , funding_spent : & FundingScope , commitment_number : u64 , commitment_txid : Txid ,
4739
4738
tx : Option < & Transaction > ,
@@ -4767,13 +4766,23 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4767
4766
4768
4767
if let Some ( transaction) = tx {
4769
4768
let revocation_pubkey = RevocationKey :: from_basepoint (
4770
- & self . onchain_tx_handler . secp_ctx , & self . holder_revocation_basepoint , & per_commitment_point) ;
4769
+ & self . onchain_tx_handler . secp_ctx ,
4770
+ & self . holder_revocation_basepoint ,
4771
+ & per_commitment_point,
4772
+ ) ;
4771
4773
4772
- let delayed_key = DelayedPaymentKey :: from_basepoint ( & self . onchain_tx_handler . secp_ctx , & self . counterparty_commitment_params . counterparty_delayed_payment_base_key , & per_commitment_point) ;
4774
+ let delayed_key = DelayedPaymentKey :: from_basepoint (
4775
+ & self . onchain_tx_handler . secp_ctx ,
4776
+ & self . counterparty_commitment_params . counterparty_delayed_payment_base_key ,
4777
+ & per_commitment_point,
4778
+ ) ;
4773
4779
4774
- let revokeable_p2wsh = chan_utils:: get_revokeable_redeemscript ( & revocation_pubkey,
4780
+ let revokeable_p2wsh = chan_utils:: get_revokeable_redeemscript (
4781
+ & revocation_pubkey,
4775
4782
self . counterparty_commitment_params . on_counterparty_tx_csv ,
4776
- & delayed_key) . to_p2wsh ( ) ;
4783
+ & delayed_key,
4784
+ )
4785
+ . to_p2wsh ( ) ;
4777
4786
for ( idx, outp) in transaction. output . iter ( ) . enumerate ( ) {
4778
4787
if outp. script_pubkey == revokeable_p2wsh {
4779
4788
to_counterparty_output_info =
@@ -4782,25 +4791,36 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4782
4791
}
4783
4792
}
4784
4793
4785
- for & ( ref htlc, _) in per_commitment_claimable_data. iter ( ) {
4794
+ for & ( ref htlc, _) in per_commitment_claimable_data. iter ( ) {
4786
4795
if let Some ( transaction_output_index) = htlc. transaction_output_index {
4787
4796
if let Some ( transaction) = tx {
4788
- if transaction_output_index as usize >= transaction. output . len ( ) ||
4789
- transaction. output [ transaction_output_index as usize ] . value != htlc. to_bitcoin_amount ( ) {
4790
- // per_commitment_data is corrupt or our commitment signing key leaked!
4791
- return ( claimable_outpoints, to_counterparty_output_info) ;
4792
- }
4797
+ if transaction_output_index as usize >= transaction. output . len ( )
4798
+ || transaction. output [ transaction_output_index as usize ] . value
4799
+ != htlc. to_bitcoin_amount ( )
4800
+ {
4801
+ // per_commitment_data is corrupt or our commitment signing key leaked!
4802
+ return ( claimable_outpoints, to_counterparty_output_info) ;
4803
+ }
4793
4804
}
4794
- let preimage = if htlc. offered { if let Some ( ( p, _) ) = self . payment_preimages . get ( & htlc. payment_hash ) { Some ( * p) } else { None } } else { None } ;
4805
+ let preimage = if htlc. offered {
4806
+ if let Some ( ( p, _) ) = self . payment_preimages . get ( & htlc. payment_hash ) {
4807
+ Some ( * p)
4808
+ } else {
4809
+ None
4810
+ }
4811
+ } else {
4812
+ None
4813
+ } ;
4795
4814
if preimage. is_some ( ) || !htlc. offered {
4796
4815
let counterparty_htlc_outp = if htlc. offered {
4797
4816
PackageSolvingData :: CounterpartyOfferedHTLCOutput (
4798
4817
CounterpartyOfferedHTLCOutput :: build (
4799
- * per_commitment_point, preimage. unwrap ( ) ,
4818
+ * per_commitment_point,
4819
+ preimage. unwrap ( ) ,
4800
4820
htlc. clone ( ) ,
4801
4821
funding_spent. channel_parameters . clone ( ) ,
4802
4822
confirmation_height,
4803
- )
4823
+ ) ,
4804
4824
)
4805
4825
} else {
4806
4826
PackageSolvingData :: CounterpartyReceivedHTLCOutput (
@@ -4809,10 +4829,15 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4809
4829
htlc. clone ( ) ,
4810
4830
funding_spent. channel_parameters . clone ( ) ,
4811
4831
confirmation_height,
4812
- )
4832
+ ) ,
4813
4833
)
4814
4834
} ;
4815
- let counterparty_package = PackageTemplate :: build_package ( commitment_txid, transaction_output_index, counterparty_htlc_outp, htlc. cltv_expiry ) ;
4835
+ let counterparty_package = PackageTemplate :: build_package (
4836
+ commitment_txid,
4837
+ transaction_output_index,
4838
+ counterparty_htlc_outp,
4839
+ htlc. cltv_expiry ,
4840
+ ) ;
4816
4841
claimable_outpoints. push ( counterparty_package) ;
4817
4842
}
4818
4843
}
0 commit comments