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:
parent
085013fbd8
commit
9b6998af6d
2 changed files with 5 additions and 1 deletions
|
|
@ -20,7 +20,7 @@
|
||||||
#define GRAPHENE_SYMBOL "CORE"
|
#define GRAPHENE_SYMBOL "CORE"
|
||||||
#define GRAPHENE_ADDRESS_PREFIX "GPH"
|
#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_MAX_ACCOUNT_NAME_LENGTH 63
|
||||||
|
|
||||||
#define GRAPHENE_MIN_ASSET_SYMBOL_LENGTH 3
|
#define GRAPHENE_MIN_ASSET_SYMBOL_LENGTH 3
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,10 @@ namespace graphene { namespace chain {
|
||||||
*/
|
*/
|
||||||
bool is_valid_name( const string& name )
|
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();
|
const size_t len = name.size();
|
||||||
if( len < GRAPHENE_MIN_ACCOUNT_NAME_LENGTH )
|
if( len < GRAPHENE_MIN_ACCOUNT_NAME_LENGTH )
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue