Guard against invalid tick heights
This commit is contained in:
parent
2d2572d2cb
commit
5181a2a9b1
|
@ -103,7 +103,9 @@ impl LastIdQueue {
|
||||||
let current_tick_height = self.tick_height;
|
let current_tick_height = self.tick_height;
|
||||||
let mut total = 0;
|
let mut total = 0;
|
||||||
for (tick_height, stake) in ticks_and_stakes.iter() {
|
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;
|
total += stake;
|
||||||
if total > supermajority_stake {
|
if total > supermajority_stake {
|
||||||
return self.tick_height_to_timestamp(*tick_height);
|
return self.tick_height_to_timestamp(*tick_height);
|
||||||
|
|
Loading…
Reference in New Issue