Count compute units even when transaction errors (#22059)

This commit is contained in:
carllin
2021-12-28 17:05:11 -05:00
committed by GitHub
parent f061059e45
commit eaa8c67bde
13 changed files with 295 additions and 97 deletions

View File

@@ -1,12 +1,12 @@
use {
crate::bank::Bank,
crate::{bank::Bank, cost_model::ExecutionCost},
solana_sdk::transaction::{Result, SanitizedTransaction},
std::borrow::Cow,
};
// Represents the results of trying to lock a set of accounts
pub struct TransactionBatch<'a, 'b> {
lock_results: Vec<Result<()>>,
lock_results: Vec<Result<ExecutionCost>>,
bank: &'a Bank,
sanitized_txs: Cow<'b, [SanitizedTransaction]>,
pub(crate) needs_unlock: bool,
@@ -14,7 +14,7 @@ pub struct TransactionBatch<'a, 'b> {
impl<'a, 'b> TransactionBatch<'a, 'b> {
pub fn new(
lock_results: Vec<Result<()>>,
lock_results: Vec<Result<ExecutionCost>>,
bank: &'a Bank,
sanitized_txs: Cow<'b, [SanitizedTransaction]>,
) -> Self {
@@ -27,7 +27,7 @@ impl<'a, 'b> TransactionBatch<'a, 'b> {
}
}
pub fn lock_results(&self) -> &Vec<Result<()>> {
pub fn lock_results(&self) -> &Vec<Result<ExecutionCost>> {
&self.lock_results
}