mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-24 23:08:31 +01:00
Fixing bug where single OP_0 was being classified as a MultiSignatureScriptSig
This commit is contained in:
parent
df085162a4
commit
82d5713549
2 changed files with 14 additions and 3 deletions
|
@ -22,6 +22,15 @@ class ScriptSignatureFactoryTest extends FlatSpec with MustMatchers {
|
|||
|
||||
}
|
||||
|
||||
it must "given a single 0 a scriptSignature type of non standard" in {
|
||||
val scriptSig = ScriptSignatureFactory.fromHex("00")
|
||||
val result = scriptSig match {
|
||||
case _ : NonStandardScriptSignature => true
|
||||
case _ => false
|
||||
}
|
||||
|
||||
result must be (true)
|
||||
}
|
||||
it must "build a script signature from a digital signature and a public key" in {
|
||||
val digitalSignatureBytes = TestUtil.p2pkhInputScriptAsm(1).bytes
|
||||
val digitalSignature : ECDigitalSignature = ECFactory.digitalSignature(digitalSignatureBytes)
|
||||
|
@ -51,4 +60,6 @@ class ScriptSignatureFactoryTest extends FlatSpec with MustMatchers {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ class ScriptInterpreterTest extends FlatSpec with MustMatchers with ScriptInterp
|
|||
val source = scala.io.Source.fromFile("src/test/scala/org/scalacoin/script/interpreter/script_valid.json")
|
||||
|
||||
//use this to represent a single test case from script_valid.json
|
||||
val lines =
|
||||
/* val lines =
|
||||
"""
|
||||
|
|
||||
|[[
|
||||
|
@ -93,9 +93,9 @@ class ScriptInterpreterTest extends FlatSpec with MustMatchers with ScriptInterp
|
|||
"P2SH",
|
||||
"P2SH(2-of-3)"
|
||||
]]
|
||||
""".stripMargin
|
||||
""".stripMargin*/
|
||||
|
||||
//val lines = try source.getLines.filterNot(_.isEmpty).map(_.trim) mkString "\n" finally source.close()
|
||||
val lines = try source.getLines.filterNot(_.isEmpty).map(_.trim) mkString "\n" finally source.close()
|
||||
val json = lines.parseJson
|
||||
val testCasesOpt : Seq[Option[CoreTestCase]] = json.convertTo[Seq[Option[CoreTestCase]]]
|
||||
val testCases : Seq[CoreTestCase] = testCasesOpt.flatten
|
||||
|
|
Loading…
Add table
Reference in a new issue