Browse Source

Fixed bug in IE11 that would cause MAX_MONEY verification test to fail.

patch-2
Braydon Fuller 10 years ago
parent
commit
bce28cd227
  1. 1
      lib/transaction/output.js
  2. 4
      lib/transaction/transaction.js
  3. 6
      test/script/interpreter.js

1
lib/transaction/output.js

@ -83,7 +83,6 @@ Output.prototype.setScript = function(script) {
this._scriptBuffer = script;
this._script = null;
} else {
console.log(script);
throw new TypeError('Unrecognized Argument');
}
return this;

4
lib/transaction/transaction.js

@ -656,11 +656,11 @@ Transaction.prototype.verify = function() {
var valueoutbn = BN(0);
for (var i = 0; i < this.outputs.length; i++) {
var txout = this.outputs[i];
var valuebn = BN(txout.satoshis.toString(16));
var valuebn = txout._satoshis;
if (valuebn.lt(0)) {
return 'transaction txout ' + i + ' negative';
}
if (valuebn.gt(Transaction.MAX_MONEY)) {
if (valuebn.gt(BN(Transaction.MAX_MONEY, 10))) {
return 'transaction txout ' + i + ' greater than MAX_MONEY';
}
valueoutbn = valueoutbn.add(valuebn);

6
test/script/interpreter.js

@ -259,7 +259,8 @@ describe('Interpreter', function() {
return;
}
c++;
it('should pass tx_' + (expected ? '' : 'in') + 'valid vector ' + c, function() {
var cc = c; //copy to local
it('should pass tx_' + (expected ? '' : 'in') + 'valid vector ' + cc, function() {
var inputs = vector[0];
var txhex = vector[1];
var flags = getFlags(vector[2]);
@ -291,9 +292,10 @@ describe('Interpreter', function() {
}
});
var txVerified = tx.verify();
txVerified = _.isBoolean(txVerified);
txVerified = (txVerified === true) ? true : false;
allInputsVerified = allInputsVerified && txVerified;
allInputsVerified.should.equal(expected);
});
});
};

Loading…
Cancel
Save