Split SDK's timing.rs (#5823)

This commit is contained in:
Jack May
2019-09-06 14:30:56 -07:00
committed by GitHub
parent cc8575dd96
commit e8d88f3237
44 changed files with 169 additions and 163 deletions

View File

@ -1,7 +1,7 @@
use bincode::{deserialize_from, serialize_into, serialized_size};
use memmap::MmapMut;
use serde::{Deserialize, Serialize};
use solana_sdk::{account::Account, pubkey::Pubkey, timing::Epoch};
use solana_sdk::{account::Account, clock::Epoch, pubkey::Pubkey};
use std::fmt;
use std::fs::{create_dir_all, remove_file, OpenOptions};
use std::io;

View File

@ -33,6 +33,7 @@ use solana_metrics::{
};
use solana_sdk::{
account::Account,
clock::{get_segment_from_slot, Epoch, Slot, MAX_RECENT_BLOCKHASHES},
fee_calculator::FeeCalculator,
genesis_block::GenesisBlock,
hash::{hashv, Hash},
@ -46,7 +47,7 @@ use solana_sdk::{
slot_hashes::{self, SlotHashes},
stake_history,
},
timing::{duration_as_ns, get_segment_from_slot, Epoch, Slot, MAX_RECENT_BLOCKHASHES},
timing::duration_as_ns,
transaction::{Result, Transaction, TransactionError},
};
use std::collections::{HashMap, HashSet};
@ -1533,6 +1534,7 @@ mod tests {
create_genesis_block_with_leader, GenesisBlockInfo, BOOTSTRAP_LEADER_LAMPORTS,
};
use bincode::{deserialize_from, serialize_into, serialized_size};
use solana_sdk::clock::DEFAULT_TICKS_PER_SLOT;
use solana_sdk::genesis_block::create_genesis_block;
use solana_sdk::hash;
use solana_sdk::instruction::InstructionError;
@ -1541,7 +1543,6 @@ mod tests {
use solana_sdk::system_instruction;
use solana_sdk::system_transaction;
use solana_sdk::sysvar::{fees::Fees, rewards::Rewards};
use solana_sdk::timing::DEFAULT_TICKS_PER_SLOT;
use solana_stake_api::stake_state::Stake;
use solana_vote_api::vote_instruction;
use solana_vote_api::vote_state::{VoteState, MAX_LOCKOUT_HISTORY};

View File

@ -1,6 +1,6 @@
//! calculate and collect rent from Accounts
use crate::epoch_schedule::EpochSchedule;
use solana_sdk::{account::Account, rent::Rent, timing::Epoch};
use solana_sdk::{account::Account, clock::Epoch, rent::Rent};
#[derive(Default, Serialize, Deserialize, Clone)]
pub struct RentCollector {

View File

@ -1,9 +1,9 @@
//! Stakes serve as a cache of stake and vote accounts to derive
//! node stakes
use solana_sdk::account::Account;
use solana_sdk::clock::Epoch;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::sysvar::stake_history::StakeHistory;
use solana_sdk::timing::Epoch;
use solana_stake_api::stake_state::{new_stake_history_entry, StakeState};
use solana_vote_api::vote_state::VoteState;
use std::collections::HashMap;

View File

@ -1,13 +1,13 @@
use log::*;
use rand::{thread_rng, Rng};
use serde::Serialize;
use solana_sdk::clock::{Slot, MAX_HASH_AGE_IN_SECONDS};
use solana_sdk::hash::Hash;
use solana_sdk::signature::Signature;
use solana_sdk::timing::Slot;
use std::collections::{HashMap, HashSet};
use std::sync::{Arc, Mutex};
pub const MAX_CACHE_ENTRIES: usize = solana_sdk::timing::MAX_HASH_AGE_IN_SECONDS;
pub const MAX_CACHE_ENTRIES: usize = MAX_HASH_AGE_IN_SECONDS;
const CACHED_SIGNATURE_SIZE: usize = 20;
// Store forks in a single chunk of memory to avoid another lookup.