Browse Source

stop duplicating value-display markup

fix-133-memory-crash
Dan Janosik 7 years ago
parent
commit
1daa78b318
  1. 39
      views/includes/block-content.pug
  2. 5
      views/includes/value-display.pug
  3. 56
      views/transaction.pug

39
views/includes/block-content.pug

@ -141,11 +141,9 @@ div(class="tab-content")
td
span(class="tag monospace") coinbase
span(class="monospace") Newly minted coins
td(class="monospace") #{utils.formatCurrencyAmount(utils.getBlockReward(result.getblock.height), currencyFormatType)}
if (global.exchangeRate)
span
span(data-toggle="tooltip", title=utils.formatExchangedCurrency(utils.getBlockReward(result.getblock.height)))
i(class="fas fa-exchange-alt")
td
- var currencyValue = utils.getBlockReward(result.getblock.height);
include ./value-display.pug
each txInput, txInputIndex in result.txInputsByTransaction[tx.txid]
if (txInput)
@ -164,11 +162,9 @@ div(class="tab-content")
td
if (vout.value)
- totalInputValue = totalInputValue.plus(new Decimal(vout.value));
span(class="monospace") #{utils.formatCurrencyAmount(vout.value, currencyFormatType)}
if (global.exchangeRate)
span
span(data-toggle="tooltip", title=utils.formatExchangedCurrency(vout.value))
i(class="fas fa-exchange-alt")
- var currencyValue = vout.value;
include ./value-display.pug
- var coinbaseCount = tx.vin[0].coinbase ? 1 : 0;
if ((tx.vin.length - coinbaseCount) > result.txInputsByTransaction[tx.txid].length)
@ -182,11 +178,9 @@ div(class="tab-content")
td
td
td
strong(class="monospace") #{utils.formatCurrencyAmount(totalInputValue, currencyFormatType)}
if (global.exchangeRate)
span
span(data-toggle="tooltip", title=utils.formatExchangedCurrency(totalInputValue))
i(class="fas fa-exchange-alt")
strong
- var currencyValue = totalInputValue;
include ./value-display.pug
div(class="col-md-6")
@ -217,11 +211,8 @@ div(class="tab-content")
span(class="monospace") OP_RETURN:
span(class="monospace text-muted") #{utils.hex2ascii(vout.scriptPubKey.asm.substring("OP_RETURN ".length))}
td
span(class="monospace") #{utils.formatCurrencyAmount(vout.value, currencyFormatType)}
if (global.exchangeRate)
span
span(data-toggle="tooltip", title=utils.formatExchangedCurrency(vout.value))
i(class="fas fa-exchange-alt")
- var currencyValue = vout.value;
include ./value-display.pug
- totalOutputValue = totalOutputValue.plus(vout.value);
@ -229,11 +220,9 @@ div(class="tab-content")
td
td
td
strong(class="monospace") #{utils.formatCurrencyAmount(totalOutputValue, currencyFormatType)}
if (global.exchangeRate)
span
span(data-toggle="tooltip", title=utils.formatExchangedCurrency(totalOutputValue))
i(class="fas fa-exchange-alt")
strong
- var currencyValue = totalOutputValue;
include ./value-display.pug
//pre
// code #{JSON.stringify(tx, null, 4)}

5
views/includes/value-display.pug

@ -0,0 +1,5 @@
span(class="monospace") #{utils.formatCurrencyAmount(currencyValue, currencyFormatType)}
if (global.exchangeRate)
span
span(data-toggle="tooltip", title=utils.formatExchangedCurrency(currencyValue))
i(class="fas fa-exchange-alt")

56
views/transaction.pug

@ -112,21 +112,17 @@ block content
if (result.getrawtransaction.vin[0].coinbase)
tr
th(class="table-active properties-header") Total Network Fees
td(class="monospace")
span #{utils.formatCurrencyAmount(new Decimal(totalOutputValue).minus(totalInputValue), currencyFormatType)}
if (global.exchangeRate)
span
span(data-toggle="tooltip", title=utils.formatExchangedCurrency(new Decimal(totalOutputValue).minus(totalInputValue)))
i(class="fas fa-exchange-alt")
td
- var currencyValue = new Decimal(totalOutputValue).minus(totalInputValue);
include includes/value-display.pug
else
tr
th(class="table-active properties-header") Network Fee Paid
td(class="monospace")
strong #{utils.formatCurrencyAmount(new Decimal(totalInputValue).minus(totalOutputValue), currencyFormatType)}
if (global.exchangeRate)
span
span(data-toggle="tooltip", title=utils.formatExchangedCurrency(new Decimal(totalInputValue).minus(totalOutputValue)))
i(class="fas fa-exchange-alt")
strong
- var currencyValue = new Decimal(totalInputValue).minus(totalOutputValue);
include includes/value-display.pug
span(class="text-muted") (#{utils.formatCurrencyAmount(totalInputValue, currencyFormatType)} - #{utils.formatCurrencyAmount(totalOutputValue, currencyFormatType)})
br
span ~#{new DecimalRounded(totalInputValue).minus(totalOutputValue).dividedBy(result.getrawtransaction.size).times(100000000)} sat/B
@ -169,11 +165,9 @@ block content
td
span(class="tag monospace") coinbase
span(class="monospace") Newly minted coins
td(class="monospace") #{utils.formatCurrencyAmount(utils.getBlockReward(result.getblock.height), currencyFormatType)}
if (global.exchangeRate)
span
span(data-toggle="tooltip", title=utils.formatExchangedCurrency(utils.getBlockReward(result.getblock.height)))
i(class="fas fa-exchange-alt")
td
- var currencyValue = utils.getBlockReward(result.getblock.height);
include includes/value-display.pug
each txInput, txInputIndex in result.txInputs
if (txInput)
@ -191,21 +185,16 @@ block content
a(href=("/tx/" + txInput.txid + "#output-" + result.getrawtransaction.vin[txInputIndex].vout), class="monospace") #{txInput.txid.substring(0, 14)}..., Output ##{result.getrawtransaction.vin[txInputIndex].vout + 1}
td
if (vout.value)
span(class="monospace") #{utils.formatCurrencyAmount(vout.value, currencyFormatType)}
if (global.exchangeRate)
span
span(data-toggle="tooltip", title=utils.formatExchangedCurrency(vout.value))
i(class="fas fa-exchange-alt")
- var currencyValue = vout.value;
include includes/value-display.pug
tr
td
td
td
strong(class="monospace") #{utils.formatCurrencyAmount(totalInputValue, currencyFormatType)}
if (global.exchangeRate)
span
span(data-toggle="tooltip", title=utils.formatExchangedCurrency(totalInputValue))
i(class="fas fa-exchange-alt")
strong
- var currencyValue = totalInputValue;
include includes/value-display.pug
div(class="col-md-6")
@ -234,21 +223,16 @@ block content
span(class="monospace") OP_RETURN:
span(class="monospace text-muted") #{utils.hex2ascii(vout.scriptPubKey.asm.substring("OP_RETURN ".length))}
td
span(class="monospace") #{utils.formatCurrencyAmount(vout.value, currencyFormatType)}
if (global.exchangeRate)
span
span(data-toggle="tooltip", title=utils.formatExchangedCurrency(vout.value))
i(class="fas fa-exchange-alt")
- var currencyValue = vout.value;
include includes/value-display.pug
tr
td
td
td
strong(class="monospace") #{utils.formatCurrencyAmount(totalOutputValue, currencyFormatType)}
if (global.exchangeRate)
span
span(data-toggle="tooltip", title=utils.formatExchangedCurrency(totalOutputValue))
i(class="fas fa-exchange-alt")
strong
- var currencyValue = totalOutputValue;
include includes/value-display.pug
div(id="tab-scripts", class="tab-pane", role="tabpanel")
h3 Input Scripts

Loading…
Cancel
Save