From ee7bbb6cb29415b3cdae221a375599c8305fe940 Mon Sep 17 00:00:00 2001 From: Marko Date: Mon, 27 Jul 2020 13:36:03 +0200 Subject: [PATCH] types: validatebasic on from proto (#5152) ## Description Validatebasic on FromProto for validator set not ToProto Closes: #XXX --- types/validator_set.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/types/validator_set.go b/types/validator_set.go index b97cc9d5c..b8e0c847f 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -910,9 +910,7 @@ func (vals *ValidatorSet) ToProto() (*tmproto.ValidatorSet, error) { if vals == nil { return nil, errors.New("nil validator set") // validator set should never be nil } - if err := vals.ValidateBasic(); err != nil { - return nil, fmt.Errorf("validator set failed basic: %w", err) - } + vp := new(tmproto.ValidatorSet) valsProto := make([]*tmproto.Validator, len(vals.Validators)) for i := 0; i < len(vals.Validators); i++ { @@ -963,7 +961,7 @@ func ValidatorSetFromProto(vp *tmproto.ValidatorSet) (*ValidatorSet, error) { vals.totalVotingPower = vp.GetTotalVotingPower() - return vals, nil + return vals, vals.ValidateBasic() } //----------------------------------------