]> zoso.dev Git - libnemo.git/commitdiff
Throw if NanoPow couldn't load.
authorChris Duncan <chris@zoso.dev>
Mon, 13 Jan 2025 00:40:31 +0000 (16:40 -0800)
committerChris Duncan <chris@zoso.dev>
Mon, 13 Jan 2025 00:40:31 +0000 (16:40 -0800)
src/lib/workers/nano-pow.ts

index 24b8116287729ffbb605c0a44edc9cbabe107b2c..ef6860a4b38bda83a96bad8306f442f610dda9c8 100644 (file)
@@ -21,9 +21,10 @@ export class NanoPowWorker extends WorkerInterface {
        */
        static async work (data: any[]): Promise<any[]> {
                return new Promise(async (resolve, reject): Promise<void> => {
+                       if (NanoPow == null) throw new Error('NanoPow not available')
                        for (const d of data) {
                                try {
-                                       d.work = await NanoPowGpu.search(d.hash, d.threshold)
+                                       d.work = await NanoPow.search(d.hash, d.threshold)
                                } catch (err) {
                                        reject(err)
                                }