From da9898273284223929293024f4af13d9f21474e6 Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Sat, 23 Feb 2019 07:36:23 -0700 Subject: [PATCH] Deprecate tmp_copy_ledger This should allow us to get rid of all the manual routing of ticks_per_slot in the test suite. --- src/blocktree.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/blocktree.rs b/src/blocktree.rs index a1bcbe77d..7954bfddc 100644 --- a/src/blocktree.rs +++ b/src/blocktree.rs @@ -1329,21 +1329,27 @@ pub fn create_tmp_sample_blocktree( ) } -pub fn tmp_copy_ledger(from: &str, name: &str, ticks_per_slot: u64) -> String { +pub fn tmp_copy_blocktree(from: &str, name: &str) -> String { let path = get_tmp_ledger_path(name); - let blocktree = Blocktree::open_config(from, ticks_per_slot).unwrap(); + let blocktree = Blocktree::open(from).unwrap(); let blobs = blocktree.read_ledger_blobs(); let genesis_block = GenesisBlock::load(from).unwrap(); Blocktree::destroy(&path).expect("Expected successful database destruction"); - let blocktree = Blocktree::open_config(&path, ticks_per_slot).unwrap(); + let blocktree = Blocktree::open(&path).unwrap(); blocktree.write_blobs(blobs).unwrap(); genesis_block.write(&path).unwrap(); path } +// Deprecated! Please use tmp_copy_blocktree() instead. +pub fn tmp_copy_ledger(from: &str, name: &str, _ticks_per_slot: u64) -> String { + // Ignore 'ticks_per_slot' because it's now encoded in the genesis block. + tmp_copy_blocktree(from, name) +} + #[cfg(test)] pub mod tests { use super::*;