Fix sending root slots instead of current slot (#4354)

automerge
This commit is contained in:
Sagar Dhawan 2019-05-20 15:01:55 -07:00 committed by Grimes
parent d4da2fbacd
commit af82b0dce9
1 changed files with 9 additions and 2 deletions

View File

@ -308,12 +308,19 @@ impl ReplayStage {
T: 'static + KeypairUtil + Send + Sync,
{
if let Some(new_root) = locktower.record_vote(bank.slot()) {
let mut rooted_slots = bank
// get the root bank before squash
let root_bank = bank_forks
.read()
.unwrap()
.get(new_root)
.expect("Root bank doesn't exist")
.clone();
let mut rooted_slots = root_bank
.parents()
.into_iter()
.map(|bank| bank.slot())
.collect::<Vec<_>>();
rooted_slots.push(bank.slot());
rooted_slots.push(root_bank.slot());
bank_forks.write().unwrap().set_root(new_root);
leader_schedule_cache.set_root(new_root);
blocktree.set_root(new_root)?;