From d4988aef7b612c1aa24a4312faf6c853e707f400 Mon Sep 17 00:00:00 2001
From: Roman Khlopkov <roman.khlopkov@demlabs.net>
Date: Fri, 14 Jul 2023 17:18:12 +0300
Subject: [PATCH] [*] Round completed limited with current round num

---
 modules/consensus/dag-poa/dap_chain_cs_dag_poa.c     | 8 +++++++-
 modules/net/dap_chain_net.c                          | 2 +-
 modules/service/stake/dap_chain_net_srv_stake_lock.c | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/consensus/dag-poa/dap_chain_cs_dag_poa.c b/modules/consensus/dag-poa/dap_chain_cs_dag_poa.c
index 2887678540..6ed2566fe5 100644
--- a/modules/consensus/dag-poa/dap_chain_cs_dag_poa.c
+++ b/modules/consensus/dag-poa/dap_chain_cs_dag_poa.c
@@ -684,8 +684,14 @@ static int s_callback_created(dap_chain_t * a_chain, dap_config_t *a_chain_net_c
     }
     dap_chain_net_t *l_cur_net = dap_chain_net_by_name(a_chain->net_name);
     dap_chain_node_role_t l_role = dap_chain_net_get_role(l_cur_net);
-    if (l_role.enums == NODE_ROLE_ROOT_MASTER || l_role.enums == NODE_ROLE_ROOT)
+    if (l_role.enums == NODE_ROLE_ROOT_MASTER || l_role.enums == NODE_ROLE_ROOT) {
         l_dag->callback_cs_event_round_sync = s_callback_event_round_sync;
+        if (l_dag->round_completed >= l_dag->round_current) {
+            l_dag->round_completed = l_dag->round_current;
+            if (l_dag->round_completed)
+                l_dag->round_completed--;
+        }
+    }
     return 0;
 }
 
diff --git a/modules/net/dap_chain_net.c b/modules/net/dap_chain_net.c
index 658d4c4e20..3f69a4e53d 100644
--- a/modules/net/dap_chain_net.c
+++ b/modules/net/dap_chain_net.c
@@ -2771,7 +2771,7 @@ int s_net_load(dap_chain_net_t *a_net)
             log_it (L_NOTICE, "Initialized chain files");
         }
 
-        if(l_chain->callback_created)
+        if (l_chain->callback_created)
             l_chain->callback_created(l_chain, l_cfg);
 
         l_chain = l_chain->next;
diff --git a/modules/service/stake/dap_chain_net_srv_stake_lock.c b/modules/service/stake/dap_chain_net_srv_stake_lock.c
index a31b7db254..825b38db34 100644
--- a/modules/service/stake/dap_chain_net_srv_stake_lock.c
+++ b/modules/service/stake/dap_chain_net_srv_stake_lock.c
@@ -936,7 +936,7 @@ static bool s_stake_lock_callback_verificator(dap_ledger_t *a_ledger, dap_chain_
                 dap_hash_fast_to_str(&l_burning_tx_hash, l_burning_tx_hash_str, DAP_CHAIN_HASH_FAST_STR_SIZE);
                 char *l_take_tx_hash_str;
                 dap_get_data_hash_str_static(a_tx_in, dap_chain_datum_tx_get_size(a_tx_in), l_take_tx_hash_str);
-                log_it(L_ERROR, "[Legacy] Can't find burning tx with hash %s, obtained from the receipt of take tx %s",
+                debug_if(s_debug_more, L_ERROR, "[Legacy] Can't find burning tx with hash %s, obtained from the receipt of take tx %s",
                        l_burning_tx_hash_str, l_take_tx_hash_str);
                 return false;
             }
-- 
GitLab