Merge pull request #71 from Christewart/p2pkh_script_sig_bug_rd2

P2pkh script sig bug rd2
This commit is contained in:
Chris Stewart 2017-05-29 10:48:30 -05:00 committed by GitHub
commit 02e94ba1b6
2 changed files with 3 additions and 14 deletions

View file

@ -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
}
}

View file

@ -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