From 42ae0a4231a8f77142089d5a8116408a56a9690b Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 27 Mar 2014 11:52:54 -0600 Subject: [PATCH] Added block hash (solution) to redis so we can see whats going on with the invalid transactions. --- init.js | 15 ++++++++++++--- libs/algoProperties.js | 4 ---- libs/paymentProcessor.js | 3 ++- libs/shareProcessor.js | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) delete mode 100644 libs/algoProperties.js diff --git a/init.js b/init.js index 2b915eb..5ecfe89 100644 --- a/init.js +++ b/init.js @@ -2,8 +2,6 @@ var fs = require('fs'); var os = require('os'); var cluster = require('cluster'); -require('./libs/algoProperties.js'); - var async = require('async'); var posix = require('posix'); var PoolLogger = require('./libs/logUtil.js'); @@ -94,8 +92,19 @@ var buildPoolConfigs = function(){ var spawnPoolWorkers = function(portalConfig, poolConfigs){ - var serializedConfigs = JSON.stringify(poolConfigs); + Object.keys(poolConfigs).forEach(function(coin){ + var p = poolConfigs[coin]; + var internalEnabled = p.shareProcessing && p.shareProcessing.internal && p.shareProcessing.internal.enabled; + var mposEnabled = p.shareProcesssing && p.shareProcessing.mpos && p.shareProcessing.mpos.enabled; + + if (!internalEnabled && !mposEnabled){ + logger.error('Master', coin, 'Share processing is not configured so a pool cannot be started for this coin.'); + delete poolConfigs[coin]; + } + }); + + var serializedConfigs = JSON.stringify(poolConfigs); var numForks = (function(){ if (!portalConfig.clustering || !portalConfig.clustering.enabled) diff --git a/libs/algoProperties.js b/libs/algoProperties.js deleted file mode 100644 index 13dbd58..0000000 --- a/libs/algoProperties.js +++ /dev/null @@ -1,4 +0,0 @@ -global.algos = { - -}; -//lets put all algo related properties in here as a global object. also put this in stratum module then borrow it for the portal. \ No newline at end of file diff --git a/libs/paymentProcessor.js b/libs/paymentProcessor.js index 8cb3dca..b80d737 100644 --- a/libs/paymentProcessor.js +++ b/libs/paymentProcessor.js @@ -63,7 +63,7 @@ function SetupForPool(logger, poolOptions){ clearTimeout(reconnectTimeout); logger.debug(logSystem, logComponent, 'Successfully connected to redis database'); }).on('error', function(err){ - paymentLogger.error('redis', 'Redis client had an error: ' + JSON.stringify(err)) + logger.error(logSystem, logComponent, 'Redis client had an error: ' + JSON.stringify(err)) }).on('end', function(){ logger.error(logSystem, logComponent, 'Connection to redis database as been ended'); logger.warning(logSystem, logComponent, 'Trying reconnection to redis in 3 seconds...'); @@ -111,6 +111,7 @@ function SetupForPool(logger, poolOptions){ txHash: details[0], height: details[1], reward: details[2], + solution: details[3], serialized: r }; }); diff --git a/libs/shareProcessor.js b/libs/shareProcessor.js index 1022858..a085a56 100644 --- a/libs/shareProcessor.js +++ b/libs/shareProcessor.js @@ -69,7 +69,7 @@ module.exports = function(logger, poolConfig){ if (isValidBlock){ redisCommands.push(['rename', coin + '_shares:roundCurrent', coin + '_shares:round' + shareData.height]); - redisCommands.push(['sadd', coin + '_blocksPending', shareData.tx + ':' + shareData.height + ':' + shareData.reward]); + redisCommands.push(['sadd', coin + '_blocksPending', shareData.tx + ':' + shareData.height + ':' + shareData.reward + ':' + shareData.solution]); redisCommands.push(['hincrby', coin + '_stats', 'validBlocks', 1]); } else if (shareData.solution){