]> zoso.dev Git - libnemo.git/commitdiff
Remove RPC references from pow now that it's done locally.
authorChris Duncan <chris@zoso.dev>
Tue, 3 Dec 2024 20:48:28 +0000 (12:48 -0800)
committerChris Duncan <chris@zoso.dev>
Tue, 3 Dec 2024 20:48:28 +0000 (12:48 -0800)
src/lib/block.ts
src/lib/tools.ts

index ee3c5a860f271023269ee73a7a5f5fee445ad9ac..349976232a0b7511e36ac9e70f5832afd7973a4c 100644 (file)
@@ -79,23 +79,14 @@ abstract class Block {
        }
 
        /**
-       * Sends the block to a node for calculating proof-of-work on the network.
+       * Calculates proof-of-work using a pool of WebGL workers.
        *
        * A successful response sets the `work` property.
-       *
-       * @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')
-               // }
+       async pow (): Promise<void> {
                const data = {
                        "hash": this.previous
                }
-               // const { work } = await rpc.call('work_generate', data)
                const [{ work }] = await this.#pool.work('converge', [data])
                this.work = work
        }
index 8ea4a741f6ec434f1f38c162f5fe1eb21759e8eb..48cd6e61c7299ac606ae1f361ef23df7fff4b9a5 100644 (file)
@@ -126,7 +126,7 @@ export async function sweep (rpc: Rpc | string | URL, wallet: Blake2bWallet | Bi
                        )
                        const blockRequest: Promise<void> = new Promise(async (resolve) => {
                                try {
-                                       await block.pow(rpc)
+                                       await block.pow()
                                        await block.sign(account.index)
                                        const hash = await block.process(rpc)
                                        results.push({ status: 'success', address: block.account.address, message: hash })