diff options
author | Riccardo Spagni <ric@spagni.net> | 2015-10-15 19:34:51 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2015-10-15 19:34:55 +0200 |
commit | eef5fa446ef76ce19706047c86ebca6dae03d555 (patch) | |
tree | ba09cfb9d40ea1ba3fa3d64e7411eec2193840d0 /src/daemon/rpc_command_executor.cpp | |
parent | Merge pull request #429 (diff) | |
parent | core_rpc_server: add optional json decoded tx to COMMAND_RPC_GET_TRANSACTIONS (diff) | |
download | monero-eef5fa446ef76ce19706047c86ebca6dae03d555.tar.xz |
Merge pull request #431
253ed76 core_rpc_server: add optional json decoded tx to COMMAND_RPC_GET_TRANSACTIONS (moneromooo-monero)
ca23c0e core_rpc_server: add a getblock RPC command, and fix print_block (moneromooo-monero)
Diffstat (limited to 'src/daemon/rpc_command_executor.cpp')
-rw-r--r-- | src/daemon/rpc_command_executor.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp index c4fe642e8..b0fe5945b 100644 --- a/src/daemon/rpc_command_executor.cpp +++ b/src/daemon/rpc_command_executor.cpp @@ -408,8 +408,8 @@ bool t_rpc_command_executor::print_height() { } bool t_rpc_command_executor::print_block_by_hash(crypto::hash block_hash) { - cryptonote::COMMAND_RPC_GET_BLOCK_HEADER_BY_HASH::request req; - cryptonote::COMMAND_RPC_GET_BLOCK_HEADER_BY_HASH::response res; + cryptonote::COMMAND_RPC_GET_BLOCK::request req; + cryptonote::COMMAND_RPC_GET_BLOCK::response res; epee::json_rpc::error error_resp; req.hash = epee::string_tools::pod_to_hex(block_hash); @@ -418,14 +418,14 @@ bool t_rpc_command_executor::print_block_by_hash(crypto::hash block_hash) { if (m_is_rpc) { - if (!m_rpc_client->json_rpc_request(req, res, "getblockheaderbyhash", fail_message.c_str())) + if (!m_rpc_client->json_rpc_request(req, res, "getblock", fail_message.c_str())) { return true; } } else { - if (!m_rpc_server->on_get_block_header_by_hash(req, res, error_resp)) + if (!m_rpc_server->on_get_block(req, res, error_resp)) { tools::fail_msg_writer() << fail_message.c_str(); return true; @@ -433,13 +433,14 @@ bool t_rpc_command_executor::print_block_by_hash(crypto::hash block_hash) { } print_block_header(res.block_header); + tools::success_msg_writer() << res.json << ENDL; return true; } bool t_rpc_command_executor::print_block_by_height(uint64_t height) { - cryptonote::COMMAND_RPC_GET_BLOCK_HEADER_BY_HEIGHT::request req; - cryptonote::COMMAND_RPC_GET_BLOCK_HEADER_BY_HEIGHT::response res; + cryptonote::COMMAND_RPC_GET_BLOCK::request req; + cryptonote::COMMAND_RPC_GET_BLOCK::response res; epee::json_rpc::error error_resp; req.height = height; @@ -448,14 +449,14 @@ bool t_rpc_command_executor::print_block_by_height(uint64_t height) { if (m_is_rpc) { - if (!m_rpc_client->json_rpc_request(req, res, "getblockheaderbyheight", fail_message.c_str())) + if (!m_rpc_client->json_rpc_request(req, res, "getblock", fail_message.c_str())) { return true; } } else { - if (!m_rpc_server->on_get_block_header_by_height(req, res, error_resp)) + if (!m_rpc_server->on_get_block(req, res, error_resp)) { tools::fail_msg_writer() << fail_message.c_str(); return true; @@ -463,6 +464,7 @@ bool t_rpc_command_executor::print_block_by_height(uint64_t height) { } print_block_header(res.block_header); + tools::success_msg_writer() << res.json << ENDL; return true; } |