diff --git a/routes/baseActionsRouter.js b/routes/baseActionsRouter.js index f1cf51c..b7a2a30 100644 --- a/routes/baseActionsRouter.js +++ b/routes/baseActionsRouter.js @@ -48,8 +48,12 @@ router.get("/", function(req, res) { res.locals.getblockchaininfo = getblockchaininfo; if (getblockchaininfo.chain !== 'regtest') { - var chainTxStatsIntervals = [ 144, 144 * 7, 144 * 30, 144 * 365 ]; - res.locals.chainTxStatsLabels = [ "24 hours", "1 week", "1 month", "1 year", "All time" ]; + var chainTxStatsIntervals = [ 144, 144 * 7, 144 * 30, 144 * 365] + .filter(numBlocks => numBlocks < getblockchaininfo.blocks); + res.locals.chainTxStatsLabels = [ "24 hours", "1 week", "1 month", "1 year" ] + .slice(0, chainTxStatsIntervals.length) + .concat("All time"); + for (var i = 0; i < chainTxStatsIntervals.length; i++) { promises.push(coreApi.getChainTxStats(chainTxStatsIntervals[i])); }