From 77429b71d616636557bbe4f5e7ee3fb135221e08 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 30 Jul 2020 15:24:29 +0200 Subject: [PATCH] fix assertions on byzantine test (#5171) --- consensus/byzantine_test.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/consensus/byzantine_test.go b/consensus/byzantine_test.go index 003eef5fd..43b2f96bd 100644 --- a/consensus/byzantine_test.go +++ b/consensus/byzantine_test.go @@ -167,13 +167,14 @@ func TestByzantinePrevoteEquivocation(t *testing.T) { msg := <-blocksSubs[j].Out() block := msg.Data().(types.EventDataNewBlock).Block // assert that we have evidence - 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) - // and that the address matches to that of the byzantine node - pubkey, _ := bcs.privValidator.GetPubKey() - assert.Equal(t, []byte(pubkey.Address()), ev.Address()) + if assert.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) + // and that the address matches to that of the byzantine node + pubkey, _ := bcs.privValidator.GetPubKey() + assert.Equal(t, []byte(pubkey.Address()), ev.Address()) + } }, css) }