From 21e609b5a32004b65e0f4c9141fd6b9ce8acd3e8 Mon Sep 17 00:00:00 2001 From: joeuhren Date: Mon, 24 Jun 2019 19:43:54 -0600 Subject: [PATCH] Reverse recent /ext/summary change Reason: db.get_stats() function was originally thought to be returning the wrong supply value after changing the 'supply' value in settings.json. While it was true at first glance, the value eventually corrected itself and the original implementation is less code = faster/better --- routes/index.js | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/routes/index.js b/routes/index.js index 5502d49..d1ae74a 100644 --- a/routes/index.js +++ b/routes/index.js @@ -299,23 +299,21 @@ router.get('/ext/summary', function(req, res) { lib.get_masternodecount(function(masternodestotal){ lib.get_blockcount(function(blockcount) { db.get_stats(settings.coin, function (stats) { - lib.get_supply( function (supply){ - if (hashrate == 'There was an error. Check your console.') { - hashrate = 0; - } - var masternodesoffline = Math.floor(masternodestotal.total - masternodestotal.enabled); - res.send({ data: [{ - difficulty: difficulty, - difficultyHybrid: difficultyHybrid, - supply: supply, - hashrate: hashrate, - lastPrice: stats.last_price, - connections: connections, - masternodeCountOnline: masternodestotal.enabled, - masternodeCountOffline: masternodesoffline, - blockcount: blockcount - }]}); - }); + if (hashrate == 'There was an error. Check your console.') { + hashrate = 0; + } + var masternodesoffline = Math.floor(masternodestotal.total - masternodestotal.enabled); + res.send({ data: [{ + difficulty: difficulty, + difficultyHybrid: difficultyHybrid, + supply: stats.supply, + hashrate: hashrate, + lastPrice: stats.last_price, + connections: connections, + masternodeCountOnline: masternodestotal.enabled, + masternodeCountOffline: masternodesoffline, + blockcount: blockcount + }]}); }); }); });