Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Reduce 2 iterators to one #25973

Merged
merged 1 commit into from
Jun 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,16 @@ fn execute_batches(
cost_capacity_meter: Arc<RwLock<BlockCostCapacityMeter>>,
cost_model: &CostModel,
) -> Result<()> {
let lock_results = batches
let (lock_results, sanitized_txs): (Vec<_>, Vec<_>) = batches
.iter()
.flat_map(|batch| batch.lock_results().clone())
.collect::<Vec<_>>();
let sanitized_txs = batches
.iter()
.flat_map(|batch| batch.sanitized_transactions().to_vec())
.collect::<Vec<_>>();
.flat_map(|batch| {
batch
.lock_results()
.iter()
.cloned()
.zip(batch.sanitized_transactions().to_vec())
})
.unzip();

let mut minimal_tx_cost = u64::MAX;
let mut total_cost: u64 = 0;
Expand Down