Commit f646bdf3 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

Fix: during proof-of-work, a maximum call stack size exceeded error could occur

parent 31998bfc
......@@ -1182,21 +1182,26 @@ function BlockchainService (conn, conf, IdentityService, PeeringService) {
block.date = newTS;
}
raw = block.getRaw();
sigFunc(raw, function (err, sigResult) {
sig = dos2unix(sigResult);
var full = raw + sig + '\n';
pow = full.hash();
testsCount++;
if (testsCount % 100 == 0) {
process.stdout.write('.');
} else if (testsCount % 50 == 0) {
if (newKeyblockCallback) {
computationActivated = false
next('New block received');
async.waterfall([
function (next){
sigFunc(raw, next);
},
function (sigResult, next){
sig = dos2unix(sigResult);
var full = raw + sig + '\n';
pow = full.hash();
testsCount++;
if (testsCount % 100 == 0) {
process.stdout.write('.');
} else if (testsCount % 50 == 0) {
if (newKeyblockCallback) {
computationActivated = false
next('New block received');
}
}
}
next();
});
next();
},
], next);
}, function (err) {
if (err) {
logger.debug('Proof-of-work computation canceled: valid block received');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment