Browse Source

per-coin target block time, used on homepage for proper tx stats display

fix-133-memory-crash
Dan Janosik 6 years ago
parent
commit
0f71adf503
No known key found for this signature in database GPG Key ID: C6F8CE9FFDB2CED2
  1. 1
      app/coins/btc.js
  2. 1
      app/coins/ltc.js
  3. 6
      routes/baseActionsRouter.js

1
app/coins/btc.js

@ -63,6 +63,7 @@ module.exports = {
"https://raw.githubusercontent.com/blockchain/Blockchain-Known-Pools/master/pools.json"
],
maxBlockWeight: 4000000,
targetBlockTimeSeconds: 600,
currencyUnits:currencyUnits,
currencyUnitsByName:{"BTC":currencyUnits[0], "mBTC":currencyUnits[1], "bits":currencyUnits[2], "sat":currencyUnits[3]},
baseCurrencyUnit:currencyUnits[3],

1
app/coins/ltc.js

@ -53,6 +53,7 @@ module.exports = {
"https://raw.githubusercontent.com/hashstream/pools/master/pools.json",
],
maxBlockWeight: 4000000,
targetBlockTimeSeconds: 150,
currencyUnits:currencyUnits,
currencyUnitsByName:{"LTC":currencyUnits[0], "lite":currencyUnits[1], "photon":currencyUnits[2], "litoshi":currencyUnits[3]},
baseCurrencyUnit:currencyUnits[3],

6
routes/baseActionsRouter.js

@ -48,8 +48,10 @@ router.get("/", function(req, res) {
res.locals.getblockchaininfo = getblockchaininfo;
if (getblockchaininfo.chain !== 'regtest') {
var chainTxStatsIntervals = [ 144, 144 * 7, 144 * 30, 144 * 365]
.filter(numBlocks => numBlocks < getblockchaininfo.blocks);
var targetBlocksPerDay = 24 * 60 * 60 / global.coinConfig.targetBlockTimeSeconds;
var chainTxStatsIntervals = [ targetBlocksPerDay, targetBlocksPerDay * 7, targetBlocksPerDay * 30, targetBlocksPerDay * 365 ]
.filter(numBlocks => numBlocks <= getblockchaininfo.blocks);
res.locals.chainTxStatsLabels = [ "24 hours", "1 week", "1 month", "1 year" ]
.slice(0, chainTxStatsIntervals.length)
.concat("All time");

Loading…
Cancel
Save