@@ -156,15 +156,14 @@ function isPubKeyHashInput (script) {
156156}
157157
158158function isPubKeyHashOutput ( script ) {
159- var chunks = decompile ( script )
160-
161- return chunks . length === 5 &&
162- chunks [ 0 ] === OPS . OP_DUP &&
163- chunks [ 1 ] === OPS . OP_HASH160 &&
164- Buffer . isBuffer ( chunks [ 2 ] ) &&
165- chunks [ 2 ] . length === 20 &&
166- chunks [ 3 ] === OPS . OP_EQUALVERIFY &&
167- chunks [ 4 ] === OPS . OP_CHECKSIG
159+ var buffer = compile ( script )
160+
161+ return buffer . length === 25 &&
162+ buffer [ 0 ] === OPS . OP_DUP &&
163+ buffer [ 1 ] === OPS . OP_HASH160 &&
164+ buffer [ 2 ] === 0x14 &&
165+ buffer [ 23 ] === OPS . OP_EQUALVERIFY &&
166+ buffer [ 24 ] === OPS . OP_CHECKSIG
168167}
169168
170169function isPubKeyInput ( script ) {
@@ -199,13 +198,12 @@ function isScriptHashInput (script, allowIncomplete) {
199198}
200199
201200function isScriptHashOutput ( script ) {
202- var chunks = decompile ( script )
201+ var buffer = compile ( script )
203202
204- return chunks . length === 3 &&
205- chunks [ 0 ] === OPS . OP_HASH160 &&
206- Buffer . isBuffer ( chunks [ 1 ] ) &&
207- chunks [ 1 ] . length === 20 &&
208- chunks [ 2 ] === OPS . OP_EQUAL
203+ return buffer . length === 23 &&
204+ buffer [ 0 ] === OPS . OP_HASH160 &&
205+ buffer [ 1 ] === 0x14 &&
206+ buffer [ 22 ] === OPS . OP_EQUAL
209207}
210208
211209// allowIncomplete is to account for combining signatures
0 commit comments