From d946a1b93a1ba7bcef235254831330d335ebb898 Mon Sep 17 00:00:00 2001 From: evgeny Date: Tue, 6 Oct 2026 12:48:20 +0200 Subject: [PATCH] Finalize unsigned initial profiles before channel bootstrap --- src/chat/chat_sync.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/chat/chat_sync.c b/src/chat/chat_sync.c index 34a97660..0d4a21b6 100644 --- a/src/chat/chat_sync.c +++ b/src/chat/chat_sync.c @@ -1161,7 +1161,10 @@ static void cs_handle_join_info_req(struct chat_sync* cs, uint64_t peer, uint8_t my_update_sig[64] = {0}; uint64_t my_update_ts; char juser[MS_USERINFO_MAX + 1]; if (chat_core_get_my_profile(cs->inst, ch_id, juser, sizeof(juser), my_update_sig, &my_update_ts) < 0) { - uint8_t err[1] = { CS_MSG_ERROR }; cs_send(cs, ch_id, peer, err, sizeof(err)); return; + chat_core_update_my_member(cs->inst); + if (chat_core_get_my_profile(cs->inst, ch_id, juser, sizeof(juser), my_update_sig, &my_update_ts) < 0) { + uint8_t err[1] = { CS_MSG_ERROR }; cs_send(cs, ch_id, peer, err, sizeof(err)); return; + } } uint64_t my_signed_by = 0; uint8_t my_signature[64] = {0}; topo_node_sqlite_member_get_sign(cs->inst->topo_sqlite_db, ch_id, myid, &my_signed_by, my_signature); @@ -1609,7 +1612,10 @@ static int cs_send_channel_invite(struct chat_sync* cs, struct UTUN_INSTANCE* in topo_node_sqlite_member_get_join(vdb, ch_id, inst->node_id, join_sig, &join_ts); } uint8_t upd_sig[64] = {0}; uint64_t upd_ts; char juser[MS_USERINFO_MAX + 1]; - if (chat_core_get_my_profile(inst, ch_id, juser, sizeof(juser), upd_sig, &upd_ts) < 0) return -1; + if (chat_core_get_my_profile(inst, ch_id, juser, sizeof(juser), upd_sig, &upd_ts) < 0) { + chat_core_update_my_member(inst); + if (chat_core_get_my_profile(inst, ch_id, juser, sizeof(juser), upd_sig, &upd_ts) < 0) return -1; + } /* join-ключ: генерируем и регистрируем локально (инвайтер == connection-узел), чтобы джойнер смог пройти JOIN_INFO_REQ с валидным ключом. */ uint64_t join_key = 0;