]> zoso.dev Git - libnemo.git/commitdiff
Add test for open block.
authorChris Duncan <chris@zoso.dev>
Mon, 25 Nov 2024 16:54:56 +0000 (08:54 -0800)
committerChris Duncan <chris@zoso.dev>
Mon, 25 Nov 2024 16:54:56 +0000 (08:54 -0800)
test/sign-blocks.test.mjs

index 05058d57eb5bc29e8bc28ff997108d9844b0f9b7..2e9001ad03ace35ebdd9cc770c1d205eb7f26446 100644 (file)
@@ -62,6 +62,20 @@ describe('valid blocks', async () => {
 })\r
 \r
 describe('block signing tests using official test vectors', async () => {\r
+       it('should create a valid signature for an open block', async () => {\r
+               const block = new ReceiveBlock(\r
+                       NANO_TEST_VECTORS.OPEN_BLOCK.account,\r
+                       NANO_TEST_VECTORS.OPEN_BLOCK.balance,\r
+                       NANO_TEST_VECTORS.OPEN_BLOCK.link,\r
+                       '0',\r
+                       NANO_TEST_VECTORS.OPEN_BLOCK.representative,\r
+                       NANO_TEST_VECTORS.OPEN_BLOCK.previous,\r
+                       NANO_TEST_VECTORS.OPEN_BLOCK.work\r
+               )\r
+               await block.sign(NANO_TEST_VECTORS.OPEN_BLOCK.key)\r
+               assert.equal(block.signature, NANO_TEST_VECTORS.OPEN_BLOCK.signature)\r
+       })\r
+\r
        it('should create a valid signature for a receive block', async () => {\r
                const block = new ReceiveBlock(\r
                        NANO_TEST_VECTORS.RECEIVE_BLOCK.account,\r