From bce28cd227d6e6c2a746ff655909c5e9e567ddad Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Tue, 6 Jan 2015 12:00:28 -0500 Subject: [PATCH] Fixed bug in IE11 that would cause MAX_MONEY verification test to fail. --- lib/transaction/output.js | 1 - lib/transaction/transaction.js | 4 ++-- test/script/interpreter.js | 6 ++++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/transaction/output.js b/lib/transaction/output.js index 896f833..9b31f66 100644 --- a/lib/transaction/output.js +++ b/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; diff --git a/lib/transaction/transaction.js b/lib/transaction/transaction.js index 5370e25..3a1f833 100644 --- a/lib/transaction/transaction.js +++ b/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); diff --git a/test/script/interpreter.js b/test/script/interpreter.js index 46bda12..3394c68 100644 --- a/test/script/interpreter.js +++ b/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); + }); }); };