From 79224889911ec4f982759b163e71466752d29060 Mon Sep 17 00:00:00 2001 From: extremeheat Date: Wed, 13 May 2026 02:24:29 -0400 Subject: [PATCH] Revert "Fix computeChatChecksum returning unsigned byte for i8 schema (#1485)" This reverts commit a263bb92338c009701cc5d1eaa8fba597dde3946. --- src/datatypes/checksums.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/datatypes/checksums.js b/src/datatypes/checksums.js index 2d5238f1..1d516c70 100644 --- a/src/datatypes/checksums.js +++ b/src/datatypes/checksums.js @@ -12,11 +12,9 @@ function computeChatChecksum (lastSeenMessages) { checksum = (31 * checksum + sigHash) & 0xffffffff } } - // Convert to signed byte (i8: -128..127) to match the chat_command_signed packet schema. - // The previous `& 0xff` produced 0..255 which causes RangeError when value > 127. - const unsigned = checksum & 0xff - const signed = unsigned > 127 ? unsigned - 256 : unsigned - return signed === 0 ? 1 : signed + // Convert to byte + const result = checksum & 0xff + return result === 0 ? 1 : result } module.exports = { computeChatChecksum }