From 64f1d93cc31985605c8cc64484826411e81af6a9 Mon Sep 17 00:00:00 2001 From: Anatoly Yakovenko Date: Sat, 16 Feb 2019 21:35:20 -0800 Subject: [PATCH] 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 --- src/bank.rs | 10 ---------- src/fullnode.rs | 5 +++-- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/bank.rs b/src/bank.rs index af41abac5d..e203521ab0 100644 --- a/src/bank.rs +++ b/src/bank.rs @@ -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()); diff --git a/src/fullnode.rs b/src/fullnode.rs index c4a2df72b3..1a87cda80a 100644 --- a/src/fullnode.rs +++ b/src/fullnode.rs @@ -363,9 +363,10 @@ impl Fullnode { } None => FullnodeReturnType::LeaderToLeaderRotation, // value doesn't matter here... }; - + let mut new: Arc = 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()