From ade6f36c34a3b0421ff7e9777656ee28f5c34c27 Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Fri, 28 Feb 2014 09:37:02 -0300 Subject: [PATCH] basic Transaction test working --- Transaction.js | 4 +--- test/test.Transaction.js | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Transaction.js b/Transaction.js index 16564e9..94531a7 100644 --- a/Transaction.js +++ b/Transaction.js @@ -26,7 +26,7 @@ function spec(b) { if (data.o) { this.o = data.o; } else { - if (data.oTxHash && typeof data.oIndex !== 'undefined') { + if (data.oTxHash && typeof data.oIndex !== 'undefined' && data.oIndex >= 0) { var hash = new Buffer(data.oTxHash, 'hex'); hash = buffertools.reverse(hash); var voutBuf = new Buffer(4); @@ -153,7 +153,6 @@ function spec(b) { bufs.push(buf); bufs.push(util.varIntBuf(this.ins.length)); - console.log(this.ins.length); this.ins.forEach(function (txin) { bufs.push(txin.serialize()); }); @@ -650,7 +649,6 @@ function spec(b) { Transaction.prototype.parse = function (parser) { if (Buffer.isBuffer(parser)) { - console.dir(parser); this._buffer = parser; parser = new Parser(parser); } diff --git a/test/test.Transaction.js b/test/test.Transaction.js index 570a0b0..989a634 100644 --- a/test/test.Transaction.js +++ b/test/test.Transaction.js @@ -55,13 +55,10 @@ describe('Transaction', function() { ins.push(input); }); - var raw = new Buffer(datum[1]); + var raw = new Buffer(datum[1], 'hex'); var tx = new Transaction(); tx.parse(raw); buffertools.toHex(tx.serialize()).should.equal(buffertools.toHex(raw)); - - - }); } });