From c77dc61e51aa81e50f0b2a85df97bb6cd237a1f4 Mon Sep 17 00:00:00 2001 From: "roman.padenkov" <roman.padenkov@demlabs.net> Date: Thu, 30 May 2024 20:23:22 +0700 Subject: [PATCH] changed block hash out to hex format --- modules/type/blocks/dap_chain_cs_blocks.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/type/blocks/dap_chain_cs_blocks.c b/modules/type/blocks/dap_chain_cs_blocks.c index 7c896439d3..cdbc3214a5 100644 --- a/modules/type/blocks/dap_chain_cs_blocks.c +++ b/modules/type/blocks/dap_chain_cs_blocks.c @@ -663,7 +663,15 @@ static int s_cli_blocks(int a_argc, char ** a_argv, void **a_str_reply) }break; case SUBCMD_DUMP:{ + const char *l_hash_out_type = NULL; dap_chain_hash_fast_t l_block_hash={0}; + dap_cli_server_cmd_find_option_val(a_argv, arg_index, a_argc, "-H", &l_hash_out_type); + if(!l_hash_out_type) + l_hash_out_type = "hex"; + if(dap_strcmp(l_hash_out_type,"hex") && dap_strcmp(l_hash_out_type,"base58")) { + dap_json_rpc_error_add(DAP_CHAIN_NODE_CLI_COM_BLOCK_PARAM_ERR, "invalid parameter -H, valid values: -H <hex | base58>"); + return DAP_CHAIN_NODE_CLI_COM_BLOCK_PARAM_ERR; + } if (!l_subcmd_str_arg) { dap_json_rpc_error_add(DAP_CHAIN_NODE_CLI_COM_BLOCK_HASH_ERR, "Enter block hash "); return DAP_CHAIN_NODE_CLI_COM_BLOCK_HASH_ERR; -- GitLab