|
@ -20,11 +20,12 @@ var ( |
|
|
// to be considered valid. It may depend on votes from a previous round,
|
|
|
// to be considered valid. It may depend on votes from a previous round,
|
|
|
// a so-called Proof-of-Lock (POL) round, as noted in the POLRound and POLBlockID.
|
|
|
// a so-called Proof-of-Lock (POL) round, as noted in the POLRound and POLBlockID.
|
|
|
type Proposal struct { |
|
|
type Proposal struct { |
|
|
|
|
|
Type SignedMsgType |
|
|
Height int64 `json:"height"` |
|
|
Height int64 `json:"height"` |
|
|
Round int `json:"round"` |
|
|
Round int `json:"round"` |
|
|
|
|
|
POLRound int `json:"pol_round"` // -1 if null.
|
|
|
Timestamp time.Time `json:"timestamp"` |
|
|
Timestamp time.Time `json:"timestamp"` |
|
|
BlockPartsHeader PartSetHeader `json:"block_parts_header"` |
|
|
BlockPartsHeader PartSetHeader `json:"block_parts_header"` |
|
|
POLRound int `json:"pol_round"` // -1 if null.
|
|
|
|
|
|
POLBlockID BlockID `json:"pol_block_id"` // zero if null.
|
|
|
POLBlockID BlockID `json:"pol_block_id"` // zero if null.
|
|
|
Signature []byte `json:"signature"` |
|
|
Signature []byte `json:"signature"` |
|
|
} |
|
|
} |
|
@ -33,11 +34,12 @@ type Proposal struct { |
|
|
// If there is no POLRound, polRound should be -1.
|
|
|
// If there is no POLRound, polRound should be -1.
|
|
|
func NewProposal(height int64, round int, blockPartsHeader PartSetHeader, polRound int, polBlockID BlockID) *Proposal { |
|
|
func NewProposal(height int64, round int, blockPartsHeader PartSetHeader, polRound int, polBlockID BlockID) *Proposal { |
|
|
return &Proposal{ |
|
|
return &Proposal{ |
|
|
|
|
|
Type: ProposalType, |
|
|
Height: height, |
|
|
Height: height, |
|
|
Round: round, |
|
|
Round: round, |
|
|
|
|
|
POLRound: polRound, |
|
|
Timestamp: tmtime.Now(), |
|
|
Timestamp: tmtime.Now(), |
|
|
BlockPartsHeader: blockPartsHeader, |
|
|
BlockPartsHeader: blockPartsHeader, |
|
|
POLRound: polRound, |
|
|
|
|
|
POLBlockID: polBlockID, |
|
|
POLBlockID: polBlockID, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -45,9 +47,13 @@ func NewProposal(height int64, round int, blockPartsHeader PartSetHeader, polRou |
|
|
// String returns a string representation of the Proposal.
|
|
|
// String returns a string representation of the Proposal.
|
|
|
func (p *Proposal) String() string { |
|
|
func (p *Proposal) String() string { |
|
|
return fmt.Sprintf("Proposal{%v/%v %v (%v,%v) %X @ %s}", |
|
|
return fmt.Sprintf("Proposal{%v/%v %v (%v,%v) %X @ %s}", |
|
|
p.Height, p.Round, p.BlockPartsHeader, p.POLRound, |
|
|
|
|
|
|
|
|
p.Height, |
|
|
|
|
|
p.Round, |
|
|
|
|
|
p.BlockPartsHeader, |
|
|
|
|
|
p.POLRound, |
|
|
p.POLBlockID, |
|
|
p.POLBlockID, |
|
|
cmn.Fingerprint(p.Signature), CanonicalTime(p.Timestamp)) |
|
|
|
|
|
|
|
|
cmn.Fingerprint(p.Signature), |
|
|
|
|
|
CanonicalTime(p.Timestamp)) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// SignBytes returns the Proposal bytes for signing
|
|
|
// SignBytes returns the Proposal bytes for signing
|
|
|