From 0585a8b2693ac492e5580013150fe7e88abd2b6a Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Fri, 22 May 2026 12:54:33 -0700 Subject: [PATCH] Fix execution output updates and provide default arg values. --- test/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/index.html b/test/index.html index d3ef3bb..2a17bc7 100644 --- a/test/index.html +++ b/test/index.html @@ -239,13 +239,14 @@ SPDX-License-Identifier: GPL-3.0-or-later console.log('%cSCORING COMPLETE', 'color:orange;font-weight:bold') } - async function execute (size, difficulty, effort, api, isOutputShown, isDebug) { + async function execute (size, difficulty, effort, api, isOutputShown = false, isDebug = false) { Cache.clear() const output = document.getElementById('output') + const status = document.getElementById('status') const times = [] let hash, result, start, end, check, isValid for (let i = 0; i < size; i++) { - document.getElementById('status').textContent.replace(`${(i || 1) - 1}/${size}`, `${i}/${size}`) + status.textContent = status.textContent.replace(`${(i || 1) - 1}/${size}`, `${i}/${size}`) hash = random() start = performance.now() result = await NanoPow.work_generate(hash, { difficulty, effort, api }) @@ -254,8 +255,7 @@ SPDX-License-Identifier: GPL-3.0-or-later check = await NanoPow.work_validate(result.work, result.hash, { difficulty, debug: isDebug }) isValid = (result.hash === hash && check.hash === hash && check.valid === '1') if (isOutputShown) { - output.textContent += `${isValid ? 'VALID' : 'INVALID'} (${end - start} ms)\n${JSON.stringify(result, ' ', 2)}` - output.innerHTML += '
' + output.textContent += `${isValid ? 'VALID' : 'INVALID'} (${end - start} ms)\n${JSON.stringify(result, ' ', 2)}\n` if (!isValid) console.log(hash, result, check) } } -- 2.52.0