From bdf1ec15e2492b6208ce3dbec8b1ba488b0eaea7 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Mon, 2 Dec 2024 17:08:02 -0800 Subject: [PATCH] Implement nano-webgl-pow on block. --- src/lib/block.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/lib/block.ts b/src/lib/block.ts index bbe6e72..b5ca2df 100644 --- a/src/lib/block.ts +++ b/src/lib/block.ts @@ -86,16 +86,17 @@ abstract class Block { * @param {Rpc|string|URL} rpc - RPC node information required to call `work_generate` */ async pow (rpc: Rpc | string | URL): Promise { - if (typeof rpc === 'string' || rpc.constructor === URL) { - rpc = new Rpc(rpc) - } - if (rpc.constructor !== Rpc) { - throw new TypeError('RPC must be a valid node') - } + // if (typeof rpc === 'string' || rpc.constructor === URL) { + // rpc = new Rpc(rpc) + // } + // if (rpc.constructor !== Rpc) { + // throw new TypeError('RPC must be a valid node') + // } const data = { "hash": this.previous } - const { work } = await rpc.call('work_generate', data) + // const { work } = await rpc.call('work_generate', data) + const { work } = await this.#pool.work('converge', [data]) this.work = work } -- 2.34.1