Skip to content
Snippets Groups Projects
Commit 0f6ac6a4 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

Fix #577 Now displays all potential proofs with at least 3 zeros (constant defined)

parent c7946f4b
No related branches found
No related tags found
No related merge requests found
...@@ -150,12 +150,11 @@ function BlockGenerator() { ...@@ -150,12 +150,11 @@ function BlockGenerator() {
if (!msg.found) { if (!msg.found) {
const pow = msg.pow; const pow = msg.pow;
for (let i = 5; i >= 3; i--) { const lowPowRegexp = new RegExp('^(0{2,})[^0]');
const lowPowRegexp = new RegExp('^0{' + (i) + '}[^0]'); const matches = pow.match(lowPowRegexp);
if (pow.match(lowPowRegexp)) { // We log only proof with at least 3 zeros
logger.info('Matched %s zeros %s with Nonce = %s for block#%s', i, pow, msg.block.nonce, msg.block.number); if (matches && matches[1].length >= constants.PROOF_OF_WORK.MINIMAL_TO_SHOW) {
break; logger.info('Matched %s zeros %s with Nonce = %s for block#%s', matches[1].length, pow, msg.block.nonce, msg.block.number);
}
} }
} }
// Continue... // Continue...
......
...@@ -257,6 +257,7 @@ module.exports = { ...@@ -257,6 +257,7 @@ module.exports = {
TEST_PEERS_INTERVAL: 10 // In seconds TEST_PEERS_INTERVAL: 10 // In seconds
}, },
PROOF_OF_WORK: { PROOF_OF_WORK: {
MINIMAL_TO_SHOW: 3,
EVALUATION: 1000, EVALUATION: 1000,
RELEASE_MEMORY: 10000, RELEASE_MEMORY: 10000,
UPPER_BOUND: [ UPPER_BOUND: [
......
...@@ -79,7 +79,7 @@ process.on('message', (stuff) => co(function*() { ...@@ -79,7 +79,7 @@ process.on('message', (stuff) => co(function*() {
if (charOK) { if (charOK) {
found = pow[nbZeros].match(new RegExp('[0-' + highMark + ']')); found = pow[nbZeros].match(new RegExp('[0-' + highMark + ']'));
} }
if (!found && nbZeros > 0 && j >= Math.max(1, nbZeros - 2)) { if (!found && nbZeros > 0 && j >= constants.PROOF_OF_WORK.MINIMAL_TO_SHOW) {
yield pSend({ found: false, pow: pow, block: block, nbZeros: nbZeros }); yield pSend({ found: false, pow: pow, block: block, nbZeros: nbZeros });
} }
testsCount++; testsCount++;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment