console.log(`validate() output for good nonce 2 is ${result === true ? 'correct' : 'incorrect'}`)
expect.push(result === true)
+ result = await NP.validate('326f310d629a8a98', '204076E3364D16A018754FF67D418AB2FBEB38799FF9A29A1D5F9E34F16BEEEA', { threshold: 0xffffffff, debug: isDebug })
+ console.log(`validate() output for good max threshold nonce is ${result === true ? 'correct' : 'incorrect'}`)
+ expect.push(result === true)
+
result = await NP.validate('c5d5d6f7c5d6ccd1', '281E89AC73B1082B464B9C3C1168384F846D39F6DF25105F8B4A22915E999117', { debug: isDebug })
console.log(`validate() output for colliding nonce is ${result === true ? 'correct' : 'incorrect'}`)
expect.push(result === true)
console.log(`validate() output for bad nonce 2 is ${result === false ? 'correct' : 'incorrect'}`)
expect.push(result === false)
+ result = await NP.validate('ae238556213c3624', 'BF41D87DA3057FDC6050D2B00C06531F89F4AA6195D7C6C2EAAF15B6E703F8F6', { threshold: 0xffffffff, debug: isDebug })
+ console.log(`validate() output for bad max threshold nonce is ${result === false ? 'correct' : 'incorrect'}`)
+ expect.push(result === false)
+
result = await NP.validate('47c83266398728ce', '92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D', { debug: isDebug })
console.log(`validate() output for slightly wrong nonce is ${result === false ? 'correct' : 'incorrect'}`)
expect.push(result === false)
console.error(err)
return
}
+
console.log(`%cNanoPow (${type})`, 'color:green', `Calculate proof-of-work for ${size} unique send block hashes`)
const times = []
for (let i = 0; i < size; i++) {
function startValidation (event) {
const threshold = document.getElementById('threshold')
+ const isGlForced = document.getElementById('isGlForced')
const work = document.getElementById('work')
const hash = document.getElementById('hash')
const validation = document.getElementById('validation')
validation.innerText = '⏳'
if (work.value.length === 16 && hash.value.length === 64) {
+ const NP = isGlForced ? NanoPowGl : NanoPow
NP.validate(work.value, hash.value, { threshold: `0x${+threshold.value}` })
.then(result => {
validation.innerText = result