- Only commit successfully executed transactions' cost to cost_tracker;

- In-fly transactions are pended in cost_tracker until being committed
  or cancelled;
This commit is contained in:
Tao Zhu
2022-04-07 15:42:39 -05:00
committed by Tao Zhu
parent 2e5042d8bd
commit 9e07272af8
6 changed files with 249 additions and 125 deletions

View File

@@ -1069,14 +1069,14 @@ impl Accounts {
pub fn lock_accounts_with_results<'a>(
&self,
txs: impl Iterator<Item = &'a SanitizedTransaction>,
results: impl Iterator<Item = Result<()>>,
results: impl Iterator<Item = &'a Result<()>>,
feature_set: &FeatureSet,
) -> Vec<Result<()>> {
let tx_account_locks_results: Vec<Result<_>> = txs
.zip(results)
.map(|(tx, result)| match result {
Ok(()) => tx.get_account_locks(feature_set),
Err(err) => Err(err),
Err(err) => Err(err.clone()),
})
.collect();
self.lock_accounts_inner(tx_account_locks_results)
@@ -2831,7 +2831,7 @@ mod tests {
let results = accounts.lock_accounts_with_results(
txs.iter(),
qos_results.into_iter(),
qos_results.iter(),
&FeatureSet::all_enabled(),
);