Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #7045 from EOSIO/cleos-transaction-trace-fixes-to-1.6
Browse files Browse the repository at this point in the history
print action traces in cleos even if nonmandatory fields are missing - v1.6.x
  • Loading branch information
heifner authored Apr 2, 2019
2 parents 2ff9a34 + 53fca50 commit 82a2c0f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions programs/cleos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,22 +438,25 @@ bytes json_or_file_to_bin( const account_name& account, const action_name& actio

void print_action_tree( const fc::variant& action ) {
print_action( action );
const auto& inline_traces = action["inline_traces"].get_array();
for( const auto& t : inline_traces ) {
print_action_tree( t );
if( action.get_object().contains( "inline_traces" ) ) {
const auto& inline_traces = action["inline_traces"].get_array();
for( const auto& t : inline_traces ) {
print_action_tree( t );
}
}
}

void print_result( const fc::variant& result ) { try {
if (result.is_object() && result.get_object().contains("processed")) {
const auto& processed = result["processed"];
const auto& transaction_id = processed["id"].as_string();
string status = processed["receipt"].is_object() ? processed["receipt"]["status"].as_string() : "failed";
string status = "failed";
int64_t net = -1;
int64_t cpu = -1;
if( processed.get_object().contains( "receipt" )) {
const auto& receipt = processed["receipt"];
if( receipt.is_object()) {
status = receipt["status"].as_string();
net = receipt["net_usage_words"].as_int64() * 8;
cpu = receipt["cpu_usage_us"].as_int64();
}
Expand Down

0 comments on commit 82a2c0f

Please sign in to comment.