@@ -3762,7 +3762,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
37623762 }
37633763 bitcoin_tx.txid
37643764 };
3765- let htlcs_cloned: Vec<_> = commitment_data.htlcs_included.iter().map(|htlc| (htlc.0.clone(), htlc.1.map(|h| h.clone()))).collect();
37663765
37673766 // If our counterparty updated the channel fee in this commitment transaction, check that
37683767 // they can actually afford the new fee now.
@@ -3800,8 +3799,8 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
38003799
38013800 let holder_keys = commitment_data.tx.trust().keys();
38023801 let mut nondust_htlc_sources = Vec::with_capacity(commitment_data.tx.nondust_htlcs().len());
3803- let mut dust_htlcs = Vec::with_capacity(htlcs_cloned .len() - commitment_data.tx.nondust_htlcs().len());
3804- for (idx, (htlc, mut source_opt)) in htlcs_cloned .into_iter().enumerate() {
3802+ let mut dust_htlcs = Vec::with_capacity(commitment_data.htlcs_included .len() - commitment_data.tx.nondust_htlcs().len());
3803+ for (idx, (htlc, mut source_opt)) in commitment_data.htlcs_included .into_iter().enumerate() {
38053804 if let Some(_) = htlc.transaction_output_index {
38063805 let htlc_tx = chan_utils::build_htlc_transaction(&commitment_txid, commitment_data.tx.feerate_per_kw(),
38073806 funding.get_counterparty_selected_contest_delay().unwrap(), &htlc, funding.get_channel_type(),
@@ -3818,13 +3817,13 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
38183817 }
38193818 if htlc.offered {
38203819 if let Some(source) = source_opt.take() {
3821- nondust_htlc_sources.push(source);
3820+ nondust_htlc_sources.push(source.clone() );
38223821 } else {
38233822 panic!("Missing outbound HTLC source");
38243823 }
38253824 }
38263825 } else {
3827- dust_htlcs.push((htlc, None, source_opt.take()));
3826+ dust_htlcs.push((htlc, None, source_opt.take().cloned() ));
38283827 }
38293828 debug_assert!(source_opt.is_none(), "HTLCSource should have been put somewhere");
38303829 }
@@ -9030,10 +9029,10 @@ impl<SP: Deref> FundedChannel<SP> where
90309029
90319030 let mut updates = Vec::with_capacity(self.pending_funding.len() + 1);
90329031 for funding in core::iter::once(&self.funding).chain(self.pending_funding.iter()) {
9033- let (mut htlcs_ref, counterparty_commitment_tx) =
9032+ let (htlcs_ref, counterparty_commitment_tx) =
90349033 self.build_commitment_no_state_update(funding, logger);
90359034 let htlc_outputs: Vec<(HTLCOutputInCommitment, Option<Box<HTLCSource>>)> =
9036- htlcs_ref.drain(.. ).map(|(htlc, htlc_source)| (htlc, htlc_source.map(|source_ref| Box::new(source_ref.clone())))).collect();
9035+ htlcs_ref.into_iter( ).map(|(htlc, htlc_source)| (htlc, htlc_source.map(|source_ref| Box::new(source_ref.clone())))).collect();
90379036
90389037 if self.pending_funding.is_empty() {
90399038 // Soon, we will switch this to `LatestCounterpartyCommitmentTX`,
0 commit comments