Guard against invalid tick heights

This commit is contained in:
Michael Vines 2019-02-06 12:46:33 -08:00
parent 2d2572d2cb
commit 5181a2a9b1
1 changed files with 3 additions and 1 deletions

View File

@ -103,7 +103,9 @@ impl LastIdQueue {
let current_tick_height = self.tick_height;
let mut total = 0;
for (tick_height, stake) in ticks_and_stakes.iter() {
if ((current_tick_height - tick_height) as usize) < MAX_ENTRY_IDS {
if current_tick_height >= *tick_height
&& ((current_tick_height - tick_height) as usize) < MAX_ENTRY_IDS
{
total += stake;
if total > supermajority_stake {
return self.tick_height_to_timestamp(*tick_height);