You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
653 B

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. package blocks
  2. import (
  3. . "github.com/tendermint/tendermint/binary"
  4. "io"
  5. )
  6. /*
  7. The full vote structure is only needed when presented as evidence.
  8. Typically only the signature is passed around, as the hash & height are implied.
  9. */
  10. type Vote struct {
  11. Height UInt64
  12. BlockHash ByteSlice
  13. Signature
  14. }
  15. func ReadVote(r io.Reader) Vote {
  16. return Vote{
  17. Height: ReadUInt64(r),
  18. BlockHash: ReadByteSlice(r),
  19. Signature: ReadSignature(r),
  20. }
  21. }
  22. func (self Vote) WriteTo(w io.Writer) (n int64, err error) {
  23. n, err = WriteTo(self.Height, w, n, err)
  24. n, err = WriteTo(self.BlockHash, w, n, err)
  25. n, err = WriteTo(self.Signature, w, n, err)
  26. return
  27. }