提交 43dabac9 编写于 作者: A Anton Perkov

cleos error reporting fix #2846 cleos get account fix #2845

上级 be15fdbd
......@@ -330,14 +330,14 @@ void print_action_tree( const fc::variant& action ) {
void print_result( const fc::variant& result ) { try {
const auto& processed = result["processed"];
const auto& transaction_id = processed["id"].as_string();
const auto& receipt = processed["receipt"].get_object() ;
const auto& status = receipt["status"].as_string() ;
auto net = receipt["net_usage_words"].as_int64()*8;
auto cpu = receipt["kcpu_usage"].as_int64();
//const auto& receipt = processed["receipt"].get_object() ;
string status = processed["receipt"].is_object() ? processed["receipt"]["status"].as_string() : "failed";
auto net = processed["net_usage"].as_int64()*8;
auto cpu = processed["cpu_usage"].as_int64() / 1024;
cerr << status << " transaction: " << transaction_id << " " << net << " bytes " << cpu << "k cycles\n";
if( status == "hard_fail" ) {
if( status == "failed" ) {
auto soft_except = processed["except"].as<optional<fc::exception>>();
if( soft_except ) {
edump((soft_except->to_detail_string()));
......@@ -1171,8 +1171,8 @@ void get_account( const string& accountName, bool json_format ) {
<< indent << "quota: " << std::setw(15) << res.ram_quota << " bytes used: " << std::setw(15) << res.ram_usage << " bytes" << std::endl << std::endl;
std::cout << "net bandwidth:" << std::endl;
if ( res.total_resources.is_object() && res.delegated_bandwidth.is_object() ) {
asset net_own( stoll( res.delegated_bandwidth.get_object()["net_weight"].as_string() ) );
if ( res.total_resources.is_object() ) {
asset net_own( res.delegated_bandwidth.is_object() ? stoll( res.delegated_bandwidth.get_object()["net_weight"].as_string() ) : 0 );
auto net_others = to_asset(res.total_resources.get_object()["net_weight"].as_string()) - net_own;
std::cout << indent << "staked:" << std::setw(20) << net_own
<< std::string(11, ' ') << "(total stake delegated from account to self)" << std::endl
......@@ -1189,8 +1189,8 @@ void get_account( const string& accountName, bool json_format ) {
std::cout << "cpu bandwidth:" << std::endl;
if ( res.total_resources.is_object() && res.delegated_bandwidth.is_object() ) {
asset cpu_own( stoll( res.delegated_bandwidth.get_object()["cpu_weight"].as_string() ) );
if ( res.total_resources.is_object() ) {
asset cpu_own( res.delegated_bandwidth.is_object() ? stoll( res.delegated_bandwidth.get_object()["cpu_weight"].as_string() ) : 0 );
auto cpu_others = to_asset(res.total_resources.get_object()["cpu_weight"].as_string()) - cpu_own;
std::cout << indent << "staked:" << std::setw(20) << cpu_own
<< std::string(11, ' ') << "(total stake delegated from account to self)" << std::endl
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册