From d512bacc8179ba38f0fc50031f884cdff4fe80d4 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Sat, 25 Jul 2026 20:56:05 +0300 Subject: [PATCH] =?UTF-8?q?merkle=5Fsync:=20fix=20message=20format=20?= =?UTF-8?q?=E2=80=94=20type=20after=20ns=20(match=20chat=5Fsync)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/chatgui/transport/merkle_sync.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/chatgui/transport/merkle_sync.c b/tools/chatgui/transport/merkle_sync.c index f4516d7d..5dd1b0b0 100644 --- a/tools/chatgui/transport/merkle_sync.c +++ b/tools/chatgui/transport/merkle_sync.c @@ -235,8 +235,8 @@ static int _send_hashes(struct merkle_sync* ms, uint64_t peer, const char* ns, uint8_t* buf = u_malloc(max_sz); if (!buf) return -1; uint8_t* p = buf; - *p++ = 0x01; /* MS_MSG_HASHES */ *p++ = ch_len; memcpy(p, ns, ch_len); p += ch_len; + *p++ = 0x01; /* MS_MSG_HASHES */ *p++ = level; *p++ = prefix_bytes; _prefix_write(p, prefix, prefix_bytes); p += prefix_bytes; *p++ = (uint8_t)(is_data ? 1 : 0); @@ -270,8 +270,8 @@ static int _send_batch(struct merkle_sync* ms, uint64_t peer, const char* ns, uint8_t* buf = u_malloc(max_sz); if (!buf) return -1; uint8_t* p = buf; - *p++ = 0x03; /* MS_MSG_BATCH */ *p++ = ch_len; memcpy(p, ns, ch_len); p += ch_len; + *p++ = 0x03; /* MS_MSG_BATCH */ *p++ = (uint8_t)count; for (int i = 0; i < count; i++) { @@ -426,8 +426,9 @@ static void _handle_hashes(struct merkle_sync* ms, uint64_t peer, const char* ns uint8_t* rbuf = u_malloc(rs); if (rbuf) { uint8_t* wr = rbuf; - *wr++ = 0x02; /* MS_MSG_REQUEST */ *wr++ = ch_len; + *wr++ = ch_len; memcpy(wr, ns, ch_len); wr += ch_len; + *wr++ = 0x02; /* MS_MSG_REQUEST */ *wr++ = (uint8_t)rcount; for (int i = 0; i < rcount; i++) { *wr++ = requests[i].level;