Remove some copying (#19691)
This commit is contained in:
parent
007fb3abe5
commit
3a8c678f62
|
@ -1016,16 +1016,12 @@ impl BankingStage {
|
||||||
valid_txs: &[TransactionCheckResult],
|
valid_txs: &[TransactionCheckResult],
|
||||||
transaction_indexes: &[usize],
|
transaction_indexes: &[usize],
|
||||||
) -> Vec<usize> {
|
) -> Vec<usize> {
|
||||||
let valid_transactions = valid_txs
|
valid_txs
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter_map(|(index, (x, _h))| if x.is_ok() { Some(index) } else { None })
|
.filter_map(|(index, (x, _h))| if x.is_ok() { Some(index) } else { None })
|
||||||
.collect_vec();
|
.map(|x| transaction_indexes[x])
|
||||||
|
.collect_vec()
|
||||||
valid_transactions
|
|
||||||
.iter()
|
|
||||||
.map(|x| transaction_indexes[*x])
|
|
||||||
.collect()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Read the transaction message from packet data
|
/// Read the transaction message from packet data
|
||||||
|
|
|
@ -2894,7 +2894,7 @@ impl Bank {
|
||||||
fn check_age<'a>(
|
fn check_age<'a>(
|
||||||
&self,
|
&self,
|
||||||
txs: impl Iterator<Item = &'a SanitizedTransaction>,
|
txs: impl Iterator<Item = &'a SanitizedTransaction>,
|
||||||
lock_results: Vec<Result<()>>,
|
lock_results: &[Result<()>],
|
||||||
max_age: usize,
|
max_age: usize,
|
||||||
error_counters: &mut ErrorCounters,
|
error_counters: &mut ErrorCounters,
|
||||||
) -> Vec<TransactionCheckResult> {
|
) -> Vec<TransactionCheckResult> {
|
||||||
|
@ -2916,7 +2916,7 @@ impl Bank {
|
||||||
(Err(TransactionError::BlockhashNotFound), None)
|
(Err(TransactionError::BlockhashNotFound), None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => (Err(e), None),
|
Err(e) => (Err(e.clone()), None),
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
@ -3018,7 +3018,7 @@ impl Bank {
|
||||||
) -> Vec<TransactionCheckResult> {
|
) -> Vec<TransactionCheckResult> {
|
||||||
let age_results = self.check_age(
|
let age_results = self.check_age(
|
||||||
sanitized_txs.iter(),
|
sanitized_txs.iter(),
|
||||||
lock_results.to_vec(),
|
lock_results,
|
||||||
max_age,
|
max_age,
|
||||||
&mut error_counters,
|
&mut error_counters,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue