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

print action traces in cleos even if nonmandatory fields are missing - v1.6.x #7045

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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