Retype num_ticks as u64 to reduce casting

This commit is contained in:
Michael Vines
2019-01-28 10:29:42 -08:00
parent 33f921235d
commit e4f477cf90
4 changed files with 6 additions and 9 deletions

View File

@ -376,10 +376,7 @@ mod test {
max_tick_height,
);
let ticks = create_ticks(
(max_tick_height - start_tick_height) as usize,
Hash::default(),
);
let ticks = create_ticks(max_tick_height - start_tick_height, Hash::default());
for (i, mut tick) in ticks.into_iter().enumerate() {
// Simulate the tick heights generated in poh.rs
tick.tick_height = start_tick_height + i as u64 + 1;

View File

@ -895,7 +895,7 @@ pub fn create_tmp_genesis(
pub fn create_tmp_sample_ledger(
name: &str,
num_tokens: u64,
num_ending_ticks: usize,
num_ending_ticks: u64,
bootstrap_leader_id: Pubkey,
bootstrap_leader_tokens: u64,
) -> (GenesisBlock, Keypair, String, Vec<Entry>) {

View File

@ -386,9 +386,9 @@ pub fn next_entries(
next_entries_mut(&mut id, &mut num_hashes, transactions)
}
pub fn create_ticks(num_ticks: usize, mut hash: Hash) -> Vec<Entry> {
pub fn create_ticks(num_ticks: u64, mut hash: Hash) -> Vec<Entry> {
let mut ticks = Vec::with_capacity(num_ticks as usize);
for _ in 0..num_ticks as u64 {
for _ in 0..num_ticks {
let new_tick = Entry::new(&hash, 0, 1, vec![]);
hash = new_tick.id;
ticks.push(new_tick);
@ -453,7 +453,7 @@ pub fn make_consecutive_blobs(
start_hash: Hash,
addr: &std::net::SocketAddr,
) -> Vec<SharedBlob> {
let entries = create_ticks(num_blobs_to_make as usize, start_hash);
let entries = create_ticks(num_blobs_to_make, start_hash);
let blobs = entries.to_shared_blobs();
let mut index = start_height;

View File

@ -485,7 +485,7 @@ pub fn make_active_set_entries(
token_source: &Keypair,
last_entry_id: &Hash,
last_tick_id: &Hash,
num_ending_ticks: usize,
num_ending_ticks: u64,
) -> (Vec<Entry>, VoteSignerProxy) {
// 1) Create transfer token entry
let transfer_tx =