Update with fixes to finish getting AEON working and to block things from blocking when I don't expect them to.

AEON has a block on the way it does chain saving, which can lock up many portions of the blockManager daemon.  This is now patched in blockmanager.
This commit is contained in:
Alexander Blair
2017-10-13 12:01:19 -07:00
parent 5d31708abf
commit 667bc5a029
7 changed files with 81 additions and 51 deletions
+38 -25
View File
@@ -421,22 +421,29 @@ function blockPayments(block) {
switch (block.poolType) {
case global.protos.POOLTYPE.PPS:
// PPS is paid out per share find per block, so this is handled in the main block-find loop.
global.database.unlockBlock(block.hash);
break;
case global.protos.POOLTYPE.PPLNS:
global.coinFuncs.getBlockHeaderByHash(block.hash, function (header) {
calculatePPLNSPayments(header);
global.coinFuncs.getBlockHeaderByHash(block.hash, function (err, header) {
if (err === null){
calculatePPLNSPayments(header);
global.database.unlockBlock(block.hash);
}
});
break;
case global.protos.POOLTYPE.SOLO:
global.coinFuncs.getBlockHeaderByHash(block.hash, function (header) {
calculateSoloPayments(header);
global.coinFuncs.getBlockHeaderByHash(block.hash, function (err, header) {
if (err === null){
calculateSoloPayments(header);
global.database.unlockBlock(block.hash);
}
});
break;
default:
console.log("Unknown payment type. FREAKOUT");
global.database.unlockBlock(block.hash);
break;
}
global.database.unlockBlock(block.hash);
}
function blockScanner() {
@@ -446,27 +453,33 @@ function blockScanner() {
return;
}
scanInProgress = true;
global.coinFuncs.getLastBlockHeader(function (blockHeader) {
if (lastBlock === blockHeader.height) {
debug("No new work to be performed, block header matches last block");
scanInProgress = false;
return;
}
debug("Parsing data for new blocks");
lastBlock = blockHeader.height;
range.range(0, (blockHeader.height - Math.floor(global.config.payout.blocksRequired/2))).forEach(function (blockID) {
if (!blockIDCache.hasOwnProperty(blockID)) {
inc_check += 1;
blockQueue.push({blockID: blockID}, function (err) {
debug("Completed block scan on " + blockID);
if (err) {
console.error("Error processing " + blockID);
}
});
global.coinFuncs.getLastBlockHeader(function (err, blockHeader) {
if (err === null){
if (lastBlock === blockHeader.height) {
debug("No new work to be performed, block header matches last block");
scanInProgress = false;
return;
}
});
if (inc_check === 0) {
debug("No new work to be performed, initial scan complete");
debug("Parsing data for new blocks");
lastBlock = blockHeader.height;
range.range(0, (blockHeader.height - Math.floor(global.config.payout.blocksRequired/2))).forEach(function (blockID) {
if (!blockIDCache.hasOwnProperty(blockID)) {
inc_check += 1;
blockQueue.push({blockID: blockID}, function (err) {
debug("Completed block scan on " + blockID);
if (err) {
console.error("Error processing " + blockID);
}
});
}
});
if (inc_check === 0) {
debug("No new work to be performed, initial scan complete");
scanInProgress = false;
blockScannerTask = setInterval(blockScanner, 1000);
}
} else {
console.error(`Upstream error from the block daemon. Resetting scanner due to: ${JSON.stringify(blockHeader)}`);
scanInProgress = false;
blockScannerTask = setInterval(blockScanner, 1000);
}