remove duplicate child creation (#3100)

* remove duplicate child creation
* resurrect test for partial slot
* simplify blocktree_processor some more (no tick_height, yay!)
* ensure frozen
This commit is contained in:
Rob Walker
2019-03-04 19:22:23 -08:00
committed by GitHub
parent 906df5e20e
commit 43bab23651
3 changed files with 72 additions and 59 deletions

View File

@@ -153,9 +153,11 @@ impl Bank {
}
/// Create a new bank that points to an immutable checkpoint of another bank.
pub fn new_from_parent(parent: &Arc<Bank>, collector_id: Pubkey, id: u64) -> Self {
pub fn new_from_parent(parent: &Arc<Bank>, collector_id: Pubkey, slot: u64) -> Self {
parent.freeze();
assert_ne!(slot, parent.slot());
let mut bank = Self::default();
bank.blockhash_queue = RwLock::new(parent.blockhash_queue.read().unwrap().clone());
bank.tick_height
@@ -164,7 +166,7 @@ impl Bank {
bank.slots_per_epoch = parent.slots_per_epoch;
bank.stakers_slot_offset = parent.stakers_slot_offset;
bank.slot = id;
bank.slot = slot;
bank.parent = RwLock::new(Some(parent.clone()));
bank.parent_hash = parent.hash();
bank.collector_id = collector_id;