Browse Source

more armor for #45

fix-133-memory-crash
Dan Janosik 7 years ago
parent
commit
90b9cd9ddc
  1. 8
      app/utils.js

8
app/utils.js

@ -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};
}

Loading…
Cancel
Save