diff --git a/src/bank_forks.rs b/src/bank_forks.rs index 5b23efe415b41a..4bd5f27b137e70 100644 --- a/src/bank_forks.rs +++ b/src/bank_forks.rs @@ -42,16 +42,8 @@ impl BankForks { // TODO: use the bank's own ID instead of receiving a parameter pub fn insert(&mut self, bank_id: u64, bank: Bank) { - let mut bank = Arc::new(bank); + let bank = Arc::new(bank); self.banks.insert(bank_id, bank.clone()); - - // TODO: this really only needs to look at the first - // parent if we're always calling insert() - // when we construct a child bank - while let Some(parent) = bank.parent() { - self.banks.remove(&parent.id()); - bank = parent; - } } pub fn set_working_bank_id(&mut self, bank_id: u64) { diff --git a/src/poh_recorder.rs b/src/poh_recorder.rs index 8b78eef9fd72db..0606e9ef3dc1f9 100644 --- a/src/poh_recorder.rs +++ b/src/poh_recorder.rs @@ -96,7 +96,8 @@ impl PohRecorder { .count(); let e = if cnt > 0 { debug!( - "flush_cache: {} {} sending: {}", + "flush_cache: bank_id: {} tick_height: {} max: {} sending: {}", + working_bank.bank.id(), working_bank.bank.tick_height(), working_bank.max_tick_height, cnt, diff --git a/src/replay_stage.rs b/src/replay_stage.rs index 71272d0c89ca7f..d06dd44760d0a0 100644 --- a/src/replay_stage.rs +++ b/src/replay_stage.rs @@ -147,6 +147,8 @@ impl ReplayStage { "replicate-stage_failed_process_entries", entries.len() ); + } else { + trace!("{} verify_and_process_entries passed", my_id); } } } else { @@ -163,6 +165,7 @@ impl ReplayStage { if bank.tick_height() == max_tick_height { trace!("{} frozen bank: {}", my_id, bank_id); bank.freeze(); + assert!(bank_forks.read().unwrap().frozen_banks().len() > 0); votable.push(bank_id); progress.remove(&bank_id); } @@ -198,8 +201,16 @@ impl ReplayStage { cluster_info.write().unwrap().push_vote(vote); } if next_leader == my_id { - let tpu_bank = Bank::new_from_parent_and_id(&bank, my_id, next_slot); - bank_forks.write().unwrap().insert(next_slot, tpu_bank); + trace!("{} I am next_leader", my_id); + let mut wforks = bank_forks.write().unwrap(); + let has_bank = wforks.get(next_slot).is_some(); + if !has_bank { + let tpu_bank = + Bank::new_from_parent_and_id(&bank, my_id, next_slot); + trace!("{} I am next_leader, new_bank {}", my_id, tpu_bank.id()); + wforks.insert(next_slot, tpu_bank); + wforks.set_working_bank_id(next_slot); + } } // Always send rotation signal so that other services like // RPC can be made aware of last slot's bank