diff --git a/modules/chain/dap_chain.c b/modules/chain/dap_chain.c index bf81b508e04906f091429f44ea332ef9b5b50ee4..ccbbf22ad141985b72338dd09d6b58eb8b407823 100644 --- a/modules/chain/dap_chain.c +++ b/modules/chain/dap_chain.c @@ -200,6 +200,9 @@ static dap_chain_type_t s_chain_type_from_str(const char *a_type_str) if(!dap_strcmp(a_type_str, "transaction")) { return CHAIN_TYPE_TX; } + if(!dap_strcmp(a_type_str, "ca")) { + return CHAIN_TYPE_CA; + } return CHAIN_TYPE_LAST; } diff --git a/modules/chain/include/dap_chain.h b/modules/chain/include/dap_chain.h index ed25e99e7a4e96db0417ecefa426eb8c4e18ae85..4ed1a66426ed17316e8bae94cdb58adc4f0bfef4 100644 --- a/modules/chain/include/dap_chain.h +++ b/modules/chain/include/dap_chain.h @@ -91,6 +91,7 @@ typedef enum dap_chain_type CHAIN_TYPE_TOKEN, CHAIN_TYPE_EMISSION, CHAIN_TYPE_TX, + CHAIN_TYPE_CA, CHAIN_TYPE_LAST } dap_chain_type_t; diff --git a/modules/net/dap_chain_node_cli_cmd.c b/modules/net/dap_chain_node_cli_cmd.c index 850dcd100476ad7431ad45fbb6db2b03d84bf6ee..57c1acbc2c1fe0bf2597462c17b6bb7a5f94efa1 100644 --- a/modules/net/dap_chain_node_cli_cmd.c +++ b/modules/net/dap_chain_node_cli_cmd.c @@ -3518,8 +3518,13 @@ int com_mempool_add_ca( int a_argc, char ** a_argv, void *a_arg_func, char ** a // Chech for chain if was set or not if ( l_chain == NULL){ // If wasn't set - trying to auto detect - l_chain = dap_chain_net_get_chain_by_chain_type( l_net, DAP_CHAIN_DATUM_CA ); + l_chain = dap_chain_net_get_chain_by_chain_type( l_net, CHAIN_TYPE_CA ); if (l_chain == NULL) { // If can't auto detect + // clean previous error code + if(a_str_reply && *a_str_reply) { + DAP_DELETE(*a_str_reply); + *a_str_reply = NULL; + } dap_chain_node_cli_set_reply_text(a_str_reply, "No chains for CA datum in network \"%s\"", l_net->pub.name ); return -2;