Skip to content

Commit

Permalink
Check for default transaction id which is possible if file/string doe…
Browse files Browse the repository at this point in the history
…s not actually contain a transaction
  • Loading branch information
heifner committed Feb 25, 2019
1 parent 8442569 commit ad6bdf8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion programs/cleos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,12 @@ struct get_transaction_id_subcommand {
try {
auto trx_var = json_from_file_or_string(trx_to_check);
auto trx = trx_var.as<transaction>();
std::cout << string(trx.id()) << std::endl;
transaction_id_type id = trx.id();
if( id == transaction().id() ) {
std::cerr << "file/string does not represent a transaction" << std::endl;
} else {
std::cout << string( id ) << std::endl;
}
} EOS_RETHROW_EXCEPTIONS(transaction_type_exception, "Fail to parse transaction JSON '${data}'", ("data",trx_to_check))
});
}
Expand Down

0 comments on commit ad6bdf8

Please sign in to comment.