Browse Source

Separate max supply value per network...

Because the value configured for mainnet takes into account many known coin destructions which don't apply to testnet/regtest
master
Dan Janosik 5 years ago
parent
commit
d864c865c5
No known key found for this signature in database GPG Key ID: C6F8CE9FFDB2CED2
  1. 2
      app.js
  2. 6
      app/coins/btc.js
  3. 4
      views/includes/index-network-summary.pug

2
app.js

@ -486,8 +486,10 @@ app.use(function(req, res, next) {
}
}
// make a bunch of globals available to templates
res.locals.config = global.config;
res.locals.coinConfig = global.coinConfig;
res.locals.activeBlockchain = global.activeBlockchain;
res.locals.exchangeRates = global.exchangeRates;
res.locals.utxoSetSummary = global.utxoSetSummary;
res.locals.utxoSetSummaryPending = global.utxoSetSummaryPending;

6
app/coins/btc.js

@ -73,7 +73,11 @@ module.exports = {
maxBlockWeight: 4000000,
maxBlockSize: 1000000,
difficultyAdjustmentBlockCount: 2016,
maxSupply: new Decimal(20999817.31308491), // ref: https://bitcoin.stackexchange.com/a/38998
maxSupplyByNetwork: {
"main": new Decimal(20999817.31308491), // ref: https://bitcoin.stackexchange.com/a/38998
"test": new Decimal(21000000),
"regtest": new Decimal(21000000)
},
targetBlockTimeSeconds: 600,
targetBlockTimeMinutes: 10,
currencyUnits:currencyUnits,

4
views/includes/index-network-summary.pug

@ -176,7 +176,9 @@ div.row.index-summary
span Total Supply
td.text-right.text-monospace
if (utxoSetSummary)
span.border-dotted(title=`${new Decimal(utxoSetSummary.total_amount).dividedBy(coinConfig.maxSupply).times(100).toDP(4)}% produced`, data-toggle="tooltip") #{parseFloat(utxoSetSummary.total_amount).toLocaleString()}
- var maxSupply = coinConfig.maxSupplyByNetwork[activeBlockchain];
span.border-dotted(title=`${new Decimal(utxoSetSummary.total_amount).dividedBy(maxSupply).times(100).toDP(4)}% produced`, data-toggle="tooltip") #{parseFloat(utxoSetSummary.total_amount).toLocaleString()}
else
small.text-muted.border-dotted(title=utxoCalculatingDesc, data-toggle="tooltip") calculating...

Loading…
Cancel
Save