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