Merge pull request #330 from bezreyhan/check_for_null
transaction.addInput checks if sequence is NULL
This commit is contained in:
commit
47457474ab
2 changed files with 5 additions and 2 deletions
|
@ -93,7 +93,10 @@ Transaction.fromHex = function(hex) {
|
||||||
* Note that this method does not sign the created input.
|
* Note that this method does not sign the created input.
|
||||||
*/
|
*/
|
||||||
Transaction.prototype.addInput = function(hash, index, sequence, script) {
|
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
|
script = script || Script.EMPTY
|
||||||
|
|
||||||
if (typeof hash === 'string') {
|
if (typeof hash === 'string') {
|
||||||
|
|
|
@ -117,7 +117,7 @@ describe('Transaction', function() {
|
||||||
var script = txIn.script ? Script.fromASM(txIn.script) : undefined
|
var script = txIn.script ? Script.fromASM(txIn.script) : undefined
|
||||||
var j = tx.addInput(txHash, txIn.index, txIn.sequence, script)
|
var j = tx.addInput(txHash, txIn.index, txIn.sequence, script)
|
||||||
var sequence = txIn.sequence
|
var sequence = txIn.sequence
|
||||||
if (sequence === undefined) {
|
if (sequence === undefined || sequence === null ) {
|
||||||
sequence = Transaction.DEFAULT_SEQUENCE
|
sequence = Transaction.DEFAULT_SEQUENCE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue