]> zoso.dev Git - nano-pow.git/commitdiff
Fix command arguments being popped one too many times.
authorChris Duncan <chris@zoso.dev>
Tue, 11 Mar 2025 21:05:04 +0000 (14:05 -0700)
committerChris Duncan <chris@zoso.dev>
Tue, 11 Mar 2025 21:05:04 +0000 (14:05 -0700)
cli.js

diff --git a/cli.js b/cli.js
index e8e7f3193854ceb1216d2d39163464ac0485a6ab..5656b8780a620ac9d02f3b593c5c7dcb15e30f90 100755 (executable)
--- a/cli.js
+++ b/cli.js
@@ -7,10 +7,8 @@ import * as fs from 'node:fs/promises'
 
 const args = process.argv.slice(2)
 const hashes = []
-let hash = args.pop()
-while (/^[0-9A-Fa-f]{64}$/.test(hash ?? '')) {
-       hashes.unshift(hash)
-       hash = args.pop()
+while (/^[0-9A-Fa-f]{64}$/.test(args[args.length - 1] ?? '')) {
+       hashes.unshift(args.pop())
 }
 if (hashes.length === 0) {
        console.error('Invalid block hash input')