Browse Source

Remove extraneous empty value initialization

Signed-off-by: Thane Thomson <connect@thanethomson.com>
thane/7655-vote-extensions
Thane Thomson 3 years ago
parent
commit
19e07c9a8c
No known key found for this signature in database GPG Key ID: 19811391D676EE45
3 changed files with 16 additions and 26 deletions
  1. +1
    -6
      internal/state/execution.go
  2. +8
    -10
      privval/msgs_test.go
  3. +7
    -10
      types/vote_test.go

+ 1
- 6
internal/state/execution.go View File

@ -324,12 +324,7 @@ func (blockExec *BlockExecutor) ExtendVote(ctx context.Context, vote *types.Vote
} }
func (blockExec *BlockExecutor) VerifyVoteExtension(ctx context.Context, vote *types.Vote) error { func (blockExec *BlockExecutor) VerifyVoteExtension(ctx context.Context, vote *types.Vote) error {
req := abci.RequestVerifyVoteExtension{
Hash: []byte{},
ValidatorAddress: []byte{},
Height: 0,
VoteExtension: []byte{},
}
req := abci.RequestVerifyVoteExtension{}
resp, err := blockExec.appClient.VerifyVoteExtension(ctx, req) resp, err := blockExec.appClient.VerifyVoteExtension(ctx, req)
if err != nil { if err != nil {


+ 8
- 10
privval/msgs_test.go View File

@ -22,16 +22,14 @@ var stamp = time.Date(2019, 10, 13, 16, 14, 44, 0, time.UTC)
func exampleVote() *types.Vote { func exampleVote() *types.Vote {
return &types.Vote{ return &types.Vote{
Type: tmproto.SignedMsgType(1),
Height: 3,
Round: 2,
BlockID: types.BlockID{Hash: tmhash.Sum([]byte("blockID_hash")), PartSetHeader: types.PartSetHeader{Total: 1000000, Hash: tmhash.Sum([]byte("blockID_part_set_header_hash"))}},
Timestamp: stamp,
ValidatorAddress: crypto.AddressHash([]byte("validator_address")),
ValidatorIndex: 56789,
Signature: []byte{},
Extension: []byte("app_data_signed"),
ExtensionSignature: []byte{},
Type: tmproto.SignedMsgType(1),
Height: 3,
Round: 2,
BlockID: types.BlockID{Hash: tmhash.Sum([]byte("blockID_hash")), PartSetHeader: types.PartSetHeader{Total: 1000000, Hash: tmhash.Sum([]byte("blockID_part_set_header_hash"))}},
Timestamp: stamp,
ValidatorAddress: crypto.AddressHash([]byte("validator_address")),
ValidatorIndex: 56789,
Extension: []byte("app_data_signed"),
} }
} }


+ 7
- 10
types/vote_test.go View File

@ -131,16 +131,13 @@ func TestVoteSignBytesTestVectors(t *testing.T) {
// containing vote extension // containing vote extension
5: { 5: {
"test_chain_id", &Vote{ "test_chain_id", &Vote{
Type: 0,
Height: 1,
Round: 1,
BlockID: BlockID{},
Timestamp: time.Time{},
ValidatorAddress: []byte{},
ValidatorIndex: 0,
Signature: []byte{},
Extension: []byte("signed"),
ExtensionSignature: []byte{},
Type: 0,
Height: 1,
Round: 1,
BlockID: BlockID{},
Timestamp: time.Time{},
ValidatorIndex: 0,
Extension: []byte("signed"),
}, },
[]byte{ []byte{
0x2e, // length 0x2e, // length


Loading…
Cancel
Save