]> zoso.dev Git - libnemo.git/commitdiff
Keep Pow pool static across all Block instances.
authorChris Duncan <chris@zoso.dev>
Sat, 21 Dec 2024 15:26:04 +0000 (07:26 -0800)
committerChris Duncan <chris@zoso.dev>
Sat, 21 Dec 2024 15:26:04 +0000 (07:26 -0800)
src/lib/block.ts

index 80948bd79eb42ef29db6a687769a33fd4fd89626..da23d562e7b3949a9d4cc9d126c0757f1c57f220 100644 (file)
@@ -16,7 +16,7 @@ import { Pow } from './workers.js'
 * of three derived classes: SendBlock, ReceiveBlock, ChangeBlock.
 */
 abstract class Block {
-       #pool: Pool = new Pool(Pow)
+       static #pool: Pool = new Pool(Pow)
        account: Account
        type: string = 'state'
        abstract subtype: 'send' | 'receive' | 'change'
@@ -89,7 +89,7 @@ abstract class Block {
                                ? THRESHOLD_SEND
                                : THRESHOLD_RECEIVE
                }
-               const [{ work }] = await this.#pool.assign([data])
+               const [{ work }] = await Block.#pool.assign([data])
                this.work = work
        }