remove syscall tick height (#4891)

This commit is contained in:
carllin
2019-07-01 16:21:51 -07:00
committed by GitHub
parent cbd2938035
commit 0c8f187993
4 changed files with 2 additions and 81 deletions

View File

@ -36,7 +36,6 @@ use solana_sdk::signature::{Keypair, Signature};
use solana_sdk::syscall::{
current, fees, rewards,
slot_hashes::{self, SlotHashes},
tick_height,
};
use solana_sdk::system_transaction;
use solana_sdk::timing::{duration_as_ns, MAX_RECENT_BLOCKHASHES};
@ -434,13 +433,6 @@ impl Bank {
self.store_account(&fees::id(), &fees::create_account(1, &self.fee_calculator));
}
fn update_tick_height(&self) {
self.store_account(
&tick_height::id(),
&tick_height::create_account(1, self.tick_height()),
);
}
// update reward for previous epoch
fn update_rewards(&mut self, epoch: u64) {
if epoch == self.epoch() {
@ -732,8 +724,6 @@ impl Bank {
};
inc_new_counter_debug!("bank-register_tick-registered", 1);
self.update_tick_height();
// Register a new block hash if at the last tick in the slot
if current_tick_height % self.ticks_per_slot == self.ticks_per_slot - 1 {
self.blockhash_queue
@ -1444,7 +1434,7 @@ mod tests {
use solana_sdk::instruction::InstructionError;
use solana_sdk::poh_config::PohConfig;
use solana_sdk::signature::{Keypair, KeypairUtil};
use solana_sdk::syscall::{fees::Fees, rewards::Rewards, tick_height::TickHeight};
use solana_sdk::syscall::{fees::Fees, rewards::Rewards};
use solana_sdk::system_instruction;
use solana_sdk::system_transaction;
use solana_sdk::timing::DEFAULT_TICKS_PER_SLOT;
@ -2640,21 +2630,6 @@ mod tests {
assert_eq!(fees.fee_calculator.lamports_per_signature, 12345);
}
#[test]
fn test_bank_tick_height_account() {
let (genesis_block, _) = create_genesis_block(1);
let bank = Bank::new(&genesis_block);
for i in 0..10 {
bank.register_tick(&hash::hash(format!("hashing {}", i).as_bytes()));
}
let tick_account = bank.get_account(&tick_height::id()).unwrap();
let tick_height = TickHeight::from(&tick_account).unwrap().0;
assert_eq!(bank.tick_height(), tick_height);
assert_eq!(tick_height, 10);
}
#[test]
fn test_is_delta_with_no_committables() {
let (genesis_block, mint_keypair) = create_genesis_block(8000);