Merge pull request #5019

65ce387c daemon: add a +hex option to print_block (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2019-01-16 21:36:08 +02:00
commit 17878369f9
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
3 changed files with 23 additions and 7 deletions

View file

@ -663,7 +663,7 @@ bool t_rpc_command_executor::print_height() {
return true;
}
bool t_rpc_command_executor::print_block_by_hash(crypto::hash block_hash) {
bool t_rpc_command_executor::print_block_by_hash(crypto::hash block_hash, bool include_hex) {
cryptonote::COMMAND_RPC_GET_BLOCK::request req;
cryptonote::COMMAND_RPC_GET_BLOCK::response res;
epee::json_rpc::error error_resp;
@ -689,13 +689,15 @@ bool t_rpc_command_executor::print_block_by_hash(crypto::hash block_hash) {
}
}
if (include_hex)
tools::success_msg_writer() << res.blob << std::endl;
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) {
bool t_rpc_command_executor::print_block_by_height(uint64_t height, bool include_hex) {
cryptonote::COMMAND_RPC_GET_BLOCK::request req;
cryptonote::COMMAND_RPC_GET_BLOCK::response res;
epee::json_rpc::error error_resp;
@ -721,6 +723,8 @@ bool t_rpc_command_executor::print_block_by_height(uint64_t height) {
}
}
if (include_hex)
tools::success_msg_writer() << res.blob << std::endl;
print_block_header(res.block_header);
tools::success_msg_writer() << res.json << ENDL;