From 0b09287b46715bf0febf93e35c81cda26c3ad422 Mon Sep 17 00:00:00 2001
From: Sergei Rashitov <sergei.rashitov@demlabs.net>
Date: Mon, 18 May 2020 19:20:05 +0700
Subject: [PATCH] Errors in logic

[*] Fix verification of emission
[*] Fix double reply in  tx_verify
---
 modules/chain/dap_chain_ledger.c     | 2 +-
 modules/net/dap_chain_node_cli_cmd.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/chain/dap_chain_ledger.c b/modules/chain/dap_chain_ledger.c
index a484ac82a6..586300de97 100644
--- a/modules/chain/dap_chain_ledger.c
+++ b/modules/chain/dap_chain_ledger.c
@@ -336,7 +336,7 @@ int dap_chain_ledger_token_emission_add_check(dap_ledger_t *a_ledger, const dap_
         log_it(L_ERROR, "Can't add token emission datum of %llu %s ( 0x%s ): already present in cache",
                 a_token_emission->hdr.value, c_token_ticker, l_hash_str);
         ret = -1;
-    }else if ( (! l_token_item) && ( HASH_COUNT( l_ledger_priv->treshold_emissions) < s_treshold_emissions_max  )) {
+    }else if ( (! l_token_item) && ( HASH_COUNT( l_ledger_priv->treshold_emissions) >= s_treshold_emissions_max  )) {
         log_it(L_WARNING,"Treshold for emissions is overfulled (%lu max)",
                s_treshold_emissions_max);
         ret = -2;
diff --git a/modules/net/dap_chain_node_cli_cmd.c b/modules/net/dap_chain_node_cli_cmd.c
index c6a23444b0..fdcca5b9e0 100644
--- a/modules/net/dap_chain_node_cli_cmd.c
+++ b/modules/net/dap_chain_node_cli_cmd.c
@@ -3540,7 +3540,7 @@ int com_tx_verify(int argc, char ** argv, void *arg_func, char **str_reply)
         if(str_reply)
             dap_chain_node_cli_set_reply_text(str_reply, "command \"%s\" not recognized", argv[1]);
     }
-    if(str_reply)
+    else if(str_reply)
         dap_chain_node_cli_set_reply_text(str_reply, "command not defined, enter \"help <cmd name>\"");
     return -1;
 }
-- 
GitLab