Allow process_blocktree() to start processing from any root (#5484)

* Remove unnecessary entry_height from BankInfo

* Refactor process_blocktree to support process_blocktree_from_root

* Refactor to process blocktree after loading from snapshot

* On restart make sure bank_forks contains all the banks between the root and the tip of each fork, not just the head of each fork

* Account for 1 tick_per_slot in bank 0 so that blockhash of bank0 matches the tick
This commit is contained in:
carllin
2019-08-13 17:20:14 -07:00
committed by GitHub
parent 58d4e32c97
commit cd14a940d8
7 changed files with 452 additions and 293 deletions

View File

@ -724,12 +724,12 @@ impl Bank {
// TODO: put this assert back in
// assert!(!self.is_frozen());
let current_tick_height = {
if self.ticks_per_slot() != 1 || self.slot() != 0 {
self.tick_height.fetch_add(1, Ordering::Relaxed);
self.tick_height.load(Ordering::Relaxed) as u64
};
inc_new_counter_debug!("bank-register_tick-registered", 1);
inc_new_counter_debug!("bank-register_tick-registered", 1);
}
let current_tick_height = self.tick_height.load(Ordering::Relaxed) as u64;
// Register a new block hash if at the last tick in the slot
if current_tick_height % self.ticks_per_slot == self.ticks_per_slot - 1 {