|
@@ -142,6 +142,7 @@ pub fn process_blocktree(
|
|
|
genesis_block: &GenesisBlock,
|
|
genesis_block: &GenesisBlock,
|
|
|
blocktree: &Blocktree,
|
|
blocktree: &Blocktree,
|
|
|
account_paths: Option<String>,
|
|
account_paths: Option<String>,
|
|
|
|
|
+ verify_ledger: bool,
|
|
|
) -> result::Result<(BankForks, Vec<BankForksInfo>, LeaderScheduleCache), BlocktreeProcessorError> {
|
|
) -> result::Result<(BankForks, Vec<BankForksInfo>, LeaderScheduleCache), BlocktreeProcessorError> {
|
|
|
let now = Instant::now();
|
|
let now = Instant::now();
|
|
|
info!("processing ledger...");
|
|
info!("processing ledger...");
|
|
@@ -205,7 +206,7 @@ pub fn process_blocktree(
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if !entries.is_empty() {
|
|
if !entries.is_empty() {
|
|
|
- if !entries.verify(&last_entry_hash) {
|
|
|
|
|
|
|
+ if verify_ledger && !entries.verify(&last_entry_hash) {
|
|
|
warn!(
|
|
warn!(
|
|
|
"Ledger proof of history failed at slot: {}, entry: {}",
|
|
"Ledger proof of history failed at slot: {}, entry: {}",
|
|
|
slot, entry_height
|
|
slot, entry_height
|
|
@@ -374,7 +375,7 @@ pub mod tests {
|
|
|
fill_blocktree_slot_with_ticks(&blocktree, ticks_per_slot, 2, 1, blockhash);
|
|
fill_blocktree_slot_with_ticks(&blocktree, ticks_per_slot, 2, 1, blockhash);
|
|
|
|
|
|
|
|
let (mut _bank_forks, bank_forks_info, _) =
|
|
let (mut _bank_forks, bank_forks_info, _) =
|
|
|
- process_blocktree(&genesis_block, &blocktree, None).unwrap();
|
|
|
|
|
|
|
+ process_blocktree(&genesis_block, &blocktree, None, true).unwrap();
|
|
|
|
|
|
|
|
assert_eq!(bank_forks_info.len(), 1);
|
|
assert_eq!(bank_forks_info.len(), 1);
|
|
|
assert_eq!(
|
|
assert_eq!(
|
|
@@ -433,7 +434,7 @@ pub mod tests {
|
|
|
blocktree.set_roots(&[4, 1, 0]).unwrap();
|
|
blocktree.set_roots(&[4, 1, 0]).unwrap();
|
|
|
|
|
|
|
|
let (bank_forks, bank_forks_info, _) =
|
|
let (bank_forks, bank_forks_info, _) =
|
|
|
- process_blocktree(&genesis_block, &blocktree, None).unwrap();
|
|
|
|
|
|
|
+ process_blocktree(&genesis_block, &blocktree, None, true).unwrap();
|
|
|
|
|
|
|
|
assert_eq!(bank_forks_info.len(), 1); // One fork, other one is ignored b/c not a descendant of the root
|
|
assert_eq!(bank_forks_info.len(), 1); // One fork, other one is ignored b/c not a descendant of the root
|
|
|
|
|
|
|
@@ -507,7 +508,7 @@ pub mod tests {
|
|
|
blocktree.set_roots(&[0, 1]).unwrap();
|
|
blocktree.set_roots(&[0, 1]).unwrap();
|
|
|
|
|
|
|
|
let (bank_forks, bank_forks_info, _) =
|
|
let (bank_forks, bank_forks_info, _) =
|
|
|
- process_blocktree(&genesis_block, &blocktree, None).unwrap();
|
|
|
|
|
|
|
+ process_blocktree(&genesis_block, &blocktree, None, true).unwrap();
|
|
|
|
|
|
|
|
assert_eq!(bank_forks_info.len(), 2); // There are two forks
|
|
assert_eq!(bank_forks_info.len(), 2); // There are two forks
|
|
|
assert_eq!(
|
|
assert_eq!(
|
|
@@ -588,7 +589,7 @@ pub mod tests {
|
|
|
|
|
|
|
|
// Check that we can properly restart the ledger / leader scheduler doesn't fail
|
|
// Check that we can properly restart the ledger / leader scheduler doesn't fail
|
|
|
let (bank_forks, bank_forks_info, _) =
|
|
let (bank_forks, bank_forks_info, _) =
|
|
|
- process_blocktree(&genesis_block, &blocktree, None).unwrap();
|
|
|
|
|
|
|
+ process_blocktree(&genesis_block, &blocktree, None, true).unwrap();
|
|
|
|
|
|
|
|
assert_eq!(bank_forks_info.len(), 1); // There is one fork
|
|
assert_eq!(bank_forks_info.len(), 1); // There is one fork
|
|
|
assert_eq!(
|
|
assert_eq!(
|
|
@@ -724,7 +725,7 @@ pub mod tests {
|
|
|
.unwrap();
|
|
.unwrap();
|
|
|
let entry_height = genesis_block.ticks_per_slot + entries.len() as u64;
|
|
let entry_height = genesis_block.ticks_per_slot + entries.len() as u64;
|
|
|
let (bank_forks, bank_forks_info, _) =
|
|
let (bank_forks, bank_forks_info, _) =
|
|
|
- process_blocktree(&genesis_block, &blocktree, None).unwrap();
|
|
|
|
|
|
|
+ process_blocktree(&genesis_block, &blocktree, None, true).unwrap();
|
|
|
|
|
|
|
|
assert_eq!(bank_forks_info.len(), 1);
|
|
assert_eq!(bank_forks_info.len(), 1);
|
|
|
assert_eq!(bank_forks.root(), 0);
|
|
assert_eq!(bank_forks.root(), 0);
|
|
@@ -755,7 +756,7 @@ pub mod tests {
|
|
|
|
|
|
|
|
let blocktree = Blocktree::open(&ledger_path).unwrap();
|
|
let blocktree = Blocktree::open(&ledger_path).unwrap();
|
|
|
let (bank_forks, bank_forks_info, _) =
|
|
let (bank_forks, bank_forks_info, _) =
|
|
|
- process_blocktree(&genesis_block, &blocktree, None).unwrap();
|
|
|
|
|
|
|
+ process_blocktree(&genesis_block, &blocktree, None, true).unwrap();
|
|
|
|
|
|
|
|
assert_eq!(bank_forks_info.len(), 1);
|
|
assert_eq!(bank_forks_info.len(), 1);
|
|
|
assert_eq!(
|
|
assert_eq!(
|