@@ -3762,7 +3762,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3762
3762
}
3763
3763
bitcoin_tx.txid
3764
3764
};
3765
- let htlcs_cloned: Vec<_> = commitment_data.htlcs_included.iter().map(|htlc| (htlc.0.clone(), htlc.1.map(|h| h.clone()))).collect();
3766
3765
3767
3766
// If our counterparty updated the channel fee in this commitment transaction, check that
3768
3767
// they can actually afford the new fee now.
@@ -3800,8 +3799,8 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3800
3799
3801
3800
let holder_keys = commitment_data.tx.trust().keys();
3802
3801
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() {
3805
3804
if let Some(_) = htlc.transaction_output_index {
3806
3805
let htlc_tx = chan_utils::build_htlc_transaction(&commitment_txid, commitment_data.tx.feerate_per_kw(),
3807
3806
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 {
3818
3817
}
3819
3818
if htlc.offered {
3820
3819
if let Some(source) = source_opt.take() {
3821
- nondust_htlc_sources.push(source);
3820
+ nondust_htlc_sources.push(source.clone() );
3822
3821
} else {
3823
3822
panic!("Missing outbound HTLC source");
3824
3823
}
3825
3824
}
3826
3825
} else {
3827
- dust_htlcs.push((htlc, None, source_opt.take()));
3826
+ dust_htlcs.push((htlc, None, source_opt.take().cloned() ));
3828
3827
}
3829
3828
debug_assert!(source_opt.is_none(), "HTLCSource should have been put somewhere");
3830
3829
}
@@ -9033,10 +9032,10 @@ impl<SP: Deref> FundedChannel<SP> where
9033
9032
9034
9033
let mut updates = Vec::with_capacity(self.pending_funding.len() + 1);
9035
9034
for funding in core::iter::once(&self.funding).chain(self.pending_funding.iter()) {
9036
- let (mut htlcs_ref, counterparty_commitment_tx) =
9035
+ let (htlcs_ref, counterparty_commitment_tx) =
9037
9036
self.build_commitment_no_state_update(funding, logger);
9038
9037
let htlc_outputs: Vec<(HTLCOutputInCommitment, Option<Box<HTLCSource>>)> =
9039
- htlcs_ref.drain(.. ).map(|(htlc, htlc_source)| (htlc, htlc_source.map(|source_ref| Box::new(source_ref.clone())))).collect();
9038
+ htlcs_ref.into_iter( ).map(|(htlc, htlc_source)| (htlc, htlc_source.map(|source_ref| Box::new(source_ref.clone())))).collect();
9040
9039
9041
9040
if self.pending_funding.is_empty() {
9042
9041
// Soon, we will switch this to `LatestCounterpartyCommitmentTX`,
0 commit comments