fix order of BlockID and Timestamp in Vote and Proposal (#3078)

* Consistent order fields of Timestamp/BlockID fields in CanonicalVote and
CanonicalProposal

* update spec too

* Introduce and use IsZero & IsComplete:
 - update IsZero method according to spec and introduce IsComplete
 - use methods in validate basic to validate: proposals come with a
 "complete" blockId and votes are either complete or empty
 - update spec: BlockID.IsNil() -> BlockID.IsZero() and fix typo

* BlockID comes first

* fix tests
This commit is contained in:
Ismail Khoffi
2019-01-13 23:56:36 +01:00
committed by Ethan Buchman
parent 1ccc0918f5
commit 1f68318875
10 changed files with 40 additions and 25 deletions

View File

@ -75,7 +75,7 @@ func (psh PartSetHeader) String() string {
}
func (psh PartSetHeader) IsZero() bool {
return psh.Total == 0
return psh.Total == 0 && len(psh.Hash) == 0
}
func (psh PartSetHeader) Equals(other PartSetHeader) bool {