diff --git a/x/staking/genesis.go b/x/staking/genesis.go index d433d0f01b73..34a5be852a02 100644 --- a/x/staking/genesis.go +++ b/x/staking/genesis.go @@ -237,17 +237,22 @@ func validateGenesisStateValidators(validators []types.Validator) error { if err != nil { return err } - consAddr, err := val.GetConsAddr() - if err != nil { - return err - } + strKey := string(consPk.Bytes()) if _, ok := addrMap[strKey]; ok { + consAddr, err := val.GetConsAddr() + if err != nil { + return err + } return fmt.Errorf("duplicate validator in genesis state: moniker %v, address %v", val.Description.Moniker, consAddr) } if val.Jailed && val.IsBonded() { + consAddr, err := val.GetConsAddr() + if err != nil { + return err + } return fmt.Errorf("validator is bonded and jailed in genesis state: moniker %v, address %v", val.Description.Moniker, consAddr) }