Skip to content
Snippets Groups Projects
Commit 650e9b26 authored by Dmitriy A. Gerasimov's avatar Dmitriy A. Gerasimov
Browse files

[*] Small fixes

parent 246e80ad
No related branches found
No related tags found
2 merge requests!251Master,!250Master
Pipeline #5476 passed with stage
in 46 seconds
......@@ -131,10 +131,15 @@ int dap_chain_cell_load(dap_chain_t * a_chain, const char * a_cell_file_path)
size_t l_element_size = 0;
if ( fread(&l_element_size,1,sizeof(l_element_size),l_cell->file_storage) ==
sizeof(l_element_size) ){
if ( l_element_size > 0 ){
if ( l_element_size > 0){
dap_chain_atom_ptr_t * l_element = DAP_NEW_Z_SIZE (dap_chain_atom_ptr_t, l_element_size );
if ( fread( l_element,1,l_element_size,l_cell->file_storage ) == l_element_size ) {
a_chain->callback_atom_add (a_chain, l_element, l_element_size);
if (l_element){
if ( fread( l_element,1,l_element_size,l_cell->file_storage ) == l_element_size ) {
a_chain->callback_atom_add (a_chain, l_element, l_element_size);
}
}else{
log_it (L_ERROR, "Can't allocate %zd bytes, stop cell load process", l_element_size);
break;
}
} else {
log_it (L_ERROR, "Zero element size, file is corrupted");
......
......@@ -337,7 +337,7 @@ static int s_cli_blocks(int a_argc, char ** a_argv, void *a_arg_func, char **a_s
if ( PVT(l_blocks)->block_new ){
dap_chain_hash_fast_t l_datum_hash;
s_cli_parse_cmd_hash(a_argv,arg_index,a_argc,a_str_reply,"-datum", &l_datum_hash );
dap_chain_block_datum_del_by_hash( PVT(l_blocks)->block_new, PVT(l_blocks)->block_new_size, &l_datum_hash );
PVT(l_blocks)->block_new_size=dap_chain_block_datum_del_by_hash( PVT(l_blocks)->block_new, PVT(l_blocks)->block_new_size, &l_datum_hash );
}else {
dap_chain_node_cli_set_reply_text(a_str_reply,
"Error! Can't delete datum from hash because no forming new block! Check pls you role, it must be MASTER NODE or greater");
......
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