Cherry-picked commit 9089292.

Prevent creation of accounts with the same name as dividend distribution accounts
This commit is contained in:
Eric Frias 2016-08-30 14:18:21 -04:00 committed by Roman Olearski
parent 90722fc0a4
commit da5ef56a35

View file

@ -23,7 +23,7 @@
*/ */
#include <graphene/chain/protocol/account.hpp> #include <graphene/chain/protocol/account.hpp>
#include <graphene/chain/hardfork.hpp> #include <graphene/chain/hardfork.hpp>
#include <boost/algorithm/string/predicate.hpp>
namespace graphene { namespace chain { namespace graphene { namespace chain {
/** /**
@ -135,6 +135,12 @@ bool is_valid_name( const string& name )
break; break;
begin = end+1; begin = end+1;
} }
// only dividend distribution accounts linked to a dividend asset can end in -dividend-distribution, and
// these can only be created as a side-effect of the asset_update_dividend_operation
if( boost::algorithm::ends_with(name, "-dividend-distribution") )
return false;
return true; return true;
} FC_CAPTURE_AND_RETHROW( (name) ) } } FC_CAPTURE_AND_RETHROW( (name) ) }