filter out banks that have an older epoch (#3472)
This commit is contained in:
committed by
GitHub
parent
5c536e423c
commit
51004881f8
@ -142,13 +142,28 @@ impl Locktower {
|
|||||||
stake_lockouts
|
stake_lockouts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_recent_epoch(&self, bank: &Bank) -> bool {
|
||||||
|
let bank_epoch = bank.get_epoch_and_slot_index(bank.slot()).0;
|
||||||
|
bank_epoch >= self.epoch_stakes.slot
|
||||||
|
}
|
||||||
|
|
||||||
pub fn update_epoch(&mut self, bank: &Bank) {
|
pub fn update_epoch(&mut self, bank: &Bank) {
|
||||||
|
trace!(
|
||||||
|
"updating bank epoch {} {}",
|
||||||
|
bank.slot(),
|
||||||
|
self.epoch_stakes.slot
|
||||||
|
);
|
||||||
let bank_epoch = bank.get_epoch_and_slot_index(bank.slot()).0;
|
let bank_epoch = bank.get_epoch_and_slot_index(bank.slot()).0;
|
||||||
if bank_epoch != self.epoch_stakes.slot {
|
if bank_epoch != self.epoch_stakes.slot {
|
||||||
assert!(
|
assert!(
|
||||||
bank_epoch > self.epoch_stakes.slot,
|
self.is_recent_epoch(bank),
|
||||||
"epoch_stakes cannot move backwards"
|
"epoch_stakes cannot move backwards"
|
||||||
);
|
);
|
||||||
|
info!(
|
||||||
|
"Locktower updated epoch bank {} {}",
|
||||||
|
bank.slot(),
|
||||||
|
self.epoch_stakes.slot
|
||||||
|
);
|
||||||
self.epoch_stakes = EpochStakes::new_from_bank(bank);
|
self.epoch_stakes = EpochStakes::new_from_bank(bank);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -385,6 +385,11 @@ impl ReplayStage {
|
|||||||
trace!("bank is votable: {} {}", b.slot(), is_votable);
|
trace!("bank is votable: {} {}", b.slot(), is_votable);
|
||||||
is_votable
|
is_votable
|
||||||
})
|
})
|
||||||
|
.filter(|b| {
|
||||||
|
let is_recent_epoch = locktower.is_recent_epoch(b);
|
||||||
|
trace!("bank is is_recent_epoch: {} {}", b.slot(), is_recent_epoch);
|
||||||
|
is_recent_epoch
|
||||||
|
})
|
||||||
.filter(|b| {
|
.filter(|b| {
|
||||||
let has_voted = locktower.has_voted(b.slot());
|
let has_voted = locktower.has_voted(b.slot());
|
||||||
trace!("bank is has_voted: {} {}", b.slot(), has_voted);
|
trace!("bank is has_voted: {} {}", b.slot(), has_voted);
|
||||||
|
Reference in New Issue
Block a user