diff --git a/modules/chain/dap_chain_ledger.c b/modules/chain/dap_chain_ledger.c index 292f264f1a6a1a17d3ac8618c783f15241324344..a7e66e3450b38402c5c522d2d32d213eb477eb22 100644 --- a/modules/chain/dap_chain_ledger.c +++ b/modules/chain/dap_chain_ledger.c @@ -3431,7 +3431,7 @@ int dap_chain_ledger_tx_cache_check(dap_ledger_t *a_ledger, dap_chain_datum_tx_t if (l_tx_prev_out_cond->header.subtype != DAP_CHAIN_TX_OUT_COND_SUBTYPE_FEE) l_main_ticker = l_token; else - l_main_ticker = l_ledger_pvt->net_native_ticker; + l_token = l_main_ticker = l_ledger_pvt->net_native_ticker; bool l_owner = false; l_owner = dap_sign_match_pkey_signs(l_prev_sign,l_sign); diff --git a/modules/consensus/esbocs/dap_chain_cs_esbocs.c b/modules/consensus/esbocs/dap_chain_cs_esbocs.c index 0dd7a21bcab8312b1625463a2caced1f6da08298..1c3b0945c61d2f91d46c6e8c7eb891751bc35855 100644 --- a/modules/consensus/esbocs/dap_chain_cs_esbocs.c +++ b/modules/consensus/esbocs/dap_chain_cs_esbocs.c @@ -1115,7 +1115,6 @@ static void s_check_db_callback_fee_collect (dap_global_db_context_t *a_global_d dap_chain_block_cache_t *l_block_cache = NULL; dap_chain_cs_blocks_t *l_blocks = DAP_CHAIN_CS_BLOCKS(l_chain); dap_list_t *l_block_list = NULL; - char * l_hash_tx; l_block_cache = dap_chain_block_cs_cache_get_by_hash(l_blocks, &l_arg->block_hash); if(!l_block_cache) { @@ -1134,11 +1133,14 @@ static void s_check_db_callback_fee_collect (dap_global_db_context_t *a_global_d { if(compare256(l_value_out_block,l_arg->fee_need_cfg) == 1) { - l_hash_tx = dap_chain_mempool_tx_coll_fee_create(l_arg->key_from, l_arg->a_addr_to, + char *l_hash_tx = dap_chain_mempool_tx_coll_fee_create(l_arg->key_from, l_arg->a_addr_to, l_block_list, l_arg->value_fee, "hex"); - log_it(L_NOTICE, "Fee collect transaction successfully created, hash=%s\n",l_hash_tx); - dap_global_db_del(block_fee_group, NULL, NULL, NULL); - DAP_DELETE(l_hash_tx); + if(l_hash_tx) + { + log_it(L_NOTICE, "Fee collect transaction successfully created, hash=%s\n",l_hash_tx); + dap_global_db_del(block_fee_group, NULL, NULL, NULL); + DAP_DELETE(l_hash_tx); + } } else { @@ -1147,11 +1149,7 @@ static void s_check_db_callback_fee_collect (dap_global_db_context_t *a_global_d log_it(L_WARNING, "Unable to write data to database"); else log_it(L_NOTICE, "The block was successfully added to the database"); - } - dap_list_free_full(l_block_list, NULL); - DAP_DELETE(l_arg->a_addr_to); - DAP_DELETE(l_arg); - return; + } } else { @@ -1166,11 +1164,14 @@ static void s_check_db_callback_fee_collect (dap_global_db_context_t *a_global_d SUM_256_256(l_value_out_block,l_value_gdb,&l_value_total); if(compare256(l_value_total,l_arg->fee_need_cfg) == 1) { - l_hash_tx = dap_chain_mempool_tx_coll_fee_create(l_arg->key_from, l_arg->a_addr_to, + char *l_hash_tx = dap_chain_mempool_tx_coll_fee_create(l_arg->key_from, l_arg->a_addr_to, l_block_list, l_arg->value_fee, "hex"); - dap_global_db_del(block_fee_group, NULL, NULL, NULL); - log_it(L_NOTICE, "Fee collect transaction successfully created, hash=%s\n",l_hash_tx); - DAP_DELETE(l_hash_tx); + if(l_hash_tx) + { + dap_global_db_del(block_fee_group, NULL, NULL, NULL); + log_it(L_NOTICE, "Fee collect transaction successfully created, hash=%s\n",l_hash_tx); + DAP_DELETE(l_hash_tx); + } } else { @@ -1180,11 +1181,11 @@ static void s_check_db_callback_fee_collect (dap_global_db_context_t *a_global_d else log_it(L_NOTICE, "The block was successfully added to the database"); } - dap_list_free_full(l_block_list, NULL); - DAP_DELETE(l_arg->a_addr_to); - DAP_DELETE(l_arg); - return; } + dap_list_free(l_block_list); + DAP_DEL_Z(l_arg->a_addr_to); + DAP_DELETE(l_arg); + return; } static void s_session_round_finish(dap_chain_esbocs_session_t *a_session, dap_chain_esbocs_store_t *l_store)