]> git.codecow.com Git - nano-pow.git/commitdiff
Whitespace and documentation.
authorChris Duncan <chris@codecow.com>
Thu, 16 Jul 2026 02:10:23 +0000 (19:10 -0700)
committerChris Duncan <chris@codecow.com>
Thu, 16 Jul 2026 02:10:23 +0000 (19:10 -0700)
src/lib/generate/webgpu/index.ts

index 881b423d9c3ebde511fb6153b959db9ad672d7fd..f773c53bd84e1323ff5536e0692bbe7f33315286 100644 (file)
@@ -243,7 +243,6 @@ async function check (dispatchIndex: number): Promise<boolean> {
                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<boolean> {
 }
 
 /**
-* 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<WorkGenerateResponse>}
  */
 export async function generate (hash: bigint, difficulty: bigint, effort: number, debug: boolean): Promise<WorkGenerateResponse> {
        logger.isEnabled = debug