提交 00eb7091 编写于 作者: A Anton Perkov

allow eosio to create accounts with names shorter than 12 symbols #3136

上级 7bce267c
...@@ -98,10 +98,9 @@ namespace eosiosystem { ...@@ -98,10 +98,9 @@ namespace eosiosystem {
const authority& owner, const authority& owner,
const authority& active*/ ) { const authority& active*/ ) {
auto name_str = eosio::name{newact}.to_string(); auto name_str = eosio::name{newact}.to_string();
eosio::print( eosio::name{creator}, " created ", eosio::name{newact}, "\n");
eosio_assert( name_str.size() == 12, "account names must be 12 chars long" ); eosio_assert( name_str.size() == 12 || creator == N(eosio), "account names must be 12 chars long" );
eosio_assert( name_str.find_first_of('.') == std::string::npos, "account names cannot contain '.' character"); eosio_assert( name_str.find_first_of('.') == std::string::npos || creator == N(eosio), "account names cannot contain '.' character");
user_resources_table userres( _self, newact); user_resources_table userres( _self, newact);
...@@ -123,7 +122,6 @@ namespace eosiosystem { ...@@ -123,7 +122,6 @@ namespace eosiosystem {
auto itr = _rammarket.find(S(4,RAMEOS)); auto itr = _rammarket.find(S(4,RAMEOS));
auto tmp = *itr; auto tmp = *itr;
auto eosout = tmp.convert( asset(bytes,S(0,RAM)), S(4,EOS) ); auto eosout = tmp.convert( asset(bytes,S(0,RAM)), S(4,EOS) );
print( "eosout: ", eosout, " ", tmp.base.balance, " ", tmp.quote.balance, "\n" );
buyram( payer, receiver, eosout ); buyram( payer, receiver, eosout );
} }
...@@ -139,7 +137,6 @@ namespace eosiosystem { ...@@ -139,7 +137,6 @@ namespace eosiosystem {
*/ */
void system_contract::buyram( account_name payer, account_name receiver, asset quant ) void system_contract::buyram( account_name payer, account_name receiver, asset quant )
{ {
// print( "\n payer: ", eosio::name{payer}, " buys ram for ", eosio::name{receiver}, " with ", quant, "\n" );
require_auth( payer ); require_auth( payer );
eosio_assert( quant.amount > 0, "must purchase a positive amount" ); eosio_assert( quant.amount > 0, "must purchase a positive amount" );
...@@ -148,7 +145,6 @@ namespace eosiosystem { ...@@ -148,7 +145,6 @@ namespace eosiosystem {
{ payer, N(eosio), quant, std::string("buy ram") } ); { payer, N(eosio), quant, std::string("buy ram") } );
} }
// print( "free ram: ", _gstate.free_ram(), "\n");
int64_t bytes_out; int64_t bytes_out;
...@@ -157,7 +153,6 @@ namespace eosiosystem { ...@@ -157,7 +153,6 @@ namespace eosiosystem {
bytes_out = es.convert( quant, S(0,RAM) ).amount; bytes_out = es.convert( quant, S(0,RAM) ).amount;
}); });
// print( "ram bytes out: ", bytes_out, "\n" );
eosio_assert( bytes_out > 0, "must reserve a positive amount" ); eosio_assert( bytes_out > 0, "must reserve a positive amount" );
...@@ -199,7 +194,6 @@ namespace eosiosystem { ...@@ -199,7 +194,6 @@ namespace eosiosystem {
_rammarket.modify( itr, 0, [&]( auto& es ) { _rammarket.modify( itr, 0, [&]( auto& es ) {
/// the cast to int64_t of bytes is safe because we certify bytes is <= quota which is limited by prior purchases /// the cast to int64_t of bytes is safe because we certify bytes is <= quota which is limited by prior purchases
tokens_out = es.convert( asset(bytes,S(0,RAM)), S(4,EOS) ); tokens_out = es.convert( asset(bytes,S(0,RAM)), S(4,EOS) );
// print( "out: ", tokens_out, "\n" );
}); });
_gstate.total_ram_bytes_reserved -= bytes; _gstate.total_ram_bytes_reserved -= bytes;
...@@ -225,7 +219,6 @@ namespace eosiosystem { ...@@ -225,7 +219,6 @@ namespace eosiosystem {
{ {
require_auth( from ); require_auth( from );
// print( "from: ", eosio::name{from}, " to: ", eosio::name{receiver}, " net: ", stake_net_quantity, " cpu: ", stake_cpu_quantity );
eosio_assert( stake_cpu_quantity >= asset(0), "must stake a positive amount" ); eosio_assert( stake_cpu_quantity >= asset(0), "must stake a positive amount" );
eosio_assert( stake_net_quantity >= asset(0), "must stake a positive amount" ); eosio_assert( stake_net_quantity >= asset(0), "must stake a positive amount" );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册