From: Chris Duncan Date: Mon, 25 Nov 2024 20:53:37 +0000 (-0800) Subject: Update tools test. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=3e0e462b06e95b1833276e5057f0f4b1781dbf62;p=libnemo.git Update tools test. --- diff --git a/test/tools.test.mjs b/test/tools.test.mjs index cbe4507..b9a7bf2 100644 --- a/test/tools.test.mjs +++ b/test/tools.test.mjs @@ -101,33 +101,35 @@ describe('signature tests', async () => { it('should verify a block using the public key', async () => { const accounts = await wallet.accounts() + const account = accounts[0] const sendBlock = new SendBlock( - accounts[0].address, + account.address, '5618869000000000000000000000000', 'nano_1q3hqecaw15cjt7thbtxu3pbzr1eihtzzpzxguoc37bj1wc5ffoh7w74gi6p', '2000000000000000000000000000000', 'nano_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou', '92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D', ) - await sendBlock.sign(accounts[0].privateKey) - const valid = await sendBlock.verify(accounts[0].publicKey) + await sendBlock.sign(account.privateKey) + const valid = await sendBlock.verify(account.publicKey) assert.equal(valid, true) }) it('should reject a block using the wrong public key', async () => { const accounts = await wallet.accounts() + const account = accounts[0] const sendBlock = new SendBlock( - accounts[0].address, + account.address, '5618869000000000000000000000000', 'nano_1q3hqecaw15cjt7thbtxu3pbzr1eihtzzpzxguoc37bj1wc5ffoh7w74gi6p', '2000000000000000000000000000000', 'nano_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou', '92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D', ) - sendBlock.sign(accounts[0].privateKey) + sendBlock.sign(account.privateKey) sendBlock.account = new Account('nano_1q3hqecaw15cjt7thbtxu3pbzr1eihtzzpzxguoc37bj1wc5ffoh7w74gi6p') - const valid = await sendBlock.verify(accounts[0].publicKey) + const valid = await sendBlock.verify(account.publicKey) assert.equal(valid, false) })