From: Chris Duncan Date: Thu, 16 Jul 2026 02:10:23 +0000 (-0700) Subject: Whitespace and documentation. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=a03350f08592abd0d405ba1c24389cb0c5c92725;p=nano-pow.git Whitespace and documentation. --- diff --git a/src/lib/generate/webgpu/index.ts b/src/lib/generate/webgpu/index.ts index 881b423..f773c53 100644 --- a/src/lib/generate/webgpu/index.ts +++ b/src/lib/generate/webgpu/index.ts @@ -243,7 +243,6 @@ async function check (dispatchIndex: number): Promise { logger.log('OUTPUT', resultViews[dispatchIndex]) if (resultViews[dispatchIndex] == null) throw new Error('failed to get data from resultBuffer.') return !!resultViews[dispatchIndex].getUint32(0, true) - } catch (err) { logger.log(err) throw new Error('failed to read results from compute pass', { cause: err }) @@ -251,8 +250,8 @@ async function check (dispatchIndex: number): Promise { } /** -* Map CPU buffer to GPU, read results to static result object, and unmap. -*/ + * Map CPU buffer to GPU, read results to static result object, and unmap. + */ function read (dispatchIndex: number): { work: bigint, difficulty: bigint } { logger.log('reading results from compute pass') try { @@ -269,6 +268,12 @@ function read (dispatchIndex: number): { work: bigint, difficulty: bigint } { /** * Nano proof-of-work using WebGPU. + * + * @param {bigint} hash - 32-byte BLAKE2b hash of Nano block + * @param {bigint} difficulty - 8-byte work threshold + * @param {number} effort - threads per dispatch (256n)² + * @param {boolean} debug - enables or disables logger output + * @returns {Promise} */ export async function generate (hash: bigint, difficulty: bigint, effort: number, debug: boolean): Promise { logger.isEnabled = debug