]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Merge pull request #3057 from G8XSU/2024-05-08-claimable-persist-3049
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Mon, 3 Jun 2024 16:24:57 +0000 (09:24 -0700)
committerGitHub <noreply@github.com>
Mon, 3 Jun 2024 16:24:57 +0000 (09:24 -0700)
Minimize reads to counterparty_claimable_outpoints

1  2 
lightning/src/chain/channelmonitor.rs

index 29f7130fbdeaca2e807e09cba9a8e86e9537f1db,7a6551babca943af7aeeb8dcd265cf860bdd0b38..f33abee53c2178450a99ebebb10f8b0a4d5aede1
@@@ -3280,11 -3279,11 +3280,11 @@@ impl<Signer: EcdsaChannelSigner> Channe
                        }
  
                        // Then, try to find revoked htlc outputs
-                       if let Some(ref per_commitment_data) = per_commitment_option {
-                               for (_, &(ref htlc, _)) in per_commitment_data.iter().enumerate() {
+                       if let Some(per_commitment_claimable_data) = per_commitment_option {
+                               for (htlc, _) in per_commitment_claimable_data {
                                        if let Some(transaction_output_index) = htlc.transaction_output_index {
                                                if transaction_output_index as usize >= tx.output.len() ||
 -                                                              tx.output[transaction_output_index as usize].value != htlc.amount_msat / 1000 {
 +                                                              tx.output[transaction_output_index as usize].value != htlc.to_bitcoin_amount() {
                                                        // per_commitment_data is corrupt or our commitment signing key leaked!
                                                        return (claimable_outpoints, (commitment_txid, watch_outputs),
                                                                to_counterparty_output_info);