Browse Source

Fix types tests

Signed-off-by: Thane Thomson <connect@thanethomson.com>
thane/7655-vote-extensions
Thane Thomson 3 years ago
parent
commit
da4fedc382
No known key found for this signature in database GPG Key ID: 19811391D676EE45
2 changed files with 5 additions and 9 deletions
  1. +4
    -2
      types/vote.go
  2. +1
    -7
      types/vote_test.go

+ 4
- 2
types/vote.go View File

@ -118,7 +118,8 @@ func (vote *Vote) Copy() *Vote {
// 6. type string
// 7. first 6 bytes of block hash
// 8. first 6 bytes of signature
// 9. timestamp
// 9. first 6 bytes of vote extension
// 10. timestamp
func (vote *Vote) String() string {
if vote == nil {
return nilVoteStr
@ -134,7 +135,7 @@ func (vote *Vote) String() string {
panic("Unknown vote type")
}
return fmt.Sprintf("Vote{%v:%X %v/%02d/%v(%v) %X %X @ %s}",
return fmt.Sprintf("Vote{%v:%X %v/%02d/%v(%v) %X %X %X @ %s}",
vote.ValidatorIndex,
tmbytes.Fingerprint(vote.ValidatorAddress),
vote.Height,
@ -143,6 +144,7 @@ func (vote *Vote) String() string {
typeString,
tmbytes.Fingerprint(vote.BlockID.Hash),
tmbytes.Fingerprint(vote.Signature),
tmbytes.Fingerprint(vote.Extension),
CanonicalTime(vote.Timestamp),
)
}


+ 1
- 7
types/vote_test.go View File

@ -143,7 +143,7 @@ func TestVoteSignBytesTestVectors(t *testing.T) {
ExtensionSignature: []byte{},
},
[]byte{
0x38, // length
0x2e, // length
0x11, // (field_number << 3) | wire_type
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // height
0x19, // (field_number << 3) | wire_type
@ -155,12 +155,6 @@ func TestVoteSignBytesTestVectors(t *testing.T) {
0x32,
0xd, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, // chainID
// (field_number << 3) | wire_type
0x3a,
0x8, // length
0xa, // (field_number << 3) | wire_type
0x6, // length
0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, // AppDataSigned
// SelfAuthenticating data is excluded on signing
}, // chainID
},
}


Loading…
Cancel
Save