flip order of error returns

This commit is contained in:
William Banfield
2022-05-15 22:19:32 -04:00
parent b75a831cf0
commit 2f96769c2f
+9 -5
View File
@@ -318,12 +318,16 @@ func (vote *Vote) ValidateBasic() error {
// on precommit vote types.
func (vote *Vote) EnsureExtension() error {
// We should always see vote extension signatures in non-nil precommits
if vote.Type == tmproto.PrecommitType && !vote.BlockID.IsNil() {
if len(vote.ExtensionSignature) == 0 {
return ErrVoteExtensionAbsent
}
if vote.Type != tmproto.PrecommitType {
return nil
}
return nil
if vote.BlockID.IsNil() {
return nil
}
if len(vote.ExtensionSignature) > 0 {
return nil
}
return ErrVoteExtensionAbsent
}
// ToProto converts the handwritten type to proto generated type