diff --git a/dap-sdk b/dap-sdk index 89400bc2340111a11ed7895a30983dffc875d488..f0560a37ddece95c816d47ca0ae20eea9da800ad 160000 --- a/dap-sdk +++ b/dap-sdk @@ -1 +1 @@ -Subproject commit 89400bc2340111a11ed7895a30983dffc875d488 +Subproject commit f0560a37ddece95c816d47ca0ae20eea9da800ad diff --git a/modules/mempool/dap_chain_mempool.c b/modules/mempool/dap_chain_mempool.c index 89bb0963226ffacf4d4bff133a59841a5612f69a..acb6fb08b087dc1839c33010b1554540d4f99bc5 100644 --- a/modules/mempool/dap_chain_mempool.c +++ b/modules/mempool/dap_chain_mempool.c @@ -143,7 +143,7 @@ char *dap_chain_mempool_datum_add(const dap_chain_datum_t *a_datum, dap_chain_t * return 0 Ok, -2 not enough funds to transfer, -1 other Error */ char *dap_chain_mempool_tx_create(dap_chain_t *a_chain, dap_enc_key_t *a_key_from, - const dap_chain_addr_t* a_addr_from, dap_chain_addr_t *const *a_addr_to, + const dap_chain_addr_t* a_addr_from, const dap_chain_addr_t **a_addr_to, const char a_token_ticker[DAP_CHAIN_TICKER_SIZE_MAX], uint256_t *a_value, uint256_t a_value_fee, const char *a_hash_out_type, size_t a_tx_num) { diff --git a/modules/mempool/include/dap_chain_mempool.h b/modules/mempool/include/dap_chain_mempool.h index 6c7fe2c3e8a03f45c043401233b5d7cf3d5b6291..d58afe184dca504a3041f0092b2ec50059ee6cb4 100644 --- a/modules/mempool/include/dap_chain_mempool.h +++ b/modules/mempool/include/dap_chain_mempool.h @@ -71,7 +71,7 @@ void dap_chain_mempool_filter(dap_chain_t *a_chain, int *a_removed); char *dap_chain_mempool_datum_add(const dap_chain_datum_t *a_datum, dap_chain_t *a_chain, const char *a_hash_out_type); char *dap_chain_mempool_tx_create(dap_chain_t *a_chain, dap_enc_key_t *a_key_from, - const dap_chain_addr_t *a_addr_from, dap_chain_addr_t *const *a_addr_to, + const dap_chain_addr_t *a_addr_from, const dap_chain_addr_t **a_addr_to, const char a_token_ticker[DAP_CHAIN_TICKER_SIZE_MAX], uint256_t* a_value, uint256_t a_value_fee, const char *a_hash_out_type, size_t a_tx_num); diff --git a/modules/net/dap_chain_node.c b/modules/net/dap_chain_node.c index b05535667c05647b751593666bd44a30e749c3d2..cd610ee0fa654eebb95d03dd3e1fcd081b8aeaec 100644 --- a/modules/net/dap_chain_node.c +++ b/modules/net/dap_chain_node.c @@ -242,7 +242,7 @@ void dap_chain_node_list_cluster_del_callback(dap_store_obj_t *a_obj, void *a_ar dap_global_db_set_sync(a_obj->group, a_obj->key, a_obj->value, a_obj->value_len, a_obj->flags & DAP_GLOBAL_DB_RECORD_PINNED); } else { log_it(L_DEBUG, "Can't do handshake with %s [ %s : %u ] delete from node list", a_obj->key, l_node_info->ext_host, l_node_info->ext_port); - dap_del_global_db_obj_by_ttl(a_obj); + dap_global_db_driver_delete(a_obj, 1); } dap_strfreev(l_group_strings); } diff --git a/modules/node-cli/dap_chain_node_cli_cmd.c b/modules/node-cli/dap_chain_node_cli_cmd.c index c0088704db4168f28b9b662b6837e043e3047c69..cd17255678bc5f16e7e2cf3107fe3684e989a36d 100644 --- a/modules/node-cli/dap_chain_node_cli_cmd.c +++ b/modules/node-cli/dap_chain_node_cli_cmd.c @@ -292,10 +292,10 @@ static int s_node_info_list_with_reply(dap_chain_net_t *a_net, dap_chain_node_ad return -DAP_CHAIN_NODE_CLI_COM_NODE_LIST_NO_RECORDS_ERR; } else { json_object* json_node_list_obj = json_object_new_object(); - if (!json_node_list_obj) return dap_json_rpc_allocation_put(json_node_list_obj),DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; + if (!json_node_list_obj) return json_object_put(json_node_list_obj), DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; json_object_object_add(json_node_list_obj, "got_nodes", json_object_new_uint64(l_nodes_count)); json_object* json_node_list_arr = json_object_new_array(); - if (!json_node_list_arr) return dap_json_rpc_allocation_put(json_node_list_obj),DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; + if (!json_node_list_arr) return json_object_put(json_node_list_obj), DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; json_object_object_add(json_node_list_obj, "NODES", json_node_list_arr); json_object_array_add(a_json_arr_reply, json_node_list_obj); @@ -306,7 +306,7 @@ static int s_node_info_list_with_reply(dap_chain_net_t *a_net, dap_chain_node_ad continue; } json_object* json_node_obj = json_object_new_object(); - if (!json_node_obj) return dap_json_rpc_allocation_put(json_node_list_obj),DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; + if (!json_node_obj) return json_object_put(json_node_list_obj), DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; char l_ts[DAP_TIME_STR_SIZE] = { '\0' }; dap_nanotime_to_str_rfc822(l_ts, sizeof(l_ts), l_objs[i].timestamp); @@ -968,7 +968,7 @@ int com_node(int a_argc, char ** a_argv, void **a_str_reply) "Can't add node %s, error %d", l_addr_str, l_res); } else { json_object* json_obj_out = json_object_new_object(); - if (!json_obj_out) return dap_json_rpc_allocation_put(json_obj_out),DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; + if (!json_obj_out) return json_object_put(json_obj_out), DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; json_object_object_add(json_obj_out, "successfully_added_node", json_object_new_string(l_addr_str)); json_object_array_add(*a_json_arr_reply, json_obj_out); } @@ -998,7 +998,7 @@ int com_node(int a_argc, char ** a_argv, void **a_str_reply) { case 1: json_obj_out = json_object_new_object(); - if (!json_obj_out) return dap_json_rpc_allocation_put(json_obj_out),DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; + if (!json_obj_out) return json_object_put(json_obj_out), DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; json_object_object_add(json_obj_out, "status", json_object_new_string("Successfully added")); json_object_array_add(*a_json_arr_reply, json_obj_out); return DAP_CHAIN_NODE_CLI_COM_NODE_OK; @@ -1034,7 +1034,7 @@ int com_node(int a_argc, char ** a_argv, void **a_str_reply) "Can't delete node %s, error %d", l_addr_str, l_res); else { json_object* json_obj_out = json_object_new_object(); - if (!json_obj_out) return dap_json_rpc_allocation_put(json_obj_out),DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; + if (!json_obj_out) return json_object_put(json_obj_out), DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; json_object_object_add(json_obj_out, "successfully_deleted_node", json_object_new_string(l_addr_str)); json_object_array_add(*a_json_arr_reply, json_obj_out); } @@ -1046,7 +1046,7 @@ int com_node(int a_argc, char ** a_argv, void **a_str_reply) switch (l_res) { case 8: json_obj_out = json_object_new_object(); - if (!json_obj_out) return dap_json_rpc_allocation_put(json_obj_out),DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; + if (!json_obj_out) return json_object_put(json_obj_out), DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; json_object_object_add(json_obj_out, "status", json_object_new_string("Successfully deleted")); json_object_array_add(*a_json_arr_reply, json_obj_out); return DAP_CHAIN_NODE_CLI_COM_NODE_OK; @@ -1063,7 +1063,7 @@ int com_node(int a_argc, char ** a_argv, void **a_str_reply) } case CMD_DUMP: { json_object* json_obj_out = json_object_new_object(); - if (!json_obj_out) return dap_json_rpc_allocation_put(json_obj_out),DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; + if (!json_obj_out) return json_object_put(json_obj_out), DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; dap_string_t *l_string_reply = dap_chain_node_states_info_read(l_net, l_node_info->address); json_object_object_add(json_obj_out, "status_dump", json_object_new_string(l_string_reply->str)); json_object_array_add(*a_json_arr_reply, json_obj_out); @@ -1079,7 +1079,7 @@ int com_node(int a_argc, char ** a_argv, void **a_str_reply) log_it(L_WARNING, "can't save alias %s", alias_str); else { json_object* json_obj_out = json_object_new_object(); - if (!json_obj_out) return dap_json_rpc_allocation_put(json_obj_out),DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; + if (!json_obj_out) return json_object_put(json_obj_out), DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; json_object_object_add(json_obj_out, "status_alias", json_object_new_string("alias mapped successfully")); json_object_array_add(*a_json_arr_reply, json_obj_out); } @@ -1330,7 +1330,7 @@ int com_node(int a_argc, char ** a_argv, void **a_str_reply) DAP_DELETE(node_info); dap_chain_node_client_close_unsafe(l_client); json_object* json_obj_out = json_object_new_object(); - if (!json_obj_out) return dap_json_rpc_allocation_put(json_obj_out),DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; + if (!json_obj_out) return json_object_put(json_obj_out), DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; json_object_object_add(json_obj_out, "status_handshake", json_object_new_string("Connection established")); json_object_array_add(*a_json_arr_reply, json_obj_out); } break; @@ -1432,7 +1432,7 @@ int com_node(int a_argc, char ** a_argv, void **a_str_reply) char *l_key_str_out = dap_chain_mempool_datum_add(l_datum, l_chain, l_hash_out_type); DAP_DELETE(l_datum); json_object* json_obj_out = json_object_new_object(); - if (!json_obj_out) return dap_json_rpc_allocation_put(json_obj_out),DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; + if (!json_obj_out) return json_object_put(json_obj_out), DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; json_object_object_add(json_obj_out, "datum_placed_status", l_key_str_out ? json_object_new_string(l_key_str_out) : json_object_new_string("not placed")); json_object_array_add(*a_json_arr_reply, json_obj_out); @@ -1500,7 +1500,7 @@ int com_node(int a_argc, char ** a_argv, void **a_str_reply) char *l_key_str_out = dap_chain_mempool_datum_add(l_datum, l_chain, l_hash_out_type); DAP_DELETE(l_datum); json_object* json_obj_out = json_object_new_object(); - if (!json_obj_out) return dap_json_rpc_allocation_put(json_obj_out),DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; + if (!json_obj_out) return json_object_put(json_obj_out), DAP_CHAIN_NODE_CLI_COM_NODE_MEMORY_ALLOC_ERR; json_object_object_add(json_obj_out, "datum_placed_status", l_key_str_out ? json_object_new_string(l_key_str_out) : json_object_new_string("not placed")); json_object_array_add(*a_json_arr_reply, json_obj_out); diff --git a/modules/node-cli/dap_chain_node_cli_cmd_tx.c b/modules/node-cli/dap_chain_node_cli_cmd_tx.c index ef3831c6fa0f1a6b00c90cd481844e1daf6dbed5..c10e932cf7e8eabe79e366869dd8e69b7df3e8c1 100644 --- a/modules/node-cli/dap_chain_node_cli_cmd_tx.c +++ b/modules/node-cli/dap_chain_node_cli_cmd_tx.c @@ -1624,7 +1624,7 @@ int com_tx_create(int a_argc, char **a_argv, void **a_json_arr_reply) uint256_t *l_value = NULL; uint256_t l_value_fee = {}; - dap_chain_addr_t **l_addr_to = NULL; + const dap_chain_addr_t **l_addr_to = NULL; size_t l_addr_el_count = 0; size_t l_value_el_count = 0; dap_cli_server_cmd_find_option_val(a_argv, arg_index, a_argc, "-from_wallet", &l_from_wallet_name); @@ -1903,7 +1903,7 @@ int com_tx_create(int a_argc, char **a_argv, void **a_json_arr_reply) l_jobj_transfer_status = json_object_new_string((l_ret == 0) ? "Ok" : (l_ret == -2) ? "False, not enough funds for transfer" : "False"); json_object_object_add(l_jobj_result, "transfer", l_jobj_transfer_status); } else { - char *l_tx_hash_str = dap_chain_mempool_tx_create(l_chain, l_priv_key, l_addr_from, (dap_chain_addr_t *const *)l_addr_to, + char *l_tx_hash_str = dap_chain_mempool_tx_create(l_chain, l_priv_key, l_addr_from, l_addr_to, l_token_ticker, l_value, l_value_fee, l_hash_out_type, l_addr_el_count); if (l_tx_hash_str) { l_jobj_transfer_status = json_object_new_string("Ok");