diff --git a/lib/local_comms.js b/lib/local_comms.js index a6e39b6..b86bea4 100644 --- a/lib/local_comms.js +++ b/lib/local_comms.js @@ -536,8 +536,11 @@ function Database(){ // Hopping into async, we need the current block height to know where to start our indexing... async.waterfall([ function(callback){ - global.coinFuncs.getLastBlockHeader(function(body){ - callback(null, body.height, Math.floor(body.difficulty * 1.5 * global.config.pplns.shareMultiLog)); + global.coinFuncs.getLastBlockHeader(function(err, body){ + if (err) { + return callback(true, body); + } + return callback(null, body.height, Math.floor(body.difficulty * 1.5 * global.config.pplns.shareMultiLog)); }); }, function (lastBlock, difficulty, callback) { @@ -586,7 +589,7 @@ function Database(){ callback(null, blockList); } ], function(err, data){ - if (global.config.general.blockCleaner === true){ + if (err === null && global.config.general.blockCleaner === true){ if(data.length > 0){ global.database.refreshEnv(); let blockList = global.database.getBlockList();