diff --git a/modules/chain/dap_chain_ledger.c b/modules/chain/dap_chain_ledger.c index 541e8968c9a5f89515a850780e65f08b8fefe28c..eca035718a3436c0782af0711cde3bb76f41be27 100644 --- a/modules/chain/dap_chain_ledger.c +++ b/modules/chain/dap_chain_ledger.c @@ -1523,17 +1523,18 @@ int dap_chain_ledger_token_emission_add(dap_ledger_t *a_ledger, byte_t *a_token_ l_token_emission_item->datum_token_emission = dap_chain_datum_emission_read(a_token_emission, &l_token_emission_item->datum_token_emission_size); - //additional check for private tokens - if ((l_token_item->type == DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_DECL) || - (l_token_item->type == DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_UPDATE) || - (l_token_item->type == DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_DECL) || - (l_token_item->type == DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_UPDATE)) { - if (!s_chain_ledger_token_tsd_check(l_token_item, (dap_chain_datum_token_emission_t *)a_token_emission)) - return -114; - } + //additional check for private tokens + if(l_token_item && ((l_token_item->type == DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_DECL) || + (l_token_item->type == DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_UPDATE) || + (l_token_item->type == DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_DECL) || + (l_token_item->type == DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_UPDATE))) { + if(!s_chain_ledger_token_tsd_check(l_token_item, (dap_chain_datum_token_emission_t*) a_token_emission)) + return -114; + } + //update current_supply in ledger cache and ledger memory object - if (!s_update_token_cache(a_ledger, l_token_item, l_token_emission_item->datum_token_emission->hdr.value_256)) - return -4; + if(l_token_item && !s_update_token_cache(a_ledger, l_token_item, l_token_emission_item->datum_token_emission->hdr.value_256)) + return -4; pthread_rwlock_wrlock(&l_token_item->token_emissions_rwlock); HASH_ADD(hh, l_token_item->token_emissions, datum_token_emission_hash, diff --git a/modules/net/dap_chain_node_cli_cmd_tx.c b/modules/net/dap_chain_node_cli_cmd_tx.c index 2232fa117282ba98ec4ffaad71ace49f8b81b2b2..b32dad6429abbada71f97d6f7b8085405c429ed8 100644 --- a/modules/net/dap_chain_node_cli_cmd_tx.c +++ b/modules/net/dap_chain_node_cli_cmd_tx.c @@ -409,6 +409,11 @@ static bool s_dap_chain_datum_tx_out_data(dap_chain_datum_tx_t *a_datum, break; } l_tx_items_count += l_item_tx_size; + // Freeze protection + if(!l_item_tx_size) + { + break; + } } dap_string_append_printf(a_str_out, "\n");