lite: < len(v) in for loop check, as per @melekes' recommendation

Also lazily load the commits to only be run once when
the benchmarks are activated, lest it slows down all the tests
This commit is contained in:
Emmanuel Odeke
2018-01-01 20:11:55 -08:00
parent 14eaba9ec3
commit 206da7a1b8
3 changed files with 22 additions and 15 deletions

View File

@ -77,10 +77,7 @@ func (v ValKeys) signHeader(header *types.Header, first, last int) *types.Commit
vset := v.ToValidators(1, 0)
// fill in the votes we want
for i := first; i < last; i++ {
if i >= len(v) {
break
}
for i := first; i < last && i < len(v); i++ {
vote := makeVote(header, vset, v[i])
votes[vote.ValidatorIndex] = vote
}