document.getElementById('status').innerHTML = `TESTING IN PROGRESS 0/${size}<br/>`
let times
try {
- times = await execute(size, difficulty, effort, api, isOutputShown)
+ times = await execute(size, difficulty, effort, api, isOutputShown, isDebug)
} catch (err) {
output.textContent += `Error: ${err.message}`
output.innerHTML += '<br/>'
console.log('%cSCORING COMPLETE', 'color:orange;font-weight:bold')
}
- async function execute (size, difficulty, effort, api, isOutputShown = false, isDebug = false) {
+ async function execute (size, difficulty, effort, api, isOutputShown = false, debug = false) {
Cache.clear()
const output = document.getElementById('output')
const status = document.getElementById('status')
status.textContent = status.textContent.replace(prev, next)
hash = random()
start = performance.now()
- result = await NanoPow.work_generate(hash, { difficulty, effort, api })
+ result = await NanoPow.work_generate(hash, { difficulty, effort, api, debug })
end = performance.now()
times.push(end - start)
- check = await NanoPow.work_validate(result.work, result.hash, { difficulty, debug: isDebug })
+ check = await NanoPow.work_validate(result.work, result.hash, { difficulty, debug })
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)}\n`