From 2f96769c2f1acdf9d60513d8f9a36e19efd5c461 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Sun, 15 May 2022 22:19:32 -0400 Subject: [PATCH] flip order of error returns --- types/vote.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/types/vote.go b/types/vote.go index e81b631d1..e43624c16 100644 --- a/types/vote.go +++ b/types/vote.go @@ -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