Skip to content

Commit

Permalink
Fixed errors that occurred when certain modules were not configured/e…
Browse files Browse the repository at this point in the history
…nabled.
  • Loading branch information
zone117x committed Mar 26, 2014
1 parent 572a5ea commit 609eb0a
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 96 deletions.
6 changes: 6 additions & 0 deletions coins/helixcoin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name" : "Helixcoin",
"symbol" : "HXC",
"algorithm" : "keccak",
"txMessages" : false
}
6 changes: 6 additions & 0 deletions coins/wecoin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name" : "Wecoin",
"symbol" : "WEC",
"algorithm" : "keccak",
"txMessages" : false
}
14 changes: 14 additions & 0 deletions init.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,20 @@ var startRedisBlockListener = function(portalConfig){


var startPaymentProcessor = function(poolConfigs){

var enabledForAny = false;
for (var pool in poolConfigs){
var p = poolConfigs[pool];
var enabled = p.shareProcessing && p.shareProcessing.internal && p.shareProcessing.internal.enabled;
if (enabled){
enabledForAny = true;
break;
}
}

if (!enabledForAny)
return;

var worker = cluster.fork({
workerType: 'paymentProcessor',
pools: JSON.stringify(poolConfigs)
Expand Down
9 changes: 7 additions & 2 deletions libs/paymentProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@ module.exports = function(logger){

function SetupForPool(logger, poolOptions){

var coin = poolOptions.coin.name;
if (!poolOptions.shareProcessing ||
poolOptions.shareProcessing.internal ||
!poolOptions.shareProcessing.internal.enabled)
return;


var coin = poolOptions.coin.name;
var processingConfig = poolOptions.shareProcessing.internal;

if (!processingConfig.enabled) return;


var logSystem = 'Payments';
var logComponent = coin;
Expand Down
4 changes: 2 additions & 2 deletions libs/poolWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module.exports = function(logger){
var shareProcessing = poolOptions.shareProcessing;

//Functions required for MPOS compatibility
if (shareProcessing.mpos && shareProcessing.mpos.enabled){
if (shareProcessing && shareProcessing.mpos && shareProcessing.mpos.enabled){
var mposCompat = new MposCompatibility(logger, poolOptions)

handlers.auth = function(workerName, password, authCallback){
Expand All @@ -81,7 +81,7 @@ module.exports = function(logger){
}

//Functions required for internal payment processing
else if (shareProcessing.internal && shareProcessing.internal.enabled){
else if (shareProcessing && shareProcessing.internal && shareProcessing.internal.enabled){

var shareProcessor = new ShareProcessor(logger, poolOptions)

Expand Down
14 changes: 14 additions & 0 deletions libs/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ module.exports = function(logger, portalConfig, poolConfigs){

var _this = this;

var logSystem = 'Stats';

var redisClients = [];

var algoMultipliers = {
Expand All @@ -17,8 +19,20 @@ module.exports = function(logger, portalConfig, poolConfigs){
'sha256': Math.pow(2, 32)
};

var canDoStats = true;

Object.keys(poolConfigs).forEach(function(coin){

if (!canDoStats) return;

var poolConfig = poolConfigs[coin];

if (!poolConfig.shareProcessing || !poolConfig.shareProcessing.internal){
logger.error(logSystem, coin, 'Cannot do stats without internal share processing setup');
canDoStats = false;
return;
}

var internalConfig = poolConfig.shareProcessing.internal;
var redisConfig = internalConfig.redis;

Expand Down
92 changes: 0 additions & 92 deletions pool_configs/litecoin_testnet_example.json

This file was deleted.

0 comments on commit 609eb0a

Please sign in to comment.