@@ -3693,7 +3693,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3693
3693
}
3694
3694
bitcoin_tx.txid
3695
3695
};
3696
- let mut htlcs_cloned: Vec<_> = commitment_data.htlcs_included.iter().map(|htlc| (htlc.0.clone(), htlc.1.map(|h| h.clone()))).collect();
3697
3696
3698
3697
// If our counterparty updated the channel fee in this commitment transaction, check that
3699
3698
// they can actually afford the new fee now.
@@ -3731,8 +3730,8 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3731
3730
3732
3731
let holder_keys = commitment_data.tx.trust().keys();
3733
3732
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() {
3736
3735
if let Some(_) = htlc.transaction_output_index {
3737
3736
let htlc_tx = chan_utils::build_htlc_transaction(&commitment_txid, commitment_data.tx.feerate_per_kw(),
3738
3737
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 {
3749
3748
}
3750
3749
if htlc.offered {
3751
3750
if let Some(source) = source_opt.take() {
3752
- nondust_htlc_sources.push(source);
3751
+ nondust_htlc_sources.push(source.clone() );
3753
3752
} else {
3754
3753
panic!("Missing outbound HTLC source");
3755
3754
}
3756
3755
}
3757
3756
} else {
3758
- dust_htlcs.push((htlc, None, source_opt.take()));
3757
+ dust_htlcs.push((htlc, None, source_opt.take().cloned() ));
3759
3758
}
3760
3759
debug_assert!(source_opt.is_none(), "HTLCSource should have been put somewhere");
3761
3760
}
@@ -8890,11 +8889,11 @@ impl<SP: Deref> FundedChannel<SP> where
8890
8889
}
8891
8890
self.context.resend_order = RAACommitmentOrder::RevokeAndACKFirst;
8892
8891
8893
- let (mut htlcs_ref, counterparty_commitment_tx) =
8892
+ let (htlcs_ref, counterparty_commitment_tx) =
8894
8893
self.build_commitment_no_state_update(logger);
8895
8894
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();
8898
8897
8899
8898
if self.context.announcement_sigs_state == AnnouncementSigsState::MessageSent {
8900
8899
self.context.announcement_sigs_state = AnnouncementSigsState::Committed;
@@ -8907,7 +8906,7 @@ impl<SP: Deref> FundedChannel<SP> where
8907
8906
// and provide the full commit tx instead of the information needed to rebuild it.
8908
8907
updates: vec![ChannelMonitorUpdateStep::LatestCounterpartyCommitmentTXInfo {
8909
8908
commitment_txid: counterparty_commitment_txid,
8910
- htlc_outputs: htlcs.clone() ,
8909
+ htlc_outputs,
8911
8910
commitment_number: self.context.cur_counterparty_commitment_transaction_number,
8912
8911
their_per_commitment_point: self.context.counterparty_cur_commitment_point.unwrap(),
8913
8912
feerate_per_kw: Some(counterparty_commitment_tx.feerate_per_kw()),
0 commit comments