Update to keep the pool from repeatedly hammering the BT check.

master
Alexander Blair 7 years ago committed by Alexander Blair
parent ef7bfbac3f
commit cd61a82240

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

Loading…
Cancel
Save