From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:24:57 +0000 (-0700) Subject: Merge pull request #3057 from G8XSU/2024-05-08-claimable-persist-3049 X-Git-Tag: v0.0.124-beta~105 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=73263348ba55c976fa8e17b8c3cf71bc6f117568;p=rust-lightning Merge pull request #3057 from G8XSU/2024-05-08-claimable-persist-3049 Minimize reads to counterparty_claimable_outpoints --- 73263348ba55c976fa8e17b8c3cf71bc6f117568 diff --cc lightning/src/chain/channelmonitor.rs index 29f7130fb,7a6551bab..f33abee53 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@@ -3280,11 -3279,11 +3280,11 @@@ impl 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);