From: Chris Duncan Date: Mon, 25 Nov 2024 16:54:56 +0000 (-0800) Subject: Add test for open block. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=a46a656c27d3daa9b37c5a03fe0286f7a522fc8b;p=libnemo.git Add test for open block. --- diff --git a/test/sign-blocks.test.mjs b/test/sign-blocks.test.mjs index 05058d5..2e9001a 100644 --- a/test/sign-blocks.test.mjs +++ b/test/sign-blocks.test.mjs @@ -62,6 +62,20 @@ describe('valid blocks', async () => { }) describe('block signing tests using official test vectors', async () => { + it('should create a valid signature for an open block', async () => { + const block = new ReceiveBlock( + NANO_TEST_VECTORS.OPEN_BLOCK.account, + NANO_TEST_VECTORS.OPEN_BLOCK.balance, + NANO_TEST_VECTORS.OPEN_BLOCK.link, + '0', + NANO_TEST_VECTORS.OPEN_BLOCK.representative, + NANO_TEST_VECTORS.OPEN_BLOCK.previous, + NANO_TEST_VECTORS.OPEN_BLOCK.work + ) + await block.sign(NANO_TEST_VECTORS.OPEN_BLOCK.key) + assert.equal(block.signature, NANO_TEST_VECTORS.OPEN_BLOCK.signature) + }) + it('should create a valid signature for a receive block', async () => { const block = new ReceiveBlock( NANO_TEST_VECTORS.RECEIVE_BLOCK.account,