Skip to content

Commit

Permalink
basic Transaction test working
Browse files Browse the repository at this point in the history
  • Loading branch information
maraoz committed Mar 5, 2014
1 parent 6755b84 commit ade6f36
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 1 addition & 3 deletions Transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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());
});
Expand Down Expand Up @@ -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);
}
Expand Down
5 changes: 1 addition & 4 deletions test/test.Transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));



});
}
});
Expand Down

0 comments on commit ade6f36

Please sign in to comment.