Skip to content

Commit

Permalink
Guard against invalid tick heights
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Feb 6, 2019
1 parent 2d2572d commit 5181a2a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/last_id_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5181a2a

Please sign in to comment.