diff --git a/core/src/banking_stage/consumer.rs b/core/src/banking_stage/consumer.rs index 9482ed1266a1bb..5ef9fe39771d26 100644 --- a/core/src/banking_stage/consumer.rs +++ b/core/src/banking_stage/consumer.rs @@ -485,11 +485,12 @@ impl Consumer { .iter() .zip(transaction_qos_cost_results.iter_mut()) .map(|(lock_result, cost)| { - if let Err(_lock_err) = lock_result { - if let Ok(tx_cost) = cost { - // reset cost to lock_err, so it won't be accidentally removed more than once - // TODO *cost = Err(lock_err.clone()); - return Some(tx_cost); + if let Err(lock_err) = lock_result { + if cost.is_ok() { + // set cost to lock_err, so it won't be accidentally removed more than once + let mut c = Err(lock_err.clone()); + std::mem::swap(cost, &mut c); + return Some(c.unwrap()); } } None