Skip to content
Snippets Groups Projects
Commit afbf43b2 authored by alexey.stratulat's avatar alexey.stratulat Committed by Roman Khlopkov
Browse files

Backport 5927

parent 7607a8ab
No related branches found
No related tags found
1 merge request!972Backport 5927
......@@ -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 );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment