types: check if nil or empty valset (#5167)

Solves #5138 in the way that if a validatorSet is nil or empty it will not try to transform it to protobug

Co-authored-by: Callum Michael Waters <cmwaters19@gmail.com>
This commit is contained in:
Marko
2020-07-29 20:16:42 +02:00
committed by GitHub
parent b5f030892d
commit dc71f265aa
4 changed files with 12 additions and 11 deletions

View File

@@ -167,7 +167,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
msg := <-blocksSubs[j].Out()
block := msg.Data().(types.EventDataNewBlock).Block
// assert that we have evidence
assert.True(t, len(block.Evidence.Evidence) == 1)
require.True(t, len(block.Evidence.Evidence) == 1)
// and that the evidence is of type DuplicateVoteEvidence
ev, ok := block.Evidence.Evidence[0].(*types.DuplicateVoteEvidence)
assert.True(t, ok)