From 044c53bcad2e28f90d406f7a1ccfb1aca23073e7 Mon Sep 17 00:00:00 2001 From: Bez Reyhan Date: Fri, 12 Dec 2014 12:28:26 -0800 Subject: [PATCH 1/3] transaction.addInput checks if sequence is NULL --- src/transaction.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/transaction.js b/src/transaction.js index 8a40709..167126c 100644 --- a/src/transaction.js +++ b/src/transaction.js @@ -93,7 +93,10 @@ Transaction.fromHex = function(hex) { * Note that this method does not sign the created input. */ Transaction.prototype.addInput = function(hash, index, sequence, script) { - if (sequence === undefined) sequence = Transaction.DEFAULT_SEQUENCE + if (sequence === undefined || sequence === null) { + sequence = Transaction.DEFAULT_SEQUENCE + } + script = script || Script.EMPTY if (typeof hash === 'string') { From 1c6d5a28a968a63f87f3631a1f6ea0e3b040c8af Mon Sep 17 00:00:00 2001 From: Bez Reyhan Date: Mon, 15 Dec 2014 19:21:34 -0800 Subject: [PATCH 2/3] update fixtures and tests for merge --- test/fixtures/transaction.json | 5 +++++ test/transaction.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/test/fixtures/transaction.json b/test/fixtures/transaction.json index 9ddbfb0..32dad1d 100644 --- a/test/fixtures/transaction.json +++ b/test/fixtures/transaction.json @@ -65,6 +65,11 @@ "version": 1, "locktime": 0, "ins": [ + { + "hash": "2afdde042a49d7cf5c34c9ec2331049bb8cbc5841d7324748eab52bf10dfb954", + "index": 1, + "script": null + }, { "hash": "e7b73e229790c1e79a02f0c871813b3cf26a4156c5b8d942e88b38fe8d3f43a0", "index": 0, diff --git a/test/transaction.js b/test/transaction.js index 41f94f6..b54185e 100644 --- a/test/transaction.js +++ b/test/transaction.js @@ -117,7 +117,7 @@ describe('Transaction', function() { var script = txIn.script ? Script.fromASM(txIn.script) : undefined var j = tx.addInput(txHash, txIn.index, txIn.sequence, script) var sequence = txIn.sequence - if (sequence === undefined) { + if (sequence === undefined || sequence === null ) { sequence = Transaction.DEFAULT_SEQUENCE } From 85979a062e551a4032123cbfa23348ff4062db98 Mon Sep 17 00:00:00 2001 From: Bez Reyhan Date: Mon, 15 Dec 2014 20:10:32 -0800 Subject: [PATCH 3/3] remove fixture --- test/fixtures/transaction.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/test/fixtures/transaction.json b/test/fixtures/transaction.json index 32dad1d..9ddbfb0 100644 --- a/test/fixtures/transaction.json +++ b/test/fixtures/transaction.json @@ -65,11 +65,6 @@ "version": 1, "locktime": 0, "ins": [ - { - "hash": "2afdde042a49d7cf5c34c9ec2331049bb8cbc5841d7324748eab52bf10dfb954", - "index": 1, - "script": null - }, { "hash": "e7b73e229790c1e79a02f0c871813b3cf26a4156c5b8d942e88b38fe8d3f43a0", "index": 0,