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,7 +1182,11 @@ function BlockchainService (conn, conf, IdentityService, PeeringService) {
block.date = newTS;
}
raw = block.getRaw();
sigFunc(raw, function (err, sigResult) {
async.waterfall([
function (next){
sigFunc(raw, next);
},
function (sigResult, next){
sig = dos2unix(sigResult);
var full = raw + sig + '\n';
pow = full.hash();
......@@ -1196,7 +1200,8 @@ function BlockchainService (conn, conf, IdentityService, PeeringService) {
}
}
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