Deprecate tmp_copy_ledger

This should allow us to get rid of all the manual routing of
ticks_per_slot in the test suite.
This commit is contained in:
Greg Fitzgerald 2019-02-23 07:36:23 -07:00
parent cc10e84ab7
commit da98982732
1 changed files with 9 additions and 3 deletions

View File

@ -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::*;