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

This commit is contained in:
Braydon Fuller 2015-01-06 12:00:28 -05:00
parent ff4a6f549d
commit bce28cd227
3 changed files with 6 additions and 5 deletions

View File

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

View File

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

View File

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