diff --git a/lib/api.js b/lib/api.js index cb9737bc..a3425fda 100644 --- a/lib/api.js +++ b/lib/api.js @@ -193,6 +193,9 @@ app.get('/pool/address_type/:address', function (req, res) { app.get('/pool/stats', function (req, res) { let localCache = global.database.getCache('pool_stats_global'); + if (localCache === false) { + return res.json({}); + } delete(localCache.minerHistory); delete(localCache.hashHistory); let lastPayment = global.database.getCache('lastPaymentCycle'); @@ -251,14 +254,23 @@ app.get('/pool/stats/:pool_type', function (req, res) { switch (pool_type) { case 'pplns': localCache = global.database.getCache('pool_stats_pplns'); + if (localCache === false) { + return res.json({}); + } localCache.fee = global.config.payout.pplnsFee; break; case 'pps': localCache = global.database.getCache('pool_stats_pps'); + if (localCache === false) { + return res.json({}); + } localCache.fee = global.config.payout.ppsFee; break; case 'solo': localCache = global.database.getCache('pool_stats_solo'); + if (localCache === false) { + return res.json({}); + } localCache.fee = global.config.payout.soloFee; break; case 'default':