return { difficulty, effort }
}
- static async #dispatch (pipeline: GPUComputePipeline, seed: bigint, hash: string, difficulty: bigint, passes: number): Promise<void> {
+ static async #work_dispatch (pipeline: GPUComputePipeline, seed: bigint, hash: string, difficulty: bigint, passes: number): Promise<void> {
if (this.#device == null) throw new Error(`WebGPU device failed to load.`)
// Set up uniform buffer object
// Note: u32 size is 4, but total alignment must be multiple of 16
random = BigInt(Math.floor(Math.random() * 0xffffffff))
seed = (seed & 0xffffffffn) << 32n | random
if (this.#debug) console.log('seed', seed.toString(16).padStart(16, '0'))
- await this.#dispatch(this.#searchPipeline, seed, hash, difficulty, effort)
+ await this.#work_dispatch(this.#searchPipeline, seed, hash, difficulty, effort)
const found = !!this.#resultView.getUint32(0)
nonce = this.#resultView.getBigUint64(8, true)
result = this.#resultView.getBigUint64(16, true)
const seed = BigInt(`0x${work}`)
if (this.#debug) console.log('work', work)
- await this.#dispatch(this.#validatePipeline, seed, hash, difficulty, 1)
+ await this.#work_dispatch(this.#validatePipeline, seed, hash, difficulty, 1)
nonce = this.#resultView.getBigUint64(8, true)
result = this.#resultView.getBigUint64(16, true)
this.#busy = false