From 051f4b2da75ab2287c99a3514af5d0d4f28017bf Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 24 Jun 2023 04:28:08 -0400 Subject: [PATCH] fix: need to refactor verification stream logic further and check if the stream is done but wasm isn't --- src/verify.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/verify.ts b/src/verify.ts index aeb5e58..a30618e 100644 --- a/src/verify.ts +++ b/src/verify.ts @@ -83,16 +83,24 @@ export async function getVerifiableStream( if (chunk.done || wasmDone) { if (wasmDone) { if (result) { + controller.enqueue(chunk.value); done(controller); } else { controller.error(getWasmProperty(wasmId, "error")); + exit(); } } else { + if (!wasmDone) { + controller.error("stream is ended but verification not complete"); + exit(); + return; + } + controller.enqueue(chunk.value); done(controller); } + } else { + controller.enqueue(chunk.value); } - - controller.enqueue(chunk.value); }, async cancel(reason: any) { await reader.cancel(reason);