types: TestValidatorSetVerifyCommit

This commit is contained in:
Ethan Buchman
2018-03-02 04:10:22 -05:00
parent f9921ae362
commit c394eef7b8
3 changed files with 66 additions and 2 deletions

View File

@ -252,7 +252,8 @@ type Commit struct {
bitArray *cmn.BitArray
}
// FirstPrecommit returns the first non-nil precommit in the commit
// FirstPrecommit returns the first non-nil precommit in the commit.
// If all precommits are nil, it returns an empty precommit with height 0.
func (commit *Commit) FirstPrecommit() *Vote {
if len(commit.Precommits) == 0 {
return nil
@ -266,7 +267,9 @@ func (commit *Commit) FirstPrecommit() *Vote {
return precommit
}
}
return nil
return &Vote{
Type: VoteTypePrecommit,
}
}
// Height returns the height of the commit