import 'nano-webgl-pow'
await suite('Block performance', async () => {
- const COUNT = 0x1
+ const COUNT = 0x10
await test(`Customized PoW: Time to calculate proof-of-work for a send block ${COUNT} times`, async () => {
const times = []
(local_id.x & 0xff);
var m: array<u32, 16>;
m[0u] = id;
- m[1u] = id;
+ m[1u] = reverseBits(id);
m[2u] = ubo.blockhash[0u].x;
m[3u] = ubo.blockhash[0u].y;
m[4u] = ubo.blockhash[0u].z;
m[8u] = ubo.blockhash[1u].z;
m[9u] = ubo.blockhash[1u].w;
-
/**
* Compression buffer, intialized to 2 instances of the initialization vector
* The following values have been modified from the BLAKE2B_IV:
/**
* Iterate and hash until nonce found
*/
- for (var j: u32 = id; j < id + 1u; j = j + 1u) {
+ for (var j: u32 = 0u; j < 0x1u; j = j + 1u) {
if (atomicLoad(&work.found) != 0u) {
return;
}
- m[0u] = j;
+ m[0u] = m[0u] ^ j;
// twelve rounds of mixing
for (var i: u32 = 0u; i < 12u; i = i + 1u) {
// Store the result directly into work array
if ((BLAKE2B_IV32_1 ^ v[1u] ^ v[17u]) > ubo.threshold) {
atomicStore(&work.found, 1u);
- work.nonce.x = id;
- work.nonce.y = j;
+ work.nonce.x = m[0];
+ work.nonce.y = m[1];
return;
}
}