-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
According to the spec, Proposal message has the following format:
⟨PROPOSAL, height , round , proposal, validRound⟩ where proposal corresponds to the id of the block proposal (BlockID). Currently, Proposal message has the following format:
Lines 22 to 30 in 8056266
| type Proposal struct { | |
| Height int64 `json:"height"` | |
| Round int `json:"round"` | |
| Timestamp time.Time `json:"timestamp"` | |
| BlockPartsHeader PartSetHeader `json:"block_parts_header"` | |
| POLRound int `json:"pol_round"` // -1 if null. | |
| POLBlockID BlockID `json:"pol_block_id"` // zero if null. | |
| Signature []byte `json:"signature"` | |
| } |
We could simplify Proposal message as done in spec by removing BlockPartsHeader and only having a single field that is BlockID of the proposed block. Furthermore, we currently rely on function POLInfo to decide what is POLRound and POLBlockID that goes into Proposal message. See
tendermint/consensus/types/height_vote_set.go
Lines 148 to 159 in 8056266
| func (hvs *HeightVoteSet) POLInfo() (polRound int, polBlockID types.BlockID) { | |
| hvs.mtx.Lock() | |
| defer hvs.mtx.Unlock() | |
| for r := hvs.round; r >= 0; r-- { | |
| rvs := hvs.getVoteSet(r, types.PrevoteType) | |
| polBlockID, ok := rvs.TwoThirdsMajority() | |
| if ok { | |
| return r, polBlockID | |
| } | |
| } | |
| return -1, types.BlockID{} | |
| } |
This is not needed as ValidRound, ValidBlock and ValidBlockParts keep equivalent of those information. Therefore, we could completely remove POLInfo function.