Rebase and panic with no accounts

Add Accounts::has_accounts function for hash_internal_state calculation.
This commit is contained in:
Stephen Akridge
2019-02-20 12:17:32 -08:00
committed by sakridge
parent c276375a0e
commit 180d297df8
5 changed files with 47 additions and 23 deletions

View File

@@ -107,13 +107,14 @@ pub struct BankForksInfo {
pub fn process_blocktree(
genesis_block: &GenesisBlock,
blocktree: &Blocktree,
account_paths: &str,
) -> Result<(BankForks, Vec<BankForksInfo>)> {
let now = Instant::now();
info!("processing ledger...");
// Setup bank for slot 0
let (mut bank_forks, mut pending_slots) = {
let bank0 = Bank::new(&genesis_block);
let bank0 = Bank::new_with_paths(&genesis_block, account_paths);
let slot = 0;
let entry_height = 0;
let last_entry_id = bank0.last_id();
@@ -297,7 +298,7 @@ mod tests {
fill_blocktree_slot_with_ticks(&blocktree, ticks_per_slot, 2, 1, last_id);
let (mut _bank_forks, bank_forks_info) =
process_blocktree(&genesis_block, &blocktree).unwrap();
process_blocktree(&genesis_block, &blocktree, "").unwrap();
assert_eq!(bank_forks_info.len(), 1);
assert_eq!(
@@ -356,7 +357,7 @@ mod tests {
info!("last_fork2_entry_id: {:?}", last_fork2_entry_id);
let (mut bank_forks, bank_forks_info) =
process_blocktree(&genesis_block, &blocktree).unwrap();
process_blocktree(&genesis_block, &blocktree, "").unwrap();
assert_eq!(bank_forks_info.len(), 2); // There are two forks
assert_eq!(
@@ -474,7 +475,7 @@ mod tests {
Blocktree::open(&ledger_path).expect("Expected to successfully open database ledger");
blocktree.write_entries(1, 0, 0, &entries).unwrap();
let entry_height = genesis_block.ticks_per_slot + entries.len() as u64;
let (bank_forks, bank_forks_info) = process_blocktree(&genesis_block, &blocktree).unwrap();
let (bank_forks, bank_forks_info) = process_blocktree(&genesis_block, &blocktree, "").unwrap();
assert_eq!(bank_forks_info.len(), 1);
assert_eq!(

View File

@@ -85,7 +85,7 @@ impl Default for FullnodeConfig {
blockstream: None,
storage_rotate_count: NUM_HASHES_FOR_STORAGE_ROTATE,
tick_config: PohServiceConfig::default(),
account_paths: "0,1,2,3".to_string(),
account_paths: "".to_string(),
}
}
}
@@ -417,7 +417,7 @@ pub fn new_banks_from_blocktree(
.expect("Expected to successfully open database ledger");
let (bank_forks, bank_forks_info) =
blocktree_processor::process_blocktree(&genesis_block, &blocktree)
blocktree_processor::process_blocktree(&genesis_block, &blocktree, account_paths)
.expect("process_blocktree failed");
(

View File

@@ -139,7 +139,7 @@ impl Replicator {
GenesisBlock::load(ledger_path).expect("Expected to successfully open genesis block");
let (bank_forks, _bank_forks_info) =
blocktree_processor::process_blocktree(&genesis_block, &blocktree)
blocktree_processor::process_blocktree(&genesis_block, &blocktree, "")
.expect("process_blocktree failed");
let blocktree = Arc::new(blocktree);