fix: need to refactor verification stream logic further and check if the stream is done but wasm isn't

This commit is contained in:
Derrick Hammer 2023-06-24 04:28:08 -04:00
parent 50a7c80358
commit 051f4b2da7
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 10 additions and 2 deletions

View File

@ -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);
}
},
async cancel(reason: any) {
await reader.cancel(reason);