Not exposing inner cost_table to encapsulating implementation details,

making future change easier.
This commit is contained in:
Tao Zhu
2022-03-14 13:41:46 -05:00
committed by Tao Zhu
parent 00ddf6576c
commit 56428be629
3 changed files with 14 additions and 35 deletions

View File

@@ -11,7 +11,6 @@ use {
instruction::CompiledInstruction, program_utils::limited_deserialize, pubkey::Pubkey,
system_instruction::SystemInstruction, system_program, transaction::SanitizedTransaction,
},
std::collections::HashMap,
};
const MAX_WRITABLE_ACCOUNTS: usize = 256;
@@ -81,10 +80,6 @@ impl CostModel {
.for_each(|(program_id, cost)| {
self.upsert_instruction_cost(program_id, *cost);
});
debug!(
"restored cost model instruction cost table from blockstore, current values: {:?}",
self.get_instruction_cost_table()
);
}
pub fn calculate_cost(&self, transaction: &SanitizedTransaction) -> TransactionCost {
@@ -105,10 +100,6 @@ impl CostModel {
.upsert(program_key, cost);
}
pub fn get_instruction_cost_table(&self) -> &HashMap<Pubkey, u64> {
self.instruction_execution_cost_table.get_cost_table()
}
pub fn find_instruction_cost(&self, program_key: &Pubkey) -> u64 {
match self.instruction_execution_cost_table.get_cost(program_key) {
Some(cost) => *cost,

View File

@@ -39,10 +39,6 @@ impl ExecuteCostTable {
}
}
pub fn get_cost_table(&self) -> &HashMap<Pubkey, u64> {
&self.table
}
pub fn get_count(&self) -> usize {
self.table.len()
}