diff --git a/modules/common/dap_chain_datum.c b/modules/common/dap_chain_datum.c index 558c9f504d2fb9c22f79e949241d3a9c020a158d..f0ac122c4eb9da05f548cfda3839cbd4f29c9d58 100644 --- a/modules/common/dap_chain_datum.c +++ b/modules/common/dap_chain_datum.c @@ -805,8 +805,8 @@ bool dap_chain_datum_dump_tx_json(dap_chain_datum_tx_t *a_datum, json_object_object_add(json_obj_item,"Changing vote is", l_voting_params->vote_changing_allowed ? json_object_new_string("available") : json_object_new_string("not available")); l_voting_params->delegate_key_required ? - json_object_object_add(json_obj_item,"Votes max count", json_object_new_string("A delegated key is required to participate in voting.")): - json_object_object_add(json_obj_item,"Votes max count", json_object_new_string("A delegated key is not required to participate in voting.")); + json_object_object_add(json_obj_item,"Delegated key for participating in voting", json_object_new_string("required")): + json_object_object_add(json_obj_item,"Delegated key for participating in voting", json_object_new_string("not required")); dap_list_free_full(l_voting_params->answers_list, NULL); DAP_DELETE(l_voting_params->voting_question); diff --git a/modules/service/voting/dap_chain_net_srv_voting.c b/modules/service/voting/dap_chain_net_srv_voting.c index 0611998fd40651765a993312a25207b48a6e802a..f4805ddea2990db7754c5cc1559c165cf35396fb 100644 --- a/modules/service/voting/dap_chain_net_srv_voting.c +++ b/modules/service/voting/dap_chain_net_srv_voting.c @@ -699,6 +699,10 @@ static int s_cli_voting(int a_argc, char **a_argv, void **a_str_reply) dap_time_t l_time_expire = 0; if (l_voting_expire_str) l_time_expire = dap_time_from_str_rfc822(l_voting_expire_str); + if(!l_time_expire){ + dap_cli_server_cmd_set_reply_text(a_str_reply, "Wrong time format. -expire parameter must be in format \"Day Month Year HH:MM:SS Timezone\" e.g. \"19 August 2024 22:00:00 +00\""); + return -104; + } uint64_t l_max_count = 0; if (l_max_votes_count_str) l_max_count = strtoul(l_max_votes_count_str, NULL, 10); @@ -873,6 +877,9 @@ static int s_cli_voting(int a_argc, char **a_argv, void **a_str_reply) case DAP_CHAIN_NET_VOTE_VOTING_NO_KEY_FOUND_IN_CERT: { dap_cli_server_cmd_set_reply_text(a_str_reply, "No key found in \"%s\" certificate", l_cert_name); } break; + case DAP_CHAIN_NET_VOTE_VOTING_CERT_REQUIRED: { + dap_cli_server_cmd_set_reply_text(a_str_reply, "This voting required a delegated key. Parameter -cert must contain a valid certificate name"); + } break; case DAP_CHAIN_NET_VOTE_VOTING_NO_PUBLIC_KEY_IN_CERT: { dap_cli_server_cmd_set_reply_text(a_str_reply, "Can't serialize public key of certificate \"%s\"", l_cert_name); @@ -1003,7 +1010,7 @@ static int s_cli_voting(int a_argc, char **a_argv, void **a_str_reply) char l_tmp_buf[DAP_TIME_STR_SIZE]; dap_time_t l_expire = *(dap_time_t*)((byte_t*)l_voting->voting_params.voting_tx + l_voting->voting_params.voting_expire_offset); dap_time_to_str_rfc822(l_tmp_buf, DAP_TIME_STR_SIZE, l_expire); - dap_string_append_printf(l_str_out, "\t Voting expire: %s", l_tmp_buf); + dap_string_append_printf(l_str_out, "\t Voting expire: %s \n", l_tmp_buf); dap_string_truncate(l_str_out, l_str_out->len - 1); dap_string_append_printf(l_str_out, " (%s)\n", l_expire > dap_time_now() ? "active" : "expired"); } @@ -1434,7 +1441,9 @@ int dap_chain_net_vote_voting(dap_cert_t *a_cert, uint256_t a_fee, dap_chain_wal if(l_voting->voting_params.delegate_key_required_offset && *(bool*)((byte_t*)l_voting->voting_params.voting_tx + l_voting->voting_params.delegate_key_required_offset) ){ - if (!a_cert) {} else { + if (!a_cert) { + return DAP_CHAIN_NET_VOTE_VOTING_CERT_REQUIRED; + } else { if (a_cert->enc_key == NULL) { return DAP_CHAIN_NET_VOTE_VOTING_NO_KEY_FOUND_IN_CERT; } diff --git a/modules/service/voting/include/dap_chain_net_srv_voting.h b/modules/service/voting/include/dap_chain_net_srv_voting.h index 94f458d2145adffea685716a5f7e49b8147bf4bc..6fcf2f9a45bb1d02cf2bf3b2d53b4beb2799dac0 100644 --- a/modules/service/voting/include/dap_chain_net_srv_voting.h +++ b/modules/service/voting/include/dap_chain_net_srv_voting.h @@ -98,6 +98,7 @@ enum DAP_CHAIN_NET_VOTE_VOTING_ERROR{ DAP_CHAIN_NET_VOTE_VOTING_ALREADY_EXPIRED, DAP_CHAIN_NET_VOTE_VOTING_NO_KEY_FOUND_IN_CERT, DAP_CHAIN_NET_VOTE_VOTING_NO_PUBLIC_KEY_IN_CERT, + DAP_CHAIN_NET_VOTE_VOTING_CERT_REQUIRED, DAP_CHAIN_NET_VOTE_VOTING_KEY_IS_NOT_DELEGATED, DAP_CHAIN_NET_VOTE_VOTING_DOES_NOT_ALLOW_CHANGE_YOUR_VOTE, DAP_CHAIN_NET_VOTE_VOTING_SOURCE_ADDRESS_INVALID, diff --git a/modules/service/xchange/dap_chain_net_srv_xchange.c b/modules/service/xchange/dap_chain_net_srv_xchange.c index 55b491adc60323e7a8c0781ef31e89a81b64243c..87efb2f7871551493bc7f18ef8d1d3d9e29b89c3 100644 --- a/modules/service/xchange/dap_chain_net_srv_xchange.c +++ b/modules/service/xchange/dap_chain_net_srv_xchange.c @@ -164,7 +164,7 @@ int dap_chain_net_srv_xchange_init() "srv_xchange tx_list -net <net_name> [-time_from <From_time>] [-time_to <To_time>]" "[[-addr <wallet_addr> [-status {inactive|active|all}] ]\n" /* @RRL: #6294 */ "\tList of exchange transactions\n" - "\tAll times are in RFC822. For example: \"Thu, 7 Dec 2023 21:18:04\"\n" + "\tAll times are in RFC822. For example: \"7 Dec 2023 21:18:04\"\n" "srv_xchange token_pair -net <net_name> list all [-limit <limit>] [-offset <offset>]\n" "\tList of all token pairs\n" @@ -172,7 +172,7 @@ int dap_chain_net_srv_xchange_init() "\tGet average rate for token pair <token from>:<token to> from <From time> to <To time> \n" "srv_xchange token_pair -net <net_name> rate history -token_from <token_ticker> -token_to <token_ticker> [-time_from <From_time>] [-time_to <To_time>] [-limit <limit>] [-offset <offset>]\n" "\tPrint rate history for token pair <token from>:<token to> from <From time> to <To time>\n" - "\tAll times are in RFC822. For example: \"Thu, 7 Dec 2023 21:18:04\"\n" + "\tAll times are in RFC822. For example: \"T7 Dec 2023 21:18:04\"\n" "srv_xchange enable\n" "\tEnable eXchange service\n"