Browse Source

Fix #84 - thanks @yuhlau

fix-133-memory-crash
Dan Janosik 6 years ago
parent
commit
1675b615d1
No known key found for this signature in database GPG Key ID: C6F8CE9FFDB2CED2
  1. 10
      routes/baseActionsRouter.js

10
routes/baseActionsRouter.js

@ -44,14 +44,16 @@ router.get("/", function(req, res) {
promises.push(coreApi.getMempoolInfo());
promises.push(coreApi.getMiningInfo());
coreApi.getBlockchainInfo().then(function(getblockchaininfo) {
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" ];
for (var i = 0; i < chainTxStatsIntervals.length; i++) {
promises.push(coreApi.getChainTxStats(chainTxStatsIntervals[i]));
}
coreApi.getBlockchainInfo().then(function(getblockchaininfo) {
res.locals.getblockchaininfo = getblockchaininfo;
}
var blockHeights = [];
if (getblockchaininfo.blocks) {
@ -69,12 +71,14 @@ router.get("/", function(req, res) {
res.locals.mempoolInfo = promiseResults[0];
res.locals.miningInfo = promiseResults[1];
if (getblockchaininfo.chain !== 'regtest') {
var chainTxStats = [];
for (var i = 0; i < res.locals.chainTxStatsLabels.length; i++) {
chainTxStats.push(promiseResults[i + 2]);
}
res.locals.chainTxStats = chainTxStats;
}
res.render("index");
});

Loading…
Cancel
Save