From 7c79ceede51e30d89c3d7c2c74d32bcd49930641 Mon Sep 17 00:00:00 2001 From: Alexander Blair Date: Wed, 15 Feb 2017 16:22:35 -0800 Subject: [PATCH] Setting up port disable/lockout from the SQL into the main code base for the pool. Also making it so the API won't list a non-used pool type. --- lib/api.js | 12 +++++++++++- lib/pool.js | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/api.js b/lib/api.js index b48f12c..133f5e2 100644 --- a/lib/api.js +++ b/lib/api.js @@ -62,7 +62,17 @@ app.get('/pool/stats', function (req, res) { let localCache = global.database.getCache('pool_stats_global'); delete(localCache.minerHistory); delete(localCache.hashHistory); - res.json({pool_list: ['pplns', 'pps', 'solo'], pool_statistics: localCache}); + let pool_list = []; + if(global.config.pps.enable === true){ + pool_list.push('pps'); + } + if(global.config.solo.enable === true){ + pool_list.push('solo'); + } + if(global.config.pplns.enable === true){ + pool_list.push('pplns'); + } + res.json({pool_list: pool_list, pool_statistics: localCache}); }); app.get('/pool/chart/hashrate', function (req, res) { diff --git a/lib/pool.js b/lib/pool.js index 78b747e..097e7e2 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -715,6 +715,9 @@ if (cluster.isMaster) { bannedIPs = []; }, 60000); async.each(global.config.ports, function (portData) { + if (global.config[portData.portType].enable !== true){ + return; + } let handleMessage = function (socket, jsonData, pushMessage) { if (!jsonData.id) { console.warn('Miner RPC request missing RPC id');