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