]> git.codecow.com Git - libnemo.git/commitdiff
Return block from pow to enable call chain.
authorChris Duncan <chris@zoso.dev>
Wed, 6 Aug 2025 04:06:00 +0000 (21:06 -0700)
committerChris Duncan <chris@zoso.dev>
Wed, 6 Aug 2025 04:06:00 +0000 (21:06 -0700)
src/lib/block.ts

index e4e8a6ded97698aa0cb61daf93b7d0dc86989019..5148f5aed0e0a5fe8ebdcfada01af2b0456ace22 100644 (file)
@@ -133,7 +133,7 @@ abstract class Block {
        *
        * A successful response sets the `work` property.
        */
-       async pow (): Promise<void> {
+       async pow (): Promise<Block> {
                const difficulty: bigint = (this instanceof SendBlock || this instanceof ChangeBlock)
                        ? DIFFICULTY_SEND
                        : DIFFICULTY_RECEIVE
@@ -149,6 +149,7 @@ abstract class Block {
                        throw new Error('Wwork generated is invalid', { cause: `${check.difficulty} < ${difficulty}` })
                }
                this.work = result.work
+               return this
        }
 
        /**