]> zoso.dev Git - libnemo.git/commitdiff
Instantiate Pool as part of block for calculating pow.
authorChris Duncan <chris@zoso.dev>
Mon, 2 Dec 2024 16:02:56 +0000 (08:02 -0800)
committerChris Duncan <chris@zoso.dev>
Mon, 2 Dec 2024 16:02:56 +0000 (08:02 -0800)
src/lib/block.ts

index bc50ad3e0075796116281439910fe4a9781f9f9f..71a25cd37c84b29f46cae65986c8713756b2d674 100644 (file)
@@ -4,9 +4,11 @@
 import { BURN_ADDRESS, PREAMBLE } from './constants.js'
 import { Account } from './account.js'
 import { bytes, dec, hex } from './convert.js'
+import { NanoNaCl } from './nano-nacl.js'
+import { Pool } from './pool.js'
 import { Rpc } from './rpc.js'
 import Tools from './tools.js'
-import { NanoNaCl } from './nano-nacl.js'
+import { Pow } from './workers.js'
 
 /**
 * Represents a block as defined by the Nano cryptocurrency protocol. The Block
@@ -14,6 +16,7 @@ import { NanoNaCl } from './nano-nacl.js'
 * of three derived classes: SendBlock, ReceiveBlock, ChangeBlock.
 */
 abstract class Block {
+       #pool: Pool
        account: Account
        type: string = 'state'
        abstract subtype: 'send' | 'receive' | 'change'
@@ -35,6 +38,7 @@ abstract class Block {
                } else {
                        throw new TypeError('Invalid account')
                }
+               this.#pool = new Pool(Pow)
        }
 
        /**