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

Fix: proof of work was never canceled

parent 5acfd05e
Branches
Tags
No related merge requests found
...@@ -1126,16 +1126,18 @@ function BlockchainService (conf, mainDAL, pair) { ...@@ -1126,16 +1126,18 @@ function BlockchainService (conf, mainDAL, pair) {
secretKeyEnc: base58.encode(pair.secretKey) secretKeyEnc: base58.encode(pair.secretKey)
} }
}); });
} else if (!stopped && !msg.found) { } else if (!stopped) {
if (!msg.found) {
var pow = msg.pow; var pow = msg.pow;
for (let i = 5; i >= 3; i--) { for (let i = 5; i >= 3; i--) {
var lowPowRegexp = new RegExp('^0{' + (i) + '}[^0]'); var lowPowRegexp = new RegExp('^0{' + (i) + '}[^0]');
if (pow.match(lowPowRegexp)) { if (pow.match(lowPowRegexp)) {
logger.info('Matched %s zeros %s with Nonce = %s', i, pow, msg.block.nonce); logger.info('Matched %s zeros %s with Nonce = %s for block#%s', i, pow, msg.block.nonce, msg.block.number);
break; break;
} }
} }
} else if (!stopped) { }
// Continue... // Continue...
//console.log('Already made: %s tests...', msg.nonce); //console.log('Already made: %s tests...', msg.nonce);
// Look for incoming block // Look for incoming block
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment