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.status_cache = parent.status_cache.clone();
        bank.bank_height = parent.bank_height + 1;
        bank.fee_calculator = parent.fee_calculator.clone();

        bank.transaction_count
            .store(parent.transaction_count() as usize, Ordering::Relaxed);
        bank.stakes = RwLock::new(parent.stakes.read().unwrap().clone());

        bank.tick_height
            .store(parent.tick_height.load(Ordering::SeqCst), Ordering::SeqCst);
        bank.ticks_per_slot = parent.ticks_per_slot;
        bank.epoch_schedule = parent.epoch_schedule;

        bank.slot = slot;
        bank.max_tick_height = (bank.slot + 1) * bank.ticks_per_slot - 1;

        datapoint_info!(
            "bank-new_from_parent-heights",
            ("slot_height", slot, i64),
            ("bank_height", bank.bank_height, i64)
        );

        bank.parent = RwLock::new(Some(parent.clone()));
        bank.parent_hash = parent.hash();
        bank.collector_id = *collector_id;

        bank.accounts = Arc::new(Accounts::new_from_parent(&parent.accounts));

        bank.epoch_stakes = {
            let mut epoch_stakes = parent.epoch_stakes.clone();
            let epoch = bank.get_stakers_epoch(bank.slot);
            // update epoch_vote_states cache
            //  if my parent didn't populate for this epoch, we've
            //  crossed a boundary
            if epoch_stakes.get(&epoch).is_none() {
                epoch_stakes.insert(epoch, bank.stakes.read().unwrap().clone());
            }
            epoch_stakes
        };
        bank.ancestors.insert(bank.slot(), 0);
        bank.parents().iter().enumerate().for_each(|(i, p)| {
            bank.ancestors.insert(p.slot(), i + 1);
        });

        bank
    }
/// Create a new bank that points to an immutable checkpoint of another bank.
Create a new bank that points to an immutable checkpoint of another 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, 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.status_cache = parent.status_cache.clone();
        bank.bank_height = parent.bank_height + 1;
        bank.fee_calculator = parent.fee_calculator.clone();
        bank.transaction_count
            .store(parent.transaction_count() as usize, Ordering::Relaxed);
        bank.stakes = RwLock::new(parent.stakes.read().unwrap().clone());
        bank.tick_height
            .store(parent.tick_height.load(Ordering::SeqCst), Ordering::SeqCst);
        bank.ticks_per_slot = parent.ticks_per_slot;
        bank.epoch_schedule = parent.epoch_schedule;
        bank.slot = slot;
        bank.max_tick_height = (bank.slot + 1) * bank.ticks_per_slot - 1;
        datapoint_info!(
            "bank-new_from_parent-heights",
            ("slot_height", slot, i64),
            ("bank_height", bank.bank_height, i64)
        );
        bank.parent = RwLock::new(Some(parent.clone()));
        bank.parent_hash = parent.hash();
        bank.collector_id = *collector_id;
        bank.accounts = Arc::new(Accounts::new_from_parent(&parent.accounts));
        bank.epoch_stakes = {
            let mut epoch_stakes = parent.epoch_stakes.clone();
            let epoch = bank.get_stakers_epoch(bank.slot);
            // update epoch_vote_states cache
            //  if my parent didn't populate for this epoch, we've
            //  crossed a boundary
            if epoch_stakes.get(&epoch).is_none() {
                epoch_stakes.insert(epoch, bank.stakes.read().unwrap().clone());
            }
            epoch_stakes
        };
        bank.ancestors.insert(bank.slot(), 0);
        bank.parents().iter().enumerate().for_each(|(i, p)| {
            bank.ancestors.insert(p.slot(), i + 1);
        });
        bank
    }
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 . status_cache = parent . status_cache . clone ( ) ; bank . bank_height = parent . bank_height + 1 ; bank . fee_calculator = parent . fee_calculator . clone ( ) ; bank . transaction_count . store ( parent . transaction_count ( ) as usize , Ordering :: Relaxed ) ; bank . stakes = RwLock :: new ( parent . stakes . read ( ) . unwrap ( ) . clone ( ) ) ; bank . tick_height . store ( parent . tick_height . load ( Ordering :: SeqCst ) , Ordering :: SeqCst ) ; bank . ticks_per_slot = parent . ticks_per_slot ; bank . epoch_schedule = parent . epoch_schedule ; bank . slot = slot ; bank . max_tick_height = ( bank . slot + 1 ) * bank . ticks_per_slot - 1 ; datapoint_info ! ( " " ( " " slot i64 ) ( " " bank bank_height i64 ) ) ; bank . parent = RwLock :: new ( Some ( parent . clone ( ) ) ) ; bank . parent_hash = parent . hash ( ) ; bank . collector_id = * collector_id ; bank . accounts = Arc :: new ( Accounts :: new_from_parent ( & parent . accounts ) ) ; bank . epoch_stakes = { let mut epoch_stakes = parent . epoch_stakes . clone ( ) ; let epoch = bank . get_stakers_epoch ( bank . slot ) ; // update epoch_vote_states cache //  if my parent didn't populate for this epoch, we've //  crossed a boundary if epoch_stakes . get ( & epoch ) . is_none ( ) { epoch_stakes . insert ( epoch , bank . stakes . read ( ) . unwrap ( ) . clone ( ) ) ; } epoch_stakes } ; bank . ancestors . insert ( bank . slot ( ) , 0 ) ; bank . parents ( ) . iter ( ) . enumerate ( ) . for_each ( | ( i , p ) | { bank . ancestors . insert ( p . slot ( ) , i + 1 ) ; } ) ; bank }
Create a new bank that points to an immutable checkpoint of another bank.
Create a new bank that points to an immutable checkpoint of another bank .
parent
&Arc<Bank>
collector_id
&Pubkey
slot
u64
parent
&Arc<Bank>
collector_id
&Pubkey
slot
u64