|
|
@ -216,7 +216,9 @@ function getMinerFromCoinbaseTx(tx) { |
|
|
|
|
|
|
|
function getTxTotalInputOutputValues(tx, txInputs, blockHeight) { |
|
|
|
var totalInputValue = new Decimal(0); |
|
|
|
var totalOutputValue = new Decimal(0); |
|
|
|
|
|
|
|
try { |
|
|
|
for (var i = 0; i < tx.vin.length; i++) { |
|
|
|
if (tx.vin[i].coinbase) { |
|
|
|
totalInputValue = totalInputValue.plus(new Decimal(coinConfig.blockRewardFunction(blockHeight))); |
|
|
@ -237,12 +239,12 @@ function getTxTotalInputOutputValues(tx, txInputs, blockHeight) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var totalOutputValue = new Decimal(0); |
|
|
|
|
|
|
|
for (var i = 0; i < tx.vout.length; i++) { |
|
|
|
totalOutputValue = totalOutputValue.plus(new Decimal(tx.vout[i].value)); |
|
|
|
} |
|
|
|
} catch (err) { |
|
|
|
console.log("Error computing total input/output values for tx: err=" + err + ", tx=" + JSON.stringify(tx) + ", txInputs=" + JSON.stringify(txInputs) + ", blockHeight=" + blockHeight); |
|
|
|
} |
|
|
|
|
|
|
|
return {input:totalInputValue, output:totalOutputValue}; |
|
|
|
} |
|
|
|