From 5d3961d7054f50aa6b806890b041ed495a0dae74 Mon Sep 17 00:00:00 2001 From: folex <0xdxdy@gmail.com> Date: Fri, 6 Sep 2019 13:51:19 +0200 Subject: [PATCH] Fix TestBeginBlockValidators --- state/execution_test.go | 4 ++-- types/protobuf.go | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/state/execution_test.go b/state/execution_test.go index f58e1501..863de421 100644 --- a/state/execution_test.go +++ b/state/execution_test.go @@ -64,7 +64,7 @@ func TestBeginBlockValidators(t *testing.T) { now := tmtime.Now() commitSig0 := (&types.Vote{ValidatorIndex: 0, Timestamp: now, Type: types.PrecommitType}).CommitSig() - commitSig1 := (&types.Vote{ValidatorIndex: 1, Timestamp: now}).CommitSig() + commitSig1 := (&types.Vote{ValidatorIndex: 1, Timestamp: now, Type: types.PrecommitType}).CommitSig() testCases := []struct { desc string @@ -97,7 +97,7 @@ func TestBeginBlockValidators(t *testing.T) { } else { assert.True(t, v.SignedLastBlock) assert.NotNil(t, v.FullVote) - assert.Equal(t, *v.FullVote, types.Vote(*tc.lastCommitPrecommits[i])) + assert.Equal(t, v.FullVote, types.TM2PB.Vote(tc.lastCommitPrecommits[i])) } } } diff --git a/types/protobuf.go b/types/protobuf.go index f4dc526a..3cfc7f38 100644 --- a/types/protobuf.go +++ b/types/protobuf.go @@ -222,6 +222,10 @@ func (pb2tm) ValidatorUpdates(vals []abci.ValidatorUpdate) ([]*Validator, error) } func (tm2pb) Vote(vote *CommitSig) *abci.Vote { + if vote == nil { + return nil + } + blockID := TM2PB.BlockID(vote.BlockID) return &abci.Vote{