@@ -3606,7 +3606,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3606
3606
}
3607
3607
bitcoin_tx.txid
3608
3608
};
3609
- let mut htlcs_cloned: Vec<_> = commitment_data.htlcs_included.iter().map(|htlc| (htlc.0.clone(), htlc.1.map(|h| h.clone()))).collect();
3610
3609
3611
3610
// If our counterparty updated the channel fee in this commitment transaction, check that
3612
3611
// they can actually afford the new fee now.
@@ -3644,8 +3643,8 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3644
3643
3645
3644
let holder_keys = commitment_data.tx.trust().keys();
3646
3645
let mut nondust_htlc_sources = Vec::with_capacity(commitment_data.tx.nondust_htlcs().len());
3647
- let mut dust_htlcs = Vec::with_capacity(htlcs_cloned .len() - commitment_data.tx.nondust_htlcs().len());
3648
- for (idx, (htlc, mut source_opt)) in htlcs_cloned.drain(.. ).enumerate() {
3646
+ let mut dust_htlcs = Vec::with_capacity(commitment_data.htlcs_included .len() - commitment_data.tx.nondust_htlcs().len());
3647
+ for (idx, (htlc, mut source_opt)) in commitment_data.htlcs_included.into_iter( ).enumerate() {
3649
3648
if let Some(_) = htlc.transaction_output_index {
3650
3649
let htlc_tx = chan_utils::build_htlc_transaction(&commitment_txid, commitment_data.tx.feerate_per_kw(),
3651
3650
funding.get_counterparty_selected_contest_delay().unwrap(), &htlc, &self.channel_type,
@@ -3662,13 +3661,13 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3662
3661
}
3663
3662
if htlc.offered {
3664
3663
if let Some(source) = source_opt.take() {
3665
- nondust_htlc_sources.push(source);
3664
+ nondust_htlc_sources.push(source.clone() );
3666
3665
} else {
3667
3666
panic!("Missing outbound HTLC source");
3668
3667
}
3669
3668
}
3670
3669
} else {
3671
- dust_htlcs.push((htlc, None, source_opt.take()));
3670
+ dust_htlcs.push((htlc, None, source_opt.take().cloned() ));
3672
3671
}
3673
3672
debug_assert!(source_opt.is_none(), "HTLCSource should have been put somewhere");
3674
3673
}
@@ -8794,11 +8793,11 @@ impl<SP: Deref> FundedChannel<SP> where
8794
8793
}
8795
8794
self.context.resend_order = RAACommitmentOrder::RevokeAndACKFirst;
8796
8795
8797
- let (mut htlcs_ref, counterparty_commitment_tx) =
8796
+ let (htlcs_ref, counterparty_commitment_tx) =
8798
8797
self.build_commitment_no_state_update(logger);
8799
8798
let counterparty_commitment_txid = counterparty_commitment_tx.trust().txid();
8800
- let htlcs : Vec<(HTLCOutputInCommitment, Option<Box<HTLCSource>>)> =
8801
- htlcs_ref.drain(.. ).map(|(htlc, htlc_source)| (htlc, htlc_source.map(|source_ref| Box::new(source_ref.clone())))).collect();
8799
+ let htlc_outputs : Vec<(HTLCOutputInCommitment, Option<Box<HTLCSource>>)> =
8800
+ htlcs_ref.into_iter( ).map(|(htlc, htlc_source)| (htlc, htlc_source.map(|source_ref| Box::new(source_ref.clone())))).collect();
8802
8801
8803
8802
if self.context.announcement_sigs_state == AnnouncementSigsState::MessageSent {
8804
8803
self.context.announcement_sigs_state = AnnouncementSigsState::Committed;
@@ -8811,7 +8810,7 @@ impl<SP: Deref> FundedChannel<SP> where
8811
8810
// and provide the full commit tx instead of the information needed to rebuild it.
8812
8811
updates: vec![ChannelMonitorUpdateStep::LatestCounterpartyCommitmentTXInfo {
8813
8812
commitment_txid: counterparty_commitment_txid,
8814
- htlc_outputs: htlcs.clone() ,
8813
+ htlc_outputs,
8815
8814
commitment_number: self.context.cur_counterparty_commitment_transaction_number,
8816
8815
their_per_commitment_point: self.context.counterparty_cur_commitment_point.unwrap(),
8817
8816
feerate_per_kw: Some(counterparty_commitment_tx.feerate_per_kw()),
0 commit comments