mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-03 11:45:18 +00:00
types: validatebasic on from proto (#5152)
## Description Validatebasic on FromProto for validator set not ToProto Closes: #XXX
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user