Fixing bug where p2pk scriptPubKeys were not being assigned the correct case class

This commit is contained in:
Chris Stewart 2016-03-16 13:14:56 -05:00
parent f2f849f23b
commit f90b5d15d5
2 changed files with 14 additions and 0 deletions

View file

@ -34,5 +34,16 @@ class ScriptPubKeyFactoryTest extends FlatSpec with MustMatchers {
scriptPubKey.hex must be ("")
}
it must "create a p2pk scriptPubKey from its hexadecimal representation" in {
val rawScriptPubKey = TestUtil.rawP2PKScriptPubKey
val scriptPubKey = ScriptPubKeyFactory.fromHex(rawScriptPubKey)
val result = scriptPubKey match {
case script : P2PKScriptPubKey => true
case _ => false
}
result must be (true)
}
}

View file

@ -139,4 +139,7 @@ object TestUtil {
val rawP2PKScriptSig = "47304402200a5c6163f07b8d3b013c4d1d6dba25e780b39658d79ba37af7057a3b7f15ffa102201fd9b4eaa9943f734928b99a83592c2e7bf342ea2680f6a2bb705167966b742001"
def p2pkScriptSig = ScriptSignatureFactory.fromHex(rawP2PKScriptSig)
val rawP2PKScriptPubKey = "410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8ac"
def p2pkScriptPubKey = ScriptPubKeyFactory.fromHex(rawP2PKScriptPubKey)
}