mirror of https://github.com/BTCPrivate/z-nomp.git
Added block hash (solution) to redis so we can see whats going on with the invalid transactions.
This commit is contained in:
parent
c3c87e7dba
commit
42ae0a4231
15
init.js
15
init.js
|
@ -2,8 +2,6 @@ var fs = require('fs');
|
||||||
var os = require('os');
|
var os = require('os');
|
||||||
var cluster = require('cluster');
|
var cluster = require('cluster');
|
||||||
|
|
||||||
require('./libs/algoProperties.js');
|
|
||||||
|
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
var posix = require('posix');
|
var posix = require('posix');
|
||||||
var PoolLogger = require('./libs/logUtil.js');
|
var PoolLogger = require('./libs/logUtil.js');
|
||||||
|
@ -94,8 +92,19 @@ var buildPoolConfigs = function(){
|
||||||
|
|
||||||
|
|
||||||
var spawnPoolWorkers = function(portalConfig, poolConfigs){
|
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(){
|
var numForks = (function(){
|
||||||
if (!portalConfig.clustering || !portalConfig.clustering.enabled)
|
if (!portalConfig.clustering || !portalConfig.clustering.enabled)
|
||||||
|
|
|
@ -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.
|
|
|
@ -63,7 +63,7 @@ function SetupForPool(logger, poolOptions){
|
||||||
clearTimeout(reconnectTimeout);
|
clearTimeout(reconnectTimeout);
|
||||||
logger.debug(logSystem, logComponent, 'Successfully connected to redis database');
|
logger.debug(logSystem, logComponent, 'Successfully connected to redis database');
|
||||||
}).on('error', function(err){
|
}).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(){
|
}).on('end', function(){
|
||||||
logger.error(logSystem, logComponent, 'Connection to redis database as been ended');
|
logger.error(logSystem, logComponent, 'Connection to redis database as been ended');
|
||||||
logger.warning(logSystem, logComponent, 'Trying reconnection to redis in 3 seconds...');
|
logger.warning(logSystem, logComponent, 'Trying reconnection to redis in 3 seconds...');
|
||||||
|
@ -111,6 +111,7 @@ function SetupForPool(logger, poolOptions){
|
||||||
txHash: details[0],
|
txHash: details[0],
|
||||||
height: details[1],
|
height: details[1],
|
||||||
reward: details[2],
|
reward: details[2],
|
||||||
|
solution: details[3],
|
||||||
serialized: r
|
serialized: r
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -69,7 +69,7 @@ module.exports = function(logger, poolConfig){
|
||||||
|
|
||||||
if (isValidBlock){
|
if (isValidBlock){
|
||||||
redisCommands.push(['rename', coin + '_shares:roundCurrent', coin + '_shares:round' + shareData.height]);
|
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]);
|
redisCommands.push(['hincrby', coin + '_stats', 'validBlocks', 1]);
|
||||||
}
|
}
|
||||||
else if (shareData.solution){
|
else if (shareData.solution){
|
||||||
|
|
Loading…
Reference in New Issue