]> zoso.dev Git - libnemo.git/commitdiff
Implement nano-webgl-pow on block.
authorChris Duncan <chris@zoso.dev>
Tue, 3 Dec 2024 01:08:02 +0000 (17:08 -0800)
committerChris Duncan <chris@zoso.dev>
Tue, 3 Dec 2024 01:08:02 +0000 (17:08 -0800)
src/lib/block.ts

index bbe6e729bd96d7b82ad43883a652c49e768d6a40..b5ca2df934fcbdaba77f27299fd72dee71de839c 100644 (file)
@@ -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<void> {
-               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
        }