From 1d678b1ee286b07fbe3904e5f282354b4ffc3810 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 9 Aug 2015 15:47:40 +0100 Subject: daemon: fix print_tx not find transactions It was not even trying to --- src/daemon/rpc_command_executor.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp index 4ba9a5f32..96f55ac25 100644 --- a/src/daemon/rpc_command_executor.cpp +++ b/src/daemon/rpc_command_executor.cpp @@ -482,6 +482,7 @@ bool t_rpc_command_executor::print_transaction(crypto::hash transaction_hash) { } else { + req.txs_hashes.push_back(epee::string_tools::pod_to_hex(transaction_hash)); if (!m_rpc_server->on_get_transactions(req, res)) { tools::fail_msg_writer() << fail_message.c_str(); -- cgit v1.2.3 From 08229335240e33acc848fa88da1c16e29df2b209 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 9 Aug 2015 16:24:18 +0100 Subject: daemon: print a decoded tx in print_tx in addition to the raw hex representation --- src/daemon/rpc_command_executor.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp index 96f55ac25..b9ef3513c 100644 --- a/src/daemon/rpc_command_executor.cpp +++ b/src/daemon/rpc_command_executor.cpp @@ -492,7 +492,25 @@ bool t_rpc_command_executor::print_transaction(crypto::hash transaction_hash) { if (1 == res.txs_as_hex.size()) { + // first as hex tools::success_msg_writer() << res.txs_as_hex.front(); + + // then as json + crypto::hash tx_hash, tx_prefix_hash; + cryptonote::transaction tx; + cryptonote::blobdata blob; + if (!string_tools::parse_hexstr_to_binbuff(res.txs_as_hex.front(), blob)) + { + tools::fail_msg_writer() << "Failed to parse tx"; + } + else if (!cryptonote::parse_and_validate_tx_from_blob(blob, tx, tx_hash, tx_prefix_hash)) + { + tools::fail_msg_writer() << "Failed to parse tx blob"; + } + else + { + tools::success_msg_writer() << cryptonote::obj_to_json_str(tx) << std::endl; + } } else { -- cgit v1.2.3 From 263430786312343cd4b8e2389ebade9f4dd3206a Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 9 Aug 2015 16:28:13 +0100 Subject: daemon: omit extra set of <> in error message The string conversion already adds them --- src/daemon/rpc_command_executor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp index b9ef3513c..2f3a6b4d5 100644 --- a/src/daemon/rpc_command_executor.cpp +++ b/src/daemon/rpc_command_executor.cpp @@ -514,7 +514,7 @@ bool t_rpc_command_executor::print_transaction(crypto::hash transaction_hash) { } else { - tools::fail_msg_writer() << "transaction wasn't found: <" << transaction_hash << '>' << std::endl; + tools::fail_msg_writer() << "transaction wasn't found: " << transaction_hash << std::endl; } return true; -- cgit v1.2.3