diff --git a/runtime/benches/bank.rs b/runtime/benches/bank.rs index 6c7f09d54..32f71cc1e 100644 --- a/runtime/benches/bank.rs +++ b/runtime/benches/bank.rs @@ -3,11 +3,11 @@ extern crate test; use solana_runtime::bank::*; -use solana_runtime::last_id_queue::MAX_ENTRY_IDS; use solana_sdk::genesis_block::GenesisBlock; use solana_sdk::hash::hash; use solana_sdk::signature::{Keypair, KeypairUtil}; use solana_sdk::system_transaction::SystemTransaction; +use solana_sdk::timing::MAX_ENTRY_IDS; use test::Bencher; #[bench] diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 9eff384a1..b80b4a0f0 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -4,7 +4,7 @@ //! already been signed and verified. use crate::accounts::{Accounts, ErrorCounters, InstructionAccounts, InstructionLoaders}; -use crate::last_id_queue::HashQueue; +use crate::hash_queue::HashQueue; use crate::runtime::{self, RuntimeError}; use crate::status_cache::StatusCache; use bincode::serialize; @@ -86,7 +86,7 @@ pub struct Bank { status_cache: RwLock, /// FIFO queue of `last_id` items - last_id_queue: RwLock, + tick_hash_queue: RwLock, /// Previous checkpoint of this bank parent: RwLock>>, @@ -131,7 +131,7 @@ impl Bank { parent.freeze(); let mut bank = Self::default(); - bank.last_id_queue = RwLock::new(parent.last_id_queue.read().unwrap().clone()); + bank.tick_hash_queue = RwLock::new(parent.tick_hash_queue.read().unwrap().clone()); bank.ticks_per_slot = parent.ticks_per_slot; bank.slots_per_epoch = parent.slots_per_epoch; bank.stakers_slot_offset = parent.stakers_slot_offset; @@ -240,7 +240,7 @@ impl Bank { &bootstrap_leader_vote_account, ); - self.last_id_queue + self.tick_hash_queue .write() .unwrap() .genesis_last_id(&genesis_block.last_id()); @@ -266,7 +266,7 @@ impl Bank { /// Return the last entry ID registered. pub fn last_id(&self) -> Hash { - self.last_id_queue.read().unwrap().last_id() + self.tick_hash_queue.read().unwrap().last_id() } /// Forget all signatures. Useful for benchmarking. @@ -297,7 +297,7 @@ impl Bank { ticks_and_stakes: &mut [(u64, u64)], supermajority_stake: u64, ) -> Option { - let last_ids = self.last_id_queue.read().unwrap(); + let last_ids = self.tick_hash_queue.read().unwrap(); last_ids.get_confirmation_timestamp(ticks_and_stakes, supermajority_stake) } @@ -313,10 +313,10 @@ impl Bank { // assert!(!self.is_frozen()); let current_tick_height = { //atomic register and read the tick - let mut last_id_queue = self.last_id_queue.write().unwrap(); + let mut tick_hash_queue = self.tick_hash_queue.write().unwrap(); inc_new_counter_info!("bank-register_tick-registered", 1); - last_id_queue.register_tick(last_id); - last_id_queue.tick_height() + tick_hash_queue.register_tick(last_id); + tick_hash_queue.tick_height() }; if current_tick_height % NUM_TICKS_PER_SECOND as u64 == 0 { self.status_cache.write().unwrap().new_cache(last_id); @@ -364,7 +364,7 @@ impl Bank { max_age: usize, error_counters: &mut ErrorCounters, ) -> Vec> { - let last_ids = self.last_id_queue.read().unwrap(); + let last_ids = self.tick_hash_queue.read().unwrap(); txs.iter() .zip(lock_results.into_iter()) .map(|(tx, lock_res)| { @@ -697,7 +697,7 @@ impl Bank { /// Return the number of ticks since genesis. pub fn tick_height(&self) -> u64 { - self.last_id_queue.read().unwrap().tick_height() + self.tick_hash_queue.read().unwrap().tick_height() } /// Return the number of ticks since the last slot boundary. @@ -745,7 +745,7 @@ impl Bank { #[cfg(test)] pub fn last_ids(&self) -> &RwLock { - &self.last_id_queue + &self.tick_hash_queue } } diff --git a/runtime/src/last_id_queue.rs b/runtime/src/hash_queue.rs similarity index 100% rename from runtime/src/last_id_queue.rs rename to runtime/src/hash_queue.rs diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index dbe11aef7..3b2e561cc 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -2,7 +2,7 @@ mod accounts; pub mod appendvec; pub mod bank; pub mod bloom; -mod last_id_queue; +mod hash_queue; mod runtime; mod status_cache;