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

Commit

Permalink
update cleos to support new transaction trace structure without inlin…
Browse files Browse the repository at this point in the history
…e_traces #6897

Also correct state history ABI for action_trace_v0 to reflect that 
inline_traces are no longer included.
  • Loading branch information
arhag committed Apr 1, 2019
1 parent 943522e commit 28377ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 0 additions & 1 deletion plugins/state_history_plugin/state_history_plugin_abi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ extern const char* const state_history_plugin_abi = R"({
{ "name": "console", "type": "string" },
{ "name": "account_ram_deltas", "type": "account_delta[]" },
{ "name": "except", "type": "string?" },
{ "name": "inline_traces", "type": "action_trace[]" }
]
},
{
Expand Down
11 changes: 7 additions & 4 deletions programs/cleos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,22 +443,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 28377ed

Please sign in to comment.