11var assert = require ( 'assert' )
22var bufferutils = require ( './bufferutils' )
33var crypto = require ( './crypto' )
4- var enforceType = require ( './types ' )
4+ var typeForce = require ( 'typeforce ' )
55var opcodes = require ( './opcodes' )
66var scripts = require ( './scripts' )
77
@@ -96,7 +96,7 @@ Transaction.prototype.addInput = function(hash, index, sequence, script) {
9696 if ( sequence === undefined || sequence === null ) {
9797 sequence = Transaction . DEFAULT_SEQUENCE
9898 }
99-
99+
100100 script = script || Script . EMPTY
101101
102102 if ( typeof hash === 'string' ) {
@@ -108,10 +108,10 @@ Transaction.prototype.addInput = function(hash, index, sequence, script) {
108108
109109 }
110110
111- enforceType ( 'Buffer' , hash )
112- enforceType ( 'Number' , index )
113- enforceType ( 'Number' , sequence )
114- enforceType ( Script , script )
111+ typeForce ( 'Buffer' , hash )
112+ typeForce ( 'Number' , index )
113+ typeForce ( 'Number' , sequence )
114+ typeForce ( ' Script' , script )
115115
116116 assert . equal ( hash . length , 32 , 'Expected hash length of 32, got ' + hash . length )
117117
@@ -144,8 +144,8 @@ Transaction.prototype.addOutput = function(scriptPubKey, value) {
144144 scriptPubKey = scriptPubKey . toOutputScript ( )
145145 }
146146
147- enforceType ( Script , scriptPubKey )
148- enforceType ( 'Number' , value )
147+ typeForce ( ' Script' , scriptPubKey )
148+ typeForce ( 'Number' , value )
149149
150150 // Add the output and return the output's index
151151 return ( this . outs . push ( {
@@ -197,9 +197,9 @@ Transaction.prototype.hashForSignature = function(inIndex, prevOutScript, hashTy
197197 prevOutScript = tmp
198198 }
199199
200- enforceType ( 'Number' , inIndex )
201- enforceType ( Script , prevOutScript )
202- enforceType ( 'Number' , hashType )
200+ typeForce ( 'Number' , inIndex )
201+ typeForce ( ' Script' , prevOutScript )
202+ typeForce ( 'Number' , hashType )
203203
204204 assert ( inIndex >= 0 , 'Invalid vin index' )
205205 assert ( inIndex < this . ins . length , 'Invalid vin index' )
0 commit comments