diff --git a/modules/mempool/dap_chain_mempool.c b/modules/mempool/dap_chain_mempool.c index ee44cac4de8ae6d3e5c7e4ee7d22f6bad0f25038..904435d085cccbebbe57c3d84c2449465a9b3c63 100644 --- a/modules/mempool/dap_chain_mempool.c +++ b/modules/mempool/dap_chain_mempool.c @@ -313,6 +313,7 @@ int dap_chain_mempool_tx_create_massive( dap_chain_t * a_chain, dap_enc_key_t *a return -2; } + dap_chain_hash_fast_t l_tx_new_hash = {0}; for (size_t i=0; i< a_tx_num ; i++){ log_it(L_DEBUG, "Prepare tx %zu",i); // find the transactions from which to take away coins @@ -404,13 +405,12 @@ int dap_chain_mempool_tx_create_massive( dap_chain_t * a_chain, dap_enc_key_t *a // now tx is formed - calc size and hash size_t l_tx_size = dap_chain_datum_tx_get_size(l_tx_new); - dap_chain_hash_fast_t l_tx_new_hash; dap_hash_fast(l_tx_new, l_tx_size, &l_tx_new_hash); // If we have value back - update balance cache if (!IS_ZERO_256(l_value_back)) { //log_it(L_DEBUG,"We have value back %"DAP_UINT64_FORMAT_U" now lets see how many outputs we have", l_value_back); int l_item_count = 0; - dap_list_t *l_list_out_items = dap_chain_datum_tx_items_get( l_tx_new, TX_ITEM_TYPE_OUT, + dap_list_t *l_list_out_items = dap_chain_datum_tx_items_get( l_tx_new, TX_ITEM_TYPE_OUT_ALL, &l_item_count); dap_list_t *l_list_tmp = l_list_out_items; int l_out_idx_tmp = 0; // current index of 'out' item @@ -422,6 +422,11 @@ int dap_chain_mempool_tx_create_massive( dap_chain_t * a_chain, dap_enc_key_t *a l_out_idx_tmp++; continue; } + if (l_out->header.type == TX_ITEM_TYPE_OUT_COND) { + l_list_tmp = l_list_tmp->next; + l_out_idx_tmp++; + continue; + } if ( memcmp(&l_out->addr, a_addr_from, sizeof (*a_addr_from))==0 ){ list_used_item_t *l_item_back = DAP_NEW_Z(list_used_item_t); l_item_back->tx_hash_fast = l_tx_new_hash; @@ -448,7 +453,7 @@ int dap_chain_mempool_tx_create_massive( dap_chain_t * a_chain, dap_enc_key_t *a l_objs[i].key = dap_chain_hash_fast_to_str_new(&l_tx_new_hash); //continue; l_objs[i].value = (uint8_t *)l_datum; - l_objs[i].value_len = l_tx_size + sizeof(l_datum->header); + l_objs[i].value_len = dap_chain_datum_size(l_datum); log_it(L_DEBUG, "Prepared obj with key %s (value_len = %"DAP_UINT64_FORMAT_U")", l_objs[i].key? l_objs[i].key :"NULL" , l_objs[i].value_len );