diff --git a/src/main/scala/org/bitcoins/core/protocol/script/ScriptSignature.scala b/src/main/scala/org/bitcoins/core/protocol/script/ScriptSignature.scala index 8743891277..e779fb3fa6 100644 --- a/src/main/scala/org/bitcoins/core/protocol/script/ScriptSignature.scala +++ b/src/main/scala/org/bitcoins/core/protocol/script/ScriptSignature.scala @@ -107,7 +107,8 @@ object P2PKHScriptSignature extends ScriptFactory[P2PKHScriptSignature] { def isP2PKHScriptSig(asm: Seq[ScriptToken]): Boolean = asm match { case List(w : BytesToPushOntoStack, x : ScriptConstant, y : BytesToPushOntoStack, z : ScriptConstant) => - !P2SHScriptSignature.isRedeemScript(z) + if (ECPublicKey.isFullyValid(z.bytes)) true + else !P2SHScriptSignature.isRedeemScript(z) case _ => false } } diff --git a/src/test/scala/org/bitcoins/core/script/interpreter/ScriptInterpreterTest.scala b/src/test/scala/org/bitcoins/core/script/interpreter/ScriptInterpreterTest.scala index 110e2c2a64..97b8c0b1d1 100644 --- a/src/test/scala/org/bitcoins/core/script/interpreter/ScriptInterpreterTest.scala +++ b/src/test/scala/org/bitcoins/core/script/interpreter/ScriptInterpreterTest.scala @@ -31,19 +31,7 @@ class ScriptInterpreterTest extends FlatSpec with MustMatchers with ScriptInterp //use this to represent a single test case from script_valid.json /* val lines = """ - | [ - | [ - | [ - | "", - | 0.00000000 - | ], - | "0x47 0x304402200a5c6163f07b8d3b013c4d1d6dba25e780b39658d79ba37af7057a3b7f15ffa102201fd9b4eaa9943f734928b99a83592c2e7bf342ea2680f6a2bb705167966b742001", - | "0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIG", - | "P2SH,WITNESS", - | "WITNESS_UNEXPECTED", - | "P2PK with witness" - | ] - | ] + | [ ["", "0 0 0 1 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC", "OK", "Zero sigs means no sigs are checked"]] """.stripMargin*/ val lines = try source.getLines.filterNot(_.isEmpty).map(_.trim) mkString "\n" finally source.close() val json = lines.parseJson