From f34a6ec1c328d7c75bfdfe756edf768e7ca2f66d Mon Sep 17 00:00:00 2001
From: Constantin P <papizh.konstantin@demlabs.net>
Date: Tue, 22 Aug 2023 08:14:55 +0000
Subject: [PATCH] Hotfix balancer segv

---
 modules/net/dap_chain_node_client.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/modules/net/dap_chain_node_client.c b/modules/net/dap_chain_node_client.c
index cef1a1c20f..b2dc753e96 100644
--- a/modules/net/dap_chain_node_client.c
+++ b/modules/net/dap_chain_node_client.c
@@ -747,13 +747,11 @@ bool dap_chain_node_client_connect(dap_chain_node_client_t *a_node_client, const
         struct sockaddr_in6 sa6 = { .sin6_family = AF_INET6, .sin6_addr = a_node_client->info->hdr.ext_addr_v6 };
         inet_ntop(AF_INET6, &(((struct sockaddr_in6 *) &sa6)->sin6_addr), l_host_addr, INET6_ADDRSTRLEN);
     }
-    log_it(L_INFO, "Connecting to %s address", l_host_addr);
-    // address not defined
-    if(!strcmp(l_host_addr, "::")) {
-        log_it(L_WARNING, "Undefined address with node client connect to");
+    if(!strlen(l_host_addr) || !strcmp(l_host_addr, "::") || !a_node_client->info->hdr.ext_port) {
+        log_it(L_WARNING, "Undefined address of node client");
         return false;
     }
-    int ret_code = 0;
+    log_it(L_INFO, "Connecting to addr %s : %d", l_host_addr, a_node_client->info->hdr.ext_port);
     dap_client_set_uplink_unsafe(a_node_client->client, l_host_addr, a_node_client->info->hdr.ext_port);
     a_node_client->state = NODE_CLIENT_STATE_CONNECTING;
     // Handshake & connect
-- 
GitLab