Use the accounts list from parents up to finalized bank for Account::load apis.

Borrow checker

query the previous parents accounts

cleanup!

s/tree/parents

Tests!  Last_ids need to be inherited as well otherwise nothing works.

new_from_parent
This commit is contained in:
Anatoly Yakovenko 2019-02-16 21:35:20 -08:00 committed by Greg Fitzgerald
parent 6d67568037
commit 64f1d93cc3
2 changed files with 3 additions and 12 deletions

View File

@ -134,16 +134,6 @@ impl Bank {
*sub = Some(subscriptions)
}
pub fn copy_for_tpu(&self) -> Self {
Self {
accounts: self.accounts.copy_for_tpu(),
status_cache: RwLock::new(self.status_cache.read().unwrap().clone()),
last_id_queue: RwLock::new(self.last_id_queue.read().unwrap().clone()),
subscriptions: RwLock::new(None),
parent: self.parent.clone(),
}
}
pub fn process_genesis_block(&self, genesis_block: &GenesisBlock) {
assert!(genesis_block.mint_id != Pubkey::default());
assert!(genesis_block.bootstrap_leader_id != Pubkey::default());

View File

@ -363,9 +363,10 @@ impl Fullnode {
}
None => FullnodeReturnType::LeaderToLeaderRotation, // value doesn't matter here...
};
let mut new: Arc<Bank> = Arc::new(Bank::new_from_parent(self.bank.clone()));
std::mem::swap(&mut self.bank, &mut new);
self.node_services.tpu.switch_to_leader(
&Arc::new(self.bank.copy_for_tpu()),
&self.bank,
PohServiceConfig::default(),
self.tpu_sockets
.iter()