func (params *ConsensusParams) Validate() error {
	if params.Block.MaxBytes <= 0 {
		return errors.Errorf("Block.MaxBytes must be greater than 0. Got %d",
			params.Block.MaxBytes)
	}
	if params.Block.MaxBytes > MaxBlockSizeBytes {
		return errors.Errorf("Block.MaxBytes is too big. %d > %d",
			params.Block.MaxBytes, MaxBlockSizeBytes)
	}

	if params.Block.MaxGas < -1 {
		return errors.Errorf("Block.MaxGas must be greater or equal to -1. Got %d",
			params.Block.MaxGas)
	}

	if params.Block.TimeIotaMs <= 0 {
		return errors.Errorf("Block.TimeIotaMs must be greater than 0. Got %v",
			params.Block.TimeIotaMs)
	}

	if params.Evidence.MaxAge <= 0 {
		return errors.Errorf("EvidenceParams.MaxAge must be greater than 0. Got %d",
			params.Evidence.MaxAge)
	}

	if len(params.Validator.PubKeyTypes) == 0 {
		return errors.New("len(Validator.PubKeyTypes) must be greater than 0")
	}

	// Check if keyType is a known ABCIPubKeyType
	for i := 0; i < len(params.Validator.PubKeyTypes); i++ {
		keyType := params.Validator.PubKeyTypes[i]
		if _, ok := ABCIPubKeyTypesToAminoNames[keyType]; !ok {
			return errors.Errorf("params.Validator.PubKeyTypes[%d], %s, is an unknown pubkey type",
				i, keyType)
		}
	}

	return nil
}
// Validate validates the ConsensusParams to ensure all values are within their
// allowed limits, and returns an error if they are not.
Validate validates the ConsensusParams to ensure all values are within their
allowed limits, and returns an error if they are not.
// Validate validates the ConsensusParams to ensure all values are within their // allowed limits and returns an error if they are not .
func (params *ConsensusParams) Validate() error {
	if params.Block.MaxBytes <= 0 {
		return errors.Errorf("Block.MaxBytes must be greater than 0. Got %d",
			params.Block.MaxBytes)
	}
	if params.Block.MaxBytes > MaxBlockSizeBytes {
		return errors.Errorf("Block.MaxBytes is too big. %d > %d",
			params.Block.MaxBytes, MaxBlockSizeBytes)
	}
	if params.Block.MaxGas < -1 {
		return errors.Errorf("Block.MaxGas must be greater or equal to -1. Got %d",
			params.Block.MaxGas)
	}
	if params.Block.TimeIotaMs <= 0 {
		return errors.Errorf("Block.TimeIotaMs must be greater than 0. Got %v",
			params.Block.TimeIotaMs)
	}
	if params.Evidence.MaxAge <= 0 {
		return errors.Errorf("EvidenceParams.MaxAge must be greater than 0. Got %d",
			params.Evidence.MaxAge)
	}
	if len(params.Validator.PubKeyTypes) == 0 {
		return errors.New("len(Validator.PubKeyTypes) must be greater than 0")
	}
	for i := 0; i < len(params.Validator.PubKeyTypes); i++ {
		keyType := params.Validator.PubKeyTypes[i]
		if _, ok := ABCIPubKeyTypesToAminoNames[keyType]; !ok {
			return errors.Errorf("params.Validator.PubKeyTypes[%d], %s, is an unknown pubkey type",
				i, keyType)
		}
	}
	return nil
}
func ( params * ConsensusParams ) Validate ( ) error { if params . Block . MaxBytes <= 0 { return errors . Errorf ( " " , params . Block . MaxBytes ) } if params . Block . MaxBytes > MaxBlockSizeBytes { return errors . Errorf ( " " , params . Block . MaxBytes , MaxBlockSizeBytes ) } if params . Block . MaxGas < - 1 { return errors . Errorf ( " " , params . Block . MaxGas ) } if params . Block . TimeIotaMs <= 0 { return errors . Errorf ( " " , params . Block . TimeIotaMs ) } if params . Evidence . MaxAge <= 0 { return errors . Errorf ( " " , params . Evidence . MaxAge ) } if len ( params . Validator . PubKeyTypes ) == 0 { return errors . New ( " " ) } for i := 0 ; i < len ( params . Validator . PubKeyTypes ) ; i ++ { keyType := params . Validator . PubKeyTypes [ i ] if _ , ok := ABCIPubKeyTypesToAminoNames [ keyType ] ; ! ok { return errors . Errorf ( " " , i , keyType ) } } return nil }
Validate validates the ConsensusParams to ensure all values are within their
allowed limits, and returns an error if they are not.
Validate validates the ConsensusParams to ensure all values are within their allowed limits and returns an error if they are not .
// Check if keyType is a known ABCIPubKeyType