From caa0740b0106224e63c693995a2d23c5867b9610 Mon Sep 17 00:00:00 2001
From: Dmitriy Gerasimov <naeper@demlabs.net>
Date: Fri, 24 May 2019 13:46:16 +0700
Subject: [PATCH] [*] Changed addr loging

---
 dap_chain_net.c          |  4 ++--
 dap_chain_node_cli_cmd.c | 18 +++++++++++++-----
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/dap_chain_net.c b/dap_chain_net.c
index 488d08ffa6..3de0bb6753 100644
--- a/dap_chain_net.c
+++ b/dap_chain_net.c
@@ -171,8 +171,8 @@ static void s_gbd_history_callback_notify (void * a_arg, const char a_op_code, c
 
     if (a_arg) {
         dap_chain_net_t * l_net = (dap_chain_net_t *) a_arg;
-        if (!PVT (l_net)->load_mode )
-            dap_chain_net_sync_all(l_net);
+        //if (!PVT (l_net)->load_mode )
+        //    dap_chain_net_sync_all(l_net);
     }
 }
 
diff --git a/dap_chain_node_cli_cmd.c b/dap_chain_node_cli_cmd.c
index daec8d9922..2e1f7c62a3 100644
--- a/dap_chain_node_cli_cmd.c
+++ b/dap_chain_node_cli_cmd.c
@@ -1243,7 +1243,7 @@ int com_tx_wallet(int argc, const char ** argv, char **str_reply)
             l_addr = (dap_chain_addr_t *) dap_chain_wallet_get_addr(l_wallet);
         }
         if(!l_addr && addr_str)
-            l_addr = dap_chain_str_to_addr(addr_str);
+            l_addr = dap_chain_addr_from_str(addr_str);
 
         dap_ledger_t *l_ledger = dap_chain_ledger_by_net_name((const char *) l_net_name);
         if(!l_net_name) {
@@ -1903,7 +1903,7 @@ int com_token_emit(int argc, const char ** argv, char ** str_reply)
         return -5;
     }
 
-    dap_chain_addr_t * l_addr = dap_chain_str_to_addr(l_addr_str);
+    dap_chain_addr_t * l_addr = dap_chain_addr_from_str(l_addr_str);
 
     if(!l_addr) {
         dap_chain_node_cli_set_reply_text(str_reply, "address \"%s\" is invalid", l_addr_str);
@@ -2128,6 +2128,8 @@ int com_tx_create(int argc, const char ** argv, char **str_reply)
     const char * l_token_ticker = NULL;
     const char * l_net_name = NULL;
     const char * l_chain_name = NULL;
+    const char * l_tx_num_str = NULL;
+    size_t l_tx_num =0;
 
     uint64_t value = 0;
     uint64_t value_fee = 0;
@@ -2136,6 +2138,10 @@ int com_tx_create(int argc, const char ** argv, char **str_reply)
     dap_chain_node_cli_find_option_val(argv, arg_index, argc, "-token", &l_token_ticker);
     dap_chain_node_cli_find_option_val(argv, arg_index, argc, "-net", &l_net_name);
     dap_chain_node_cli_find_option_val(argv, arg_index, argc, "-chain", &l_chain_name);
+    dap_chain_node_cli_find_option_val(argv, arg_index, argc, "-tx_num", &l_tx_num_str);
+
+    if ( l_tx_num_str )
+        l_tx_num = strtoul(l_tx_num_str,NULL,10);
 
     if(dap_chain_node_cli_find_option_val(argv, arg_index, argc, "-fee", &addr_base58_fee)) {
         if(dap_chain_node_cli_find_option_val(argv, arg_index, argc, "-value_fee", &str_tmp)) {
@@ -2191,8 +2197,8 @@ int com_tx_create(int argc, const char ** argv, char **str_reply)
         return -1;
     }
     const dap_chain_addr_t *addr_from = (const dap_chain_addr_t *) dap_chain_wallet_get_addr(l_wallet);
-    dap_chain_addr_t *addr_to = dap_chain_str_to_addr(addr_base58_to);
-    dap_chain_addr_t *addr_fee = dap_chain_str_to_addr(addr_base58_fee);
+    dap_chain_addr_t *addr_to = dap_chain_addr_from_str(addr_base58_to);
+    dap_chain_addr_t *addr_fee = dap_chain_addr_from_str(addr_base58_fee);
 
     if(!addr_from) {
         dap_chain_node_cli_set_reply_text(str_reply, "source address is invalid");
@@ -2211,7 +2217,9 @@ int com_tx_create(int argc, const char ** argv, char **str_reply)
     //g_string_printf(string_ret, "from=%s\nto=%s\nval=%lld\nfee=%s\nval_fee=%lld\n\n",
     //        addr_base58_from, addr_base58_to, value, addr_base58_fee, value_fee);
 
-    int res = dap_chain_mempool_tx_create( l_chain, dap_chain_wallet_get_key(l_wallet, 0), addr_from, addr_to, addr_fee,
+    int res = l_tx_num? dap_chain_mempool_tx_create_massive( l_chain, dap_chain_wallet_get_key(l_wallet, 0), addr_from, addr_to, addr_fee,
+                                                     l_token_ticker, value, value_fee, l_tx_num)
+              :dap_chain_mempool_tx_create( l_chain, dap_chain_wallet_get_key(l_wallet, 0), addr_from, addr_to, addr_fee,
             l_token_ticker, value, value_fee);
     dap_string_append_printf(string_ret, "transfer=%s\n",
             (res == 0) ? "Ok" : (res == -2) ? "False, not enough funds for transfer" : "False");
-- 
GitLab