return new Promise(async (resolve, reject): Promise<void> => {
for (const d of data) {
try {
- d.work = await new Promise<string>(async (resolve): Promise<void> => {
- await this.search(d.hash, resolve, d.threshold)
- })
+ d.work = await this.search(d.hash, d.threshold)
} catch (err) {
reject(err)
}
if (performance.now() > 8000) {
throw new Error(`WebGPU device failed to load in time.`)
}
- setTimeout(async () => { await this.search(hashHex, threshold) }, 100)
- return
+ return await new Promise(resolve => {
+ setTimeout(() => {
+ resolve(this.search(hashHex, threshold))
+ }, 100)
+ })
}
const hex = nonce.toString(16).padStart(16, '0')
return hex
} else {
- setTimeout(async () => { return await this.search(hashHex, threshold) })
+ return await this.search(hashHex, threshold)
}
}
}