提交 317e036c 编写于 作者: A Anton Perkov

fixes after code-review #2661

上级 f192300f
...@@ -27,9 +27,9 @@ namespace eosio { namespace chain { namespace resource_limits { ...@@ -27,9 +27,9 @@ namespace eosio { namespace chain { namespace resource_limits {
}; };
struct account_resource_limit { struct account_resource_limit {
int64_t current_per_block; int64_t current_per_block = 0;
int64_t max_per_block; int64_t max_per_block = 0;
int64_t guaranteed_per_day; int64_t guaranteed_per_day = 0;
}; };
class resource_limits_manager { class resource_limits_manager {
......
...@@ -95,7 +95,7 @@ public: ...@@ -95,7 +95,7 @@ public:
account_resource_limit net_limit; account_resource_limit net_limit;
account_resource_limit cpu_limit; account_resource_limit cpu_limit;
int64_t ram_usage; int64_t ram_usage = 0;
vector<permission> permissions; vector<permission> permissions;
......
...@@ -689,7 +689,7 @@ struct create_account_subcommand { ...@@ -689,7 +689,7 @@ struct create_account_subcommand {
bool simple; bool simple;
create_account_subcommand(CLI::App* actionRoot, bool s) : simple(s) { create_account_subcommand(CLI::App* actionRoot, bool s) : simple(s) {
auto createAccount = actionRoot->add_subcommand( (simple ? "account" : "createaccount"), localized("Create an account, buy ram, stake for bandwidth for the account")); auto createAccount = actionRoot->add_subcommand( (simple ? "account" : "newaccount"), localized("Create an account, buy ram, stake for bandwidth for the account"));
createAccount->add_option("creator", creator, localized("The name of the account creating the new account"))->required(); createAccount->add_option("creator", creator, localized("The name of the account creating the new account"))->required();
createAccount->add_option("name", account_name, localized("The name of the new account"))->required(); createAccount->add_option("name", account_name, localized("The name of the new account"))->required();
createAccount->add_option("OwnerKey", owner_key_str, localized("The owner public key for the new account"))->required(); createAccount->add_option("OwnerKey", owner_key_str, localized("The owner public key for the new account"))->required();
...@@ -1012,13 +1012,16 @@ void get_account( const string& accountName ) { ...@@ -1012,13 +1012,16 @@ void get_account( const string& accountName ) {
} }
auto name = perm.perm_name; //keep copy before moving `perm`, since thirst argument of emplace can be evaluated first auto name = perm.perm_name; //keep copy before moving `perm`, since thirst argument of emplace can be evaluated first
// looks a little crazy, but should be efficient // looks a little crazy, but should be efficient
cache.emplace(std::piecewise_construct, std::forward_as_tuple(name), std::forward_as_tuple(std::move(perm)) ); cache.insert( std::make_pair(name, std::move(perm)) );
} }
std::function<void (account_name, int)> dfs_print = [&]( account_name name, int depth ) -> void { std::function<void (account_name, int)> dfs_print = [&]( account_name name, int depth ) -> void {
auto& p = cache.at(name); auto& p = cache.at(name);
std::cout << indent << std::string(depth*3, ' ') << name << ' ' << std::setw(5) << p.required_auth.threshold << ": "; std::cout << indent << std::string(depth*3, ' ') << name << ' ' << std::setw(5) << p.required_auth.threshold << ": ";
for ( auto& key : p.required_auth.keys ) { for ( auto it = p.required_auth.keys.begin(); it != p.required_auth.keys.end(); ++it ) {
std::cout << key.weight << ' ' << string(key.key) << ", "; if ( it != p.required_auth.keys.begin() ) {
std::cout << ", ";
}
std::cout << it->weight << ' ' << string(it->key);
} }
for ( auto& acc : p.required_auth.accounts ) { for ( auto& acc : p.required_auth.accounts ) {
std::cout << acc.weight << ' ' << string(acc.permission.actor) << '@' << string(acc.permission.permission) << ", "; std::cout << acc.weight << ' ' << string(acc.permission.actor) << '@' << string(acc.permission.permission) << ", ";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册