mirror of
https://github.com/jwinterm/nodejs-pool.git
synced 2026-10-17 05:21:27 +02:00
Adding a check for sanity to the blockManager task.
This commit is contained in:
+6
-1
@@ -14,6 +14,7 @@ let scanInProgress = false;
|
||||
let blockHexCache = {};
|
||||
let lastBlock = 0;
|
||||
let balanceIDCache = {};
|
||||
let blockScannerTask;
|
||||
let blockQueue = async.queue(function (task, callback) {
|
||||
global.support.rpcDaemon('getblockheaderbyheight', {"height": task.blockID}, function (body) {
|
||||
let blockData = body.result.block_header;
|
||||
@@ -40,6 +41,9 @@ let blockQueue = async.queue(function (task, callback) {
|
||||
blockQueue.drain = function () {
|
||||
console.log("Scan complete, unlocking remainder of blockManager functionality.");
|
||||
scanInProgress = false;
|
||||
if (typeof(blockScannerTask) === 'undefined'){
|
||||
blockScannerTask = setInterval(blockScanner, 1000);
|
||||
}
|
||||
};
|
||||
|
||||
let createBalanceQueue = async.queue(function (task, callback) {
|
||||
@@ -475,6 +479,7 @@ function blockScanner() {
|
||||
if (inc_check === 0) {
|
||||
debug("No new work to be performed, initial scan complete");
|
||||
scanInProgress = false;
|
||||
blockScannerTask = setInterval(blockScanner, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -490,7 +495,7 @@ function initial_sync() {
|
||||
});
|
||||
}).then(function () {
|
||||
// Enable block scanning for 1 seconds to update the block log.
|
||||
setInterval(blockScanner, 1000);
|
||||
blockScanner();
|
||||
// Scan every 120 seconds for invalidated blocks
|
||||
setInterval(blockInvalidator, 120000);
|
||||
setInterval(blockUnlocker, 120000);
|
||||
|
||||
Reference in New Issue
Block a user