From 95485f0a6999fccc78d4ca211489a7350ec992bc Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Thu, 19 May 2022 19:51:51 +1000 Subject: [PATCH] Remove `Buffer` from `getSizeOfPayloadSizeField` --- src/lib/waku_message/version_1.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/waku_message/version_1.ts b/src/lib/waku_message/version_1.ts index 8a3a4b7302..5a77c7f930 100644 --- a/src/lib/waku_message/version_1.ts +++ b/src/lib/waku_message/version_1.ts @@ -110,8 +110,8 @@ export function clearDecode( } function getSizeOfPayloadSizeField(message: Uint8Array): number { - const buf = Buffer.from(message); - return buf.readUIntLE(0, 1) & FlagMask; + const messageDataView = new DataView(message.buffer); + return messageDataView.getUint8(0) & FlagMask; } /**