config.hpp: Increase GRAPHENE_MIN_ACCOUNT_NAME_LENGTH to 3

Length requirement is enforced by RFC 1035 grammar.  Use a compiler
error to tell anyone changing config.hpp that any value for this
constant smaller than 3 is unsupported by the implementation.
This commit is contained in:
theoreticalbts 2015-07-22 15:01:52 -04:00
parent 085013fbd8
commit 9b6998af6d
2 changed files with 5 additions and 1 deletions

View file

@ -20,7 +20,7 @@
#define GRAPHENE_SYMBOL "CORE"
#define GRAPHENE_ADDRESS_PREFIX "GPH"
#define GRAPHENE_MIN_ACCOUNT_NAME_LENGTH 1
#define GRAPHENE_MIN_ACCOUNT_NAME_LENGTH 3
#define GRAPHENE_MAX_ACCOUNT_NAME_LENGTH 63
#define GRAPHENE_MIN_ASSET_SYMBOL_LENGTH 3

View file

@ -34,6 +34,10 @@ namespace graphene { namespace chain {
*/
bool is_valid_name( const string& name )
{
#if GRAPHENE_MIN_ACCOUNT_NAME_LENGTH < 3
#error This is_valid_name implementation implicitly enforces minimum name length of 3.
#endif
const size_t len = name.size();
if( len < GRAPHENE_MIN_ACCOUNT_NAME_LENGTH )
return false;