logger.log(`work_validate() output for bad receive difficulty nonce is ${result === true ? 'correct' : 'incorrect'}`)
expect.push(result)
- const prefixes = [
- 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
- '0Xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
- '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
- ' 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn ',
- ' ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn ',
- 'fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
- ]
+ const prefixes = [
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
+ '0Xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
+ '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
+ ' 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn ',
+ ' ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn ',
+ 'fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
+ ]
for (let i = 0; i < prefixes.length; i++) {
const hash = prefixes[i]
try {
- const result = await NanoPow.work_generate(hash, options)
+ result = await NanoPow.work_generate(hash, options)
logger.log(result)
} catch (err) {
document.getElementById('output').innerHTML += `Error: ${err.message}<br/>${err.cause}<br/>${err.stack}`
if (!expect.every(result => result)) {
document.getElementById('status').innerHTML = `FAILED TO VALIDATE KNOWN VALUES`
- document.getElementById('output').innerHTML += `Error: ${err.message}<br/>`
- console.error(err)
+ document.getElementById('output').innerHTML += `Error: Failed to validate known values<br/>`
throw new Error(`Validation is not working`)
}
}
logger.isEnabled = debug
const type = api
api = type.toLowerCase()
- selfCheck(api, debug)
+ await selfCheck(api, debug)
Cache.clear()
logger.log(`%cNanoPow ${type}`, 'color:green', `Calculate truncated harmonic mean of the truncated arithmetic rate of generating proof-of-work across ${runs} runs of ${size} samples.`)
const rates = []
logger.log(rates)
logger.log(results)
document.getElementById('output').innerHTML += `<hr/>`
- document.getElementById('summary').innerHTML += `work-per-second: ${truncatedHarmonic}<br/>`
+ document.getElementById('summary').innerHTML += `Final work-per-second: ${truncatedHarmonic}<br/>`
document.getElementById('status').innerHTML = `TESTING COMPLETE<br/>`
logger.log('%TESTING COMPLETE', 'color:orange;font-weight:bold')
}