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.

45 lines
1.0 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. package consensus
  2. import (
  3. "errors"
  4. "fmt"
  5. "io"
  6. . "github.com/tendermint/tendermint/account"
  7. . "github.com/tendermint/tendermint/binary"
  8. . "github.com/tendermint/tendermint/block"
  9. )
  10. var (
  11. ErrInvalidBlockPartSignature = errors.New("Error invalid block part signature")
  12. ErrInvalidBlockPartHash = errors.New("Error invalid block part hash")
  13. )
  14. type Proposal struct {
  15. Height uint
  16. Round uint
  17. BlockParts PartSetHeader
  18. POLParts PartSetHeader
  19. Signature SignatureEd25519
  20. }
  21. func NewProposal(height uint, round uint, blockParts, polParts PartSetHeader) *Proposal {
  22. return &Proposal{
  23. Height: height,
  24. Round: round,
  25. BlockParts: blockParts,
  26. POLParts: polParts,
  27. }
  28. }
  29. func (p *Proposal) String() string {
  30. return fmt.Sprintf("Proposal{%v/%v %v %v %v}", p.Height, p.Round,
  31. p.BlockParts, p.POLParts, p.Signature)
  32. }
  33. func (p *Proposal) WriteSignBytes(w io.Writer, n *int64, err *error) {
  34. WriteUvarint(p.Height, w, n, err)
  35. WriteUvarint(p.Round, w, n, err)
  36. WriteBinary(p.BlockParts, w, n, err)
  37. WriteBinary(p.POLParts, w, n, err)
  38. }