From 7c3941c568c55448cb0032e5609bad1d040da818 Mon Sep 17 00:00:00 2001 From: Tao Zhu Date: Wed, 24 Jan 2024 05:33:45 +0000 Subject: [PATCH] set entry in transaction_qos_cost_results to Err() if its tx failed to get lock --- core/src/banking_stage/consumer.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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