Merge pull request #300 from BeaudanBrown/pow-bug

Fix PoW for very low difficulty
pull/305/head
Beaudan Campbell-Brown 6 years ago committed by GitHub
commit bea2e58679
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -46,7 +46,6 @@ function calcPoW(
ttl,
pubKey,
data,
development,
difficulty = undefined,
increment = 1,
startNonce = 0
@ -56,7 +55,6 @@ function calcPoW(
ttl,
pubKey,
data,
development,
difficulty,
increment,
startNonce

@ -77,9 +77,7 @@ const pow = {
let nonce = new Uint8Array(NONCE_LEN);
nonce = pow.incrementNonce(nonce, startNonce); // initial value
let trialValue = pow.bigIntToUint8Array(
JSBI.BigInt(Number.MAX_SAFE_INTEGER)
);
let trialValue = new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255]);
const initialHash = new Uint8Array(
await crypto.subtle.digest('SHA-512', payload)
);

Loading…
Cancel
Save