8 //. "github.com/tendermint/tmlibs/common"
9 "github.com/tendermint/go-crypto"
10 "github.com/tendermint/go-wire"
14 ErrInvalidBlockPartSignature = errors.New("Error invalid block part signature")
15 ErrInvalidBlockPartHash = errors.New("Error invalid block part hash")
18 type Proposal struct {
19 Height int `json:"height"`
20 Round int `json:"round"`
21 BlockPartsHeader PartSetHeader `json:"block_parts_header"`
22 POLRound int `json:"pol_round"` // -1 if null.
23 POLBlockID BlockID `json:"pol_block_id"` // zero if null.
24 Signature crypto.Signature `json:"signature"`
27 // polRound: -1 if no polRound.
28 func NewProposal(height int, round int, blockPartsHeader PartSetHeader, polRound int, polBlockID BlockID) *Proposal {
32 BlockPartsHeader: blockPartsHeader,
34 POLBlockID: polBlockID,
38 func (p *Proposal) String() string {
39 return fmt.Sprintf("Proposal{%v/%v %v (%v,%v) %v}", p.Height, p.Round,
40 p.BlockPartsHeader, p.POLRound, p.POLBlockID, p.Signature)
43 func (p *Proposal) WriteSignBytes(chainID string, w io.Writer, n *int, err *error) {
44 wire.WriteJSON(CanonicalJSONOnceProposal{
46 Proposal: CanonicalProposal(p),