From: Chris Duncan Date: Sat, 8 Aug 2026 06:42:26 +0000 (-0700) Subject: Increase visible account derivation limit now that batches are possible. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=13f4e5fce3e50e1121560eb2b13bbcb257930421;p=libnemo.git Increase visible account derivation limit now that batches are possible. --- diff --git a/src/lib/wallet/accounts.ts b/src/lib/wallet/accounts.ts index ed5fc16..bc87104 100644 --- a/src/lib/wallet/accounts.ts +++ b/src/lib/wallet/accounts.ts @@ -21,7 +21,7 @@ export async function _accounts (type: WalletType, accounts: Map 100) { + if (to - from > 10_000) { console.warn('libnemo performance may degrade when deriving many accounts at once') } const output = new Map() diff --git a/test/test.derive-accounts.mjs b/test/test.derive-accounts.mjs index d3e7cd6..be80fa5 100644 --- a/test/test.derive-accounts.mjs +++ b/test/test.derive-accounts.mjs @@ -10,13 +10,13 @@ import { CUSTOM_TEST_VECTORS, NANO_TEST_VECTORS, TEST_PASSWORD } from './VECTORS await Promise.all([ suite('Derive accounts from BIP-44 wallet', async () => { - await test('derive the first 10000 accounts from the given BIP-44 seed', async () => { + await test('derive the first 10,000 accounts from the given BIP-44 seed', async () => { const wallet = await Wallet.load('BIP-44', TEST_PASSWORD, NANO_TEST_VECTORS.BIP39_SEED) await wallet.unlock(TEST_PASSWORD) let start, end start = performance.now() - await wallet.accounts(0, 10000) + await wallet.accounts(0, 10_000) end = performance.now() console.log('duration', end - start) @@ -94,6 +94,19 @@ await Promise.all([ suite('Derive accounts from BLAKE2b wallet', async () => { + await test('derive the first 10,000 accounts from the given BLAKE2b seed', async () => { + const wallet = await Wallet.load('BLAKE2b', TEST_PASSWORD, NANO_TEST_VECTORS.BLAKE2B_SEED) + await wallet.unlock(TEST_PASSWORD) + + let start, end + start = performance.now() + await wallet.accounts(0, 10_000) + end = performance.now() + console.log('duration', end - start) + + await assert.resolves(wallet.destroy()) + }) + await test('derive the second account from the given BLAKE2b seed', async () => { const wallet = await Wallet.load('BLAKE2b', TEST_PASSWORD, NANO_TEST_VECTORS.BLAKE2B_SEED) await wallet.unlock(TEST_PASSWORD) @@ -169,6 +182,19 @@ await Promise.all([ suite('Derive accounts from Exodus wallet', async () => { const { ADDRESS_0, ADDRESS_1, BIP39_SEED_0, BIP39_SEED_1, PUBLIC_0, PUBLIC_1 } = CUSTOM_TEST_VECTORS.EXODUS + await test('derive the first 10,000 accounts from the given Exodus seed', async () => { + const wallet = await Wallet.load('Exodus', TEST_PASSWORD, BIP39_SEED_0) + await wallet.unlock(TEST_PASSWORD) + + let start, end + start = performance.now() + await wallet.accounts(0, 10_000) + end = performance.now() + console.log('duration', end - start) + + await assert.resolves(wallet.destroy()) + }) + await test('derive the first account from the given Exodus seed', async () => { const wallet = await Wallet.load('Exodus', TEST_PASSWORD, BIP39_SEED_0) await wallet.unlock(TEST_PASSWORD)