]> git.codecow.com Git - libnemo.git/commitdiff
Hard cap wallet account derivation at 10,000.
authorChris Duncan <chris@codecow.com>
Sun, 9 Aug 2026 09:13:41 +0000 (02:13 -0700)
committerChris Duncan <chris@codecow.com>
Sun, 9 Aug 2026 09:13:41 +0000 (02:13 -0700)
src/lib/wallet/accounts.ts

index 7ff6f1a1caa85510c55222baff591ce7045e8106..21a0164fa44bf2caf7b0e48ba4f6dc0005d62edf 100644 (file)
@@ -21,9 +21,12 @@ export async function _accounts (type: WalletType, accounts: Map<number, Account
        if (from < 0 || 0xffffffff < from || to < 0 || 0xffffffff < to) {
                throw new TypeError('Invalid account range', { cause: `${from}-${to}` })
        }
-       if (to - from > 10_000) {
+       if (to - from > 1_000) {
                console.warn('libnemo performance may degrade when deriving many accounts at once')
        }
+       if (to - from > 10_000) {
+               throw new RangeError('Maximum 10,000 accounts per call')
+       }
        const output = new Map<number, Account>()
        const missing: number[] = []
        for (let i = from; i <= to; i++) {