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') { 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 }