//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
//! SPDX-License-Identifier: GPL-3.0-or-later
-import { bigHex, bigToU64, Logger, Queue } from '#utils'
+import { Logger, Queue, bigHex, bigToU64 } from '#utils'
import { WorkGenerateResponse } from 'nano-pow'
import { default as NanoPowGpuComputeShader } from './shaders/compute.wgsl'
}
}
-async function init (hash: BigUint64Array, difficulty: bigint): Promise<void> {
+async function init (hash: bigint, difficulty: bigint): Promise<void> {
LOG: logger.log('variables initializing')
try {
// Save hash data for normal usage and potential recovery efforts
- hashData.set(hash)
+ hashData.set(bigToU64(hash, 4))
// Write data that will not change per dispatch to uniform buffer object
// Note: u64 size is 8, but total alignment must be multiple of 16
throw new Error('failed to start')
}
}
- await q.add(init, bigToU64(hash, 4), difficulty)
+ await q.add(init, hash, difficulty)
// Dispatch initial workgroups and set index
await dispatch(0, crypto.getRandomValues(seed)[0], effort)
let dispatchIndex = 1