Skip to content

Commit

Permalink
tortoise: load ref ballots before other (#4944)
Browse files Browse the repository at this point in the history
this can be seen as attack, where ref ballots is published, everyone is using that as base ballot, 
and then ref ballot gets cancelled. 
we still need to load it in state, otherwise it may block counting honest ballots
  • Loading branch information
dshulyak committed Sep 1, 2023
1 parent 0ab0429 commit cc34c4e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tortoise/recover.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ func RecoverLayer(ctx context.Context, trtl *Tortoise, db *datastore.CachedDB, b
return err
}
for _, ballot := range ballotsrst {
trtl.OnBallot(ballot.ToTortoiseData())
if ballot.EpochData != nil {
trtl.OnBallot(ballot.ToTortoiseData())
}
}
for _, ballot := range ballotsrst {
if ballot.EpochData == nil {
trtl.OnBallot(ballot.ToTortoiseData())
}
}
coin, err := layers.GetWeakCoin(db, lid)
if err != nil && !errors.Is(err, sql.ErrNotFound) {
Expand Down

0 comments on commit cc34c4e

Please sign in to comment.