From 3368abad2aedc6956ddcfb13954eb1f713b9c5ea Mon Sep 17 00:00:00 2001 From: Evgeny Date: Wed, 15 Jul 2026 17:53:25 +0300 Subject: [PATCH] etcp+chat: add DEBUG_INFO logs for invite/crypto handshake debugging - etcp_connections: DECRYPT FAIL now logs my_pub/peer_pub/session_ready at INFO level (debug category) - chat_sync: log invite start with pubkey/node_id/addr_count - chat_core: log pubkey set on invite connect (my_pub + peer_pub) - joindialog: GUI_INFO on decoded invite --- src/etcp_connections.c | 2 +- tools/chatgui/src/joindialog.cpp | 3 +++ tools/chatgui/transport/chat_core.c | 2 ++ tools/chatgui/transport/chat_sync.c | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/etcp_connections.c b/src/etcp_connections.c index 28517ff9..22d862f9 100644 --- a/src/etcp_connections.c +++ b/src/etcp_connections.c @@ -1560,7 +1560,7 @@ void etcp_connections_read_callback_socket(socket_t sock, void* arg) { DEBUG_TRACE(DEBUG_CATEGORY_DEBUG, "DECRYPT OK link=%p log=%s", link, link->etcp->log_name); goto process_decrypted; } - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "DECRYPT FAIL link=%p log=%s rc=%d — trying init decrypt", link, link->etcp->log_name, dec_rc); + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "etcp: DECRYPT FAIL rc=%d link=%p log=%s session_ready=%d my_pub=%016llx peer_pub=%016llx", dec_rc, link, link->etcp->log_name, link->etcp->crypto_ctx.session_ready, *(uint64_t*)link->etcp->crypto_ctx.pk->public_key, *(uint64_t*)link->etcp->crypto_ctx.peer_public_key); } else { DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "SKIP normal decrypt: link=%p session_ready=%d — trying init decrypt", link, link && link->etcp ? link->etcp->crypto_ctx.session_ready : -1); diff --git a/tools/chatgui/src/joindialog.cpp b/tools/chatgui/src/joindialog.cpp index ad54f4cc..6a5f10b9 100644 --- a/tools/chatgui/src/joindialog.cpp +++ b/tools/chatgui/src/joindialog.cpp @@ -127,6 +127,9 @@ void JoinDialog::onConnectClicked() { memcpy(&nodeId, hash, sizeof(nodeId)); nodeId &= 0x7FFFFFFFFFFFFFFFULL; + GUI_INFO("join: decoded invite ch=%llu pubkey=%016llx... nodeId=0x%016llx addrs=%d", + d.channelId, *(const uint64_t*)d.pubkey.constData(), nodeId, d.addrs.size()); + m_pendingNodeId = nodeId; m_pendingChannelId = d.channelId; m_connecting = true; diff --git a/tools/chatgui/transport/chat_core.c b/tools/chatgui/transport/chat_core.c index 5da3aad2..3c34763a 100644 --- a/tools/chatgui/transport/chat_core.c +++ b/tools/chatgui/transport/chat_core.c @@ -745,6 +745,8 @@ void chat_core_connect_from_invite(struct chat_invite* inv) { } sc_init_ctx(&conn->crypto_ctx, &g_cc.inst->my_keys); sc_set_peer_public_key(&conn->crypto_ctx, inv->pubkey, 0); + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "%s: invite connect set peer_pubkey=%016llx my_pub=%016llx peer_node=0x%016llx", + CC_ID, *(uint64_t*)inv->pubkey, *(uint64_t*)conn->crypto_ctx.pk->public_key, inv->node_id); struct cc_parallel_ctx* pctx = u_calloc(1, sizeof(struct cc_parallel_ctx)); if (!pctx) { etcp_connection_close(conn); pst->conns[idx] = NULL; pst->timers[idx] = NULL; pst->pending_count--; continue; } diff --git a/tools/chatgui/transport/chat_sync.c b/tools/chatgui/transport/chat_sync.c index e59ac336..fd8057bd 100644 --- a/tools/chatgui/transport/chat_sync.c +++ b/tools/chatgui/transport/chat_sync.c @@ -693,6 +693,9 @@ void chat_sync_connect_from_invite(uint64_t channel_id, uint64_t node_id, g_cs->pending_invite_ch_id = channel_id; g_cs->pending_invite_node_id = node_id; + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "%s: invite start ch=%llu node=0x%016llx pubkey=%016llx... addrs=%d", + CS_ID, channel_id, node_id, *(const uint64_t*)pubkey_bin, addr_count); + gui_bridge_post_uasync_fn( (void(*)(void*))chat_core_connect_from_invite, inv); }