Browse Source

- fix for total output value for txs on block details pages

- include destroyed fees when relevant on block details pages
- exclude avg fee when it's zero on block details pages
- wording fix
fix-133-memory-crash
Dan Janosik 6 years ago
parent
commit
53a2765191
  1. 33
      views/includes/block-content.pug
  2. 22
      views/includes/transaction-io-details.pug
  3. 2
      views/transaction.pug

33
views/includes/block-content.pug

@ -75,17 +75,38 @@ div(class="tab-content")
- var currencyValue = new Decimal(result.getblock.totalFees);
include ./value-display.pug
tr
td(class="properties-header") Average Fee
td(class="monospace")
- var currencyValue = new Decimal(result.getblock.totalFees).dividedBy(result.getblock.tx.length);
include ./value-display.pug
if (result.getblock.totalFees > 0)
tr
td(class="properties-header") Average Fee
td(class="monospace")
- var currencyValue = new Decimal(result.getblock.totalFees).dividedBy(result.getblock.tx.length);
include ./value-display.pug
- var coinbaseTxTotalOutputValue = new Decimal(0);
each vout in result.getblock.coinbaseTx.vout
- coinbaseTxTotalOutputValue = coinbaseTxTotalOutputValue.plus(new Decimal(vout.value));
- var blockRewardMax = coinConfig.blockRewardFunction(result.getblock.height);
if (coinbaseTxTotalOutputValue < blockRewardMax)
tr
td(class="properties-header") Fees Destroyed
td(class="text-danger")
- var currencyValue = new Decimal(blockRewardMax).minus(coinbaseTxTotalOutputValue);
include ./value-display.pug
a(class="ml-2", data-toggle="tooltip", title="The miner of this block failed to collect this value. As a result, it is lost.")
i(class="fas fa-info-circle")
if (result.getblock.weight)
tr
td(class="properties-header") Weight
td(class="monospace")
span #{result.getblock.weight.toLocaleString()} wu
span(style="") #{result.getblock.weight.toLocaleString()} wu
- var radialProgressBarPercent = new Decimal(100 * result.getblock.weight / coinConfig.maxBlockWeight).toDecimalPlaces(2);
include ./radial-progress-bar.pug
span(class="text-muted") (#{new Decimal(100 * result.getblock.weight / coinConfig.maxBlockWeight).toDecimalPlaces(2)}% full)
tr

22
views/includes/transaction-io-details.pug

@ -12,6 +12,11 @@ each txInput, txInputIndex in txInputs
- totalInputValue = totalInputValue.plus(new Decimal(vout.value));
- var totalOutputValue = new Decimal(0);
each vout, voutIndex in tx.vout
- totalOutputValue = totalOutputValue.plus(new Decimal(vout.value));
div(class="row")
div(class="col-md-6")
if (txInputs)
@ -84,13 +89,24 @@ div(class="row")
span(class="monospace") Segregated Witness committment
a(href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#commitment-structure", data-toggle="tooltip", title="View developer docs", target="_blank")
i(class="fas fa-info-circle")
else if (vout.scriptPubKey.asm && vout.scriptPubKey.asm.startsWith('OP_RETURN '))
span(class="monospace") OP_RETURN:
span(class="monospace text-muted") #{utils.hex2ascii(vout.scriptPubKey.asm.substring("OP_RETURN ".length))}
else
span(class="monospace text-danger") Unable to decode output:
br
span(class="monospace") type=#{vout.scriptPubKey.type}, asm=#{vout.scriptPubKey.asm}
span(class="monospace")
span(class="text-danger font-weight-bold") Unable to decode output:
br
span(class="font-weight-bold") type:
span #{vout.scriptPubKey.type}
br
span(class="font-weight-bold") asm:
span #{vout.scriptPubKey.asm}
br
span(class="font-weight-bold") decodedHex:
span #{utils.hex2ascii(vout.scriptPubKey.hex)}
td(class=(voutIndex == 0 ? "border-top-0" : false), class="pl-0 text-right")
- var currencyValue = vout.value;
include ./value-display.pug

2
views/transaction.pug

@ -150,7 +150,7 @@ block content
- var currencyValue = new Decimal(blockRewardMax).minus(totalOutputValue);
include includes/value-display.pug
a(class="ml-2", data-toggle="tooltip", title="The miner of this block failed to collect this value. As a result, it is lost.")
a(class="ml-2", data-toggle="tooltip", title="The miner of this transaction's block failed to collect this value. As a result, it is lost.")
i(class="fas fa-info-circle")
tr

Loading…
Cancel
Save