From c1a7e64919dbc77a46cb7e3f96b9bd73052171aa Mon Sep 17 00:00:00 2001
From: "aleksei.voronin" <aleksei.voronin@demlabs.net>
Date: Fri, 15 May 2020 12:07:23 +0300
Subject: [PATCH] [*] event logging fix

---
 modules/chain/dap_chain_ledger.c    | 6 ++++--
 modules/type/dag/dap_chain_cs_dag.c | 4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/chain/dap_chain_ledger.c b/modules/chain/dap_chain_ledger.c
index 03ee9c0cb8..a484ac82a6 100644
--- a/modules/chain/dap_chain_ledger.c
+++ b/modules/chain/dap_chain_ledger.c
@@ -912,8 +912,10 @@ int dap_chain_ledger_tx_add(dap_ledger_t *a_ledger, dap_chain_datum_tx_t *a_tx)
         // delete transaction from the cache list
         //ret = dap_chain_ledger_tx_remove(a_ledger, l_tx_hash);
         // there should be no duplication
-        log_it(L_WARNING, "Transaction (hash=0x%x)  deleted from cache because there is an attempt to add it to cache",
-                l_tx_hash);
+        char * l_hash_str = dap_chain_hash_fast_to_str_new(l_tx_hash);
+        log_it(L_WARNING, "Transaction (hash=%s)  deleted from cache because there is an attempt to add it to cache",
+               l_hash_str);
+        DAP_DELETE(l_hash_str);
         ret = 1;
         goto FIN;
     }
diff --git a/modules/type/dag/dap_chain_cs_dag.c b/modules/type/dag/dap_chain_cs_dag.c
index 1e6acf8751..78c1198dab 100644
--- a/modules/type/dag/dap_chain_cs_dag.c
+++ b/modules/type/dag/dap_chain_cs_dag.c
@@ -587,7 +587,9 @@ static int s_chain_callback_atom_verify(dap_chain_t * a_chain, dap_chain_atom_pt
                 dap_chain_cs_dag_event_item_t * l_event_search = NULL;
                 HASH_FIND(hh, PVT(l_dag)->events ,l_hash ,sizeof (*l_hash),  l_event_search);
                 if ( l_event_search == NULL ){
-                    log_it(L_DEBUG, "Hash %s wasn't in hashtable of previously parsed", l_hash);
+                    char * l_hash_str = dap_chain_hash_fast_to_str_new(l_hash);
+                    log_it(L_DEBUG, "Hash %s wasn't in hashtable of previously parsed", l_hash_str);
+                    DAP_DELETE(l_hash_str);
                     return 1;
                 }
 
-- 
GitLab