@@ -3693,7 +3693,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
36933693 }
36943694 bitcoin_tx.txid
36953695 };
3696- let mut htlcs_cloned: Vec<_> = commitment_data.htlcs_included.iter().map(|htlc| (htlc.0.clone(), htlc.1.map(|h| h.clone()))).collect();
36973696
36983697 // If our counterparty updated the channel fee in this commitment transaction, check that
36993698 // they can actually afford the new fee now.
@@ -3731,8 +3730,8 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
37313730
37323731 let holder_keys = commitment_data.tx.trust().keys();
37333732 let mut nondust_htlc_sources = Vec::with_capacity(commitment_data.tx.nondust_htlcs().len());
3734- let mut dust_htlcs = Vec::with_capacity(htlcs_cloned .len() - commitment_data.tx.nondust_htlcs().len());
3735- for (idx, (htlc, mut source_opt)) in htlcs_cloned.drain(.. ).enumerate() {
3733+ let mut dust_htlcs = Vec::with_capacity(commitment_data.htlcs_included .len() - commitment_data.tx.nondust_htlcs().len());
3734+ for (idx, (htlc, mut source_opt)) in commitment_data.htlcs_included.into_iter( ).enumerate() {
37363735 if let Some(_) = htlc.transaction_output_index {
37373736 let htlc_tx = chan_utils::build_htlc_transaction(&commitment_txid, commitment_data.tx.feerate_per_kw(),
37383737 funding.get_counterparty_selected_contest_delay().unwrap(), &htlc, funding.get_channel_type(),
@@ -3749,13 +3748,13 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
37493748 }
37503749 if htlc.offered {
37513750 if let Some(source) = source_opt.take() {
3752- nondust_htlc_sources.push(source);
3751+ nondust_htlc_sources.push(source.clone() );
37533752 } else {
37543753 panic!("Missing outbound HTLC source");
37553754 }
37563755 }
37573756 } else {
3758- dust_htlcs.push((htlc, None, source_opt.take()));
3757+ dust_htlcs.push((htlc, None, source_opt.take().cloned() ));
37593758 }
37603759 debug_assert!(source_opt.is_none(), "HTLCSource should have been put somewhere");
37613760 }
@@ -8890,11 +8889,11 @@ impl<SP: Deref> FundedChannel<SP> where
88908889 }
88918890 self.context.resend_order = RAACommitmentOrder::RevokeAndACKFirst;
88928891
8893- let (mut htlcs_ref, counterparty_commitment_tx) =
8892+ let (htlcs_ref, counterparty_commitment_tx) =
88948893 self.build_commitment_no_state_update(logger);
88958894 let counterparty_commitment_txid = counterparty_commitment_tx.trust().txid();
8896- let htlcs : Vec<(HTLCOutputInCommitment, Option<Box<HTLCSource>>)> =
8897- htlcs_ref.drain(.. ).map(|(htlc, htlc_source)| (htlc, htlc_source.map(|source_ref| Box::new(source_ref.clone())))).collect();
8895+ let htlc_outputs : Vec<(HTLCOutputInCommitment, Option<Box<HTLCSource>>)> =
8896+ htlcs_ref.into_iter( ).map(|(htlc, htlc_source)| (htlc, htlc_source.map(|source_ref| Box::new(source_ref.clone())))).collect();
88988897
88998898 if self.context.announcement_sigs_state == AnnouncementSigsState::MessageSent {
89008899 self.context.announcement_sigs_state = AnnouncementSigsState::Committed;
@@ -8907,7 +8906,7 @@ impl<SP: Deref> FundedChannel<SP> where
89078906 // and provide the full commit tx instead of the information needed to rebuild it.
89088907 updates: vec![ChannelMonitorUpdateStep::LatestCounterpartyCommitmentTXInfo {
89098908 commitment_txid: counterparty_commitment_txid,
8910- htlc_outputs: htlcs.clone() ,
8909+ htlc_outputs,
89118910 commitment_number: self.context.cur_counterparty_commitment_transaction_number,
89128911 their_per_commitment_point: self.context.counterparty_cur_commitment_point.unwrap(),
89138912 feerate_per_kw: Some(counterparty_commitment_tx.feerate_per_kw()),
0 commit comments