convert internal script generation to use ScriptBuilder.

Also, unexport the functions to generate script types. Everything should
(and is) be using PayToAddrScript() with an address type instead of
throwing bytes around.

discussed with #@davecgh
This commit is contained in:
Owain G. Ainsworth 2014-02-20 17:39:03 +00:00
parent cff7f9704b
commit 1566366346
3 changed files with 129 additions and 191 deletions

View file

@ -1001,46 +1001,20 @@ func getSigOpCount(pops []parsedOpcode, precise bool) int {
return nSigs
}
// PayToPubKeyHashScript creates a new script to pay a transaction
// output to a 20-byte pubkey hash.
func PayToPubKeyHashScript(pubKeyHash []byte) (pkScript []byte, err error) {
pops := []parsedOpcode{
{
opcode: opcodemap[OP_DUP],
},
{
opcode: opcodemap[OP_HASH160],
},
{
opcode: opcodemap[OP_DATA_20],
data: pubKeyHash,
},
{
opcode: opcodemap[OP_EQUALVERIFY],
},
{
opcode: opcodemap[OP_CHECKSIG],
},
}
return unparseScript(pops)
// payToPubKeyHashScript creates a new script to pay a transaction
// output to a 20-byte pubkey hash. It is expected that the input is a valid
// hash.
func payToPubKeyHashScript(pubKeyHash []byte) []byte {
return NewScriptBuilder().PushOp(OP_DUP).PushOp(OP_HASH160).
PushData(pubKeyHash).PushOp(OP_EQUALVERIFY).PushOp(OP_CHECKSIG).
Script()
}
// PayToScriptHashScript creates a new script to pay a transaction output to a
// script hash.
func PayToScriptHashScript(scriptHash []byte) (pkScript []byte, err error) {
pops := []parsedOpcode{
{
opcode: opcodemap[OP_HASH160],
},
{
opcode: opcodemap[OP_DATA_20],
data: scriptHash,
},
{
opcode: opcodemap[OP_EQUAL],
},
}
return unparseScript(pops)
// payToScriptHashScript creates a new script to pay a transaction output to a
// script hash. It is expected that the input is a valid hash.
func payToScriptHashScript(scriptHash []byte) []byte {
return NewScriptBuilder().PushOp(OP_HASH160).PushData(scriptHash).
PushOp(OP_EQUAL).Script()
}
// PayToAddrScript creates a new script to pay a transaction output to a the
@ -1052,13 +1026,13 @@ func PayToAddrScript(addr btcutil.Address) ([]byte, error) {
if addr == nil {
return nil, ErrUnsupportedAddress
}
return PayToPubKeyHashScript(addr.ScriptAddress())
return payToPubKeyHashScript(addr.ScriptAddress()), nil
case *btcutil.AddressScriptHash:
if addr == nil {
return nil, ErrUnsupportedAddress
}
return PayToScriptHashScript(addr.ScriptAddress())
return payToScriptHashScript(addr.ScriptAddress()), nil
}
return nil, ErrUnsupportedAddress
@ -1074,7 +1048,6 @@ func PayToAddrScript(addr btcutil.Address) ([]byte, error) {
// compress. This format must match the same format used to generate
// the payment address, or the script validation will fail.
func SignatureScript(tx *btcwire.MsgTx, idx int, subscript []byte, hashType byte, privkey *ecdsa.PrivateKey, compress bool) ([]byte, error) {
return signatureScriptCustomReader(rand.Reader, tx, idx, subscript,
hashType, privkey, compress)
}
@ -1098,26 +1071,14 @@ func signatureScriptCustomReader(reader io.Reader, tx *btcwire.MsgTx, idx int,
sig := append(ecSig.Serialize(), hashType)
pk := (*btcec.PublicKey)(&privkey.PublicKey)
var pubkeyOpcode *parsedOpcode
var pkData []byte
if compress {
pubkeyOpcode = &parsedOpcode{
opcode: opcodemap[OP_DATA_33],
data: pk.SerializeCompressed(),
}
pkData = pk.SerializeCompressed()
} else {
pubkeyOpcode = &parsedOpcode{
opcode: opcodemap[OP_DATA_65],
data: pk.SerializeUncompressed(),
}
pkData = pk.SerializeUncompressed()
}
pops := []parsedOpcode{
{
opcode: opcodemap[byte(len(sig))],
data: sig,
},
*pubkeyOpcode,
}
return unparseScript(pops)
return NewScriptBuilder().PushData(sig).PushData(pkData).Script(), nil
}
// expectedInputs returns the number of arguments required by a script.

View file

@ -2429,33 +2429,6 @@ func TestCheckErrorCondition(t *testing.T) {
}
}
func TestPayToPubKeyHashScript(t *testing.T) {
validaddr := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20}
invalidaddr := validaddr[:len(validaddr)-2]
expected := []byte{btcscript.OP_DUP, btcscript.OP_HASH160,
btcscript.OP_DATA_20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, btcscript.OP_EQUALVERIFY,
btcscript.OP_CHECKSIG}
script, err := btcscript.PayToPubKeyHashScript(validaddr)
if err != nil {
t.Error(err)
return
}
if !bytes.Equal(script, expected) {
t.Error("Unexpected script result.")
return
}
_, err = btcscript.PayToPubKeyHashScript(invalidaddr)
if err == nil {
t.Error("Erroneously created script for invalid address.")
return
}
}
type TstSigScript struct {
name string
inputs []TstInput

View file

@ -1,165 +1,169 @@
github.com/conformal/btcscript/opcode.go opcodeCheckMultiSig 100.00% (62/62)
github.com/conformal/btcscript/script.go Script.Step 100.00% (37/37)
github.com/conformal/btcscript/script.go Script.Step 100.00% (38/38)
github.com/conformal/btcscript/script.go parseScriptTemplate 100.00% (30/30)
github.com/conformal/btcscript/address.go ExtractPkScriptAddrs 100.00% (27/27)
github.com/conformal/btcscript/script.go CalcScriptInfo 100.00% (25/25)
github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.PushData 100.00% (24/24)
github.com/conformal/btcscript/opcode.go parsedOpcode.bytes 100.00% (23/23)
github.com/conformal/btcscript/script.go NewScript 100.00% (21/21)
github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.PushData 100.00% (21/21)
github.com/conformal/btcscript/stack.go asInt 100.00% (21/21)
github.com/conformal/btcscript/script.go NewScript 100.00% (21/21)
github.com/conformal/btcscript/opcode.go parsedOpcode.print 100.00% (16/16)
github.com/conformal/btcscript/script.go signatureScriptCustomReader 100.00% (16/16)
github.com/conformal/btcscript/stack.go Stack.nipN 100.00% (14/14)
github.com/conformal/btcscript/stack.go Stack.nipN 100.00% (15/15)
github.com/conformal/btcscript/script.go signatureScriptCustomReader 100.00% (15/15)
github.com/conformal/btcscript/stack.go fromInt 100.00% (14/14)
github.com/conformal/btcscript/opcode.go opcodeWithin 100.00% (13/13)
github.com/conformal/btcscript/script.go GetPreciseSigOpCount 100.00% (13/13)
github.com/conformal/btcscript/script.go isMultiSig 100.00% (13/13)
github.com/conformal/btcscript/opcode.go opcodeWithin 100.00% (13/13)
github.com/conformal/btcscript/script.go Script.CheckErrorCondition 100.00% (11/11)
github.com/conformal/btcscript/script.go typeOfScript 100.00% (11/11)
github.com/conformal/btcscript/opcode.go opcodeIf 100.00% (11/11)
github.com/conformal/btcscript/opcode.go opcodeNotIf 100.00% (11/11)
github.com/conformal/btcscript/opcode.go opcodeMax 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeMin 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeGreaterThan 100.00% (10/10)
github.com/conformal/btcscript/script.go getSigOpCount 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeNumEqual 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeBoolOr 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeBoolAnd 100.00% (10/10)
github.com/conformal/btcscript/stack.go Stack.Tuck 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeGreaterThanOrEqual 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeLessThanOrEqual 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeLessThan 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeBoolAnd 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeBoolOr 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeNumEqual 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeNumNotEqual 100.00% (10/10)
github.com/conformal/btcscript/script.go DisasmString 100.00% (9/9)
github.com/conformal/btcscript/stack.go Stack.RotN 100.00% (9/9)
github.com/conformal/btcscript/opcode.go opcodeLessThan 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeGreaterThan 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeGreaterThanOrEqual 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeMin 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeMax 100.00% (10/10)
github.com/conformal/btcscript/script.go getSigOpCount 100.00% (10/10)
github.com/conformal/btcscript/stack.go Stack.Tuck 100.00% (10/10)
github.com/conformal/btcscript/stack.go Stack.OverN 100.00% (9/9)
github.com/conformal/btcscript/stack.go Stack.SwapN 100.00% (9/9)
github.com/conformal/btcscript/opcode.go opcodeSub 100.00% (8/8)
github.com/conformal/btcscript/stack.go Stack.RotN 100.00% (9/9)
github.com/conformal/btcscript/script.go DisasmString 100.00% (9/9)
github.com/conformal/btcscript/script.go Script.Execute 100.00% (8/8)
github.com/conformal/btcscript/script.go PayToAddrScript 100.00% (8/8)
github.com/conformal/btcscript/stack.go Stack.DupN 100.00% (8/8)
github.com/conformal/btcscript/opcode.go opcodeSub 100.00% (8/8)
github.com/conformal/btcscript/opcode.go opcodeEqual 100.00% (8/8)
github.com/conformal/btcscript/opcode.go opcodeAdd 100.00% (8/8)
github.com/conformal/btcscript/stack.go Stack.DupN 100.00% (8/8)
github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.PushInt64 100.00% (7/7)
github.com/conformal/btcscript/opcode.go opcodeRoll 100.00% (7/7)
github.com/conformal/btcscript/script.go unparseScript 100.00% (7/7)
github.com/conformal/btcscript/stack.go Stack.DropN 100.00% (7/7)
github.com/conformal/btcscript/script.go typeOfScript 100.00% (7/7)
github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.PushUint64 100.00% (7/7)
github.com/conformal/btcscript/opcode.go opcode0NotEqual 100.00% (7/7)
github.com/conformal/btcscript/opcode.go opcodePick 100.00% (7/7)
github.com/conformal/btcscript/opcode.go opcodeNot 100.00% (7/7)
github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.PushInt64 100.00% (7/7)
github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.PushUint64 100.00% (7/7)
github.com/conformal/btcscript/opcode.go opcodeRoll 100.00% (7/7)
github.com/conformal/btcscript/stack.go Stack.DropN 100.00% (7/7)
github.com/conformal/btcscript/opcode.go opcodePick 100.00% (7/7)
github.com/conformal/btcscript/opcode.go opcodeIfDup 100.00% (6/6)
github.com/conformal/btcscript/opcode.go parsedOpcode.conditional 100.00% (6/6)
github.com/conformal/btcscript/opcode.go opcodeVerify 100.00% (6/6)
github.com/conformal/btcscript/opcode.go opcodeElse 100.00% (6/6)
github.com/conformal/btcscript/opcode.go opcodeIfDup 100.00% (6/6)
github.com/conformal/btcscript/opcode.go opcodeEndif 100.00% (6/6)
github.com/conformal/btcscript/opcode.go opcodeElse 100.00% (6/6)
github.com/conformal/btcscript/opcode.go opcodeHash160 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeHash256 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeSize 100.00% (5/5)
github.com/conformal/btcscript/stack.go Stack.PickN 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeToAltStack 100.00% (5/5)
github.com/conformal/btcscript/script.go Script.DisasmScript 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeFromAltStack 100.00% (5/5)
github.com/conformal/btcscript/script.go Script.validPC 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeAbs 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcode1Sub 100.00% (5/5)
github.com/conformal/btcscript/opcode.go parsedOpcode.exec 100.00% (5/5)
github.com/conformal/btcscript/stack.go Stack.RollN 100.00% (5/5)
github.com/conformal/btcscript/script.go removeOpcode 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcode1Add 100.00% (5/5)
github.com/conformal/btcscript/script.go removeOpcodeByData 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeNegate 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeRipemd160 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeSha1 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeSha256 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeHash160 100.00% (5/5)
github.com/conformal/btcscript/script.go removeOpcodeByData 100.00% (5/5)
github.com/conformal/btcscript/script.go Script.validPC 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeSize 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcode1Add 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcode1Sub 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeNegate 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeAbs 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeFromAltStack 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeToAltStack 100.00% (5/5)
github.com/conformal/btcscript/stack.go Stack.RollN 100.00% (5/5)
github.com/conformal/btcscript/script.go removeOpcode 100.00% (5/5)
github.com/conformal/btcscript/stack.go Stack.PickN 100.00% (5/5)
github.com/conformal/btcscript/opcode.go opcodeEqualVerify 100.00% (4/4)
github.com/conformal/btcscript/stack.go Stack.PeekBool 100.00% (4/4)
github.com/conformal/btcscript/opcode.go opcodeNumEqualVerify 100.00% (4/4)
github.com/conformal/btcscript/script.go getStack 100.00% (4/4)
github.com/conformal/btcscript/script.go Script.DisasmPC 100.00% (4/4)
github.com/conformal/btcscript/script.go Script.curPC 100.00% (4/4)
github.com/conformal/btcscript/opcode.go opcodeCheckMultiSigVerify 100.00% (4/4)
github.com/conformal/btcscript/stack.go asBool 100.00% (4/4)
github.com/conformal/btcscript/stack.go Stack.PeekByteArray 100.00% (4/4)
github.com/conformal/btcscript/script.go GetScriptClass 100.00% (4/4)
github.com/conformal/btcscript/script.go isPushOnly 100.00% (4/4)
github.com/conformal/btcscript/script.go isNullData 100.00% (4/4)
github.com/conformal/btcscript/script.go IsPayToScriptHash 100.00% (4/4)
github.com/conformal/btcscript/stack.go Stack.PopBool 100.00% (4/4)
github.com/conformal/btcscript/stack.go Stack.PopInt 100.00% (4/4)
github.com/conformal/btcscript/opcode.go opcodePushData 100.00% (4/4)
github.com/conformal/btcscript/stack.go Stack.PeekByteArray 100.00% (4/4)
github.com/conformal/btcscript/opcode.go opcodeNumEqualVerify 100.00% (4/4)
github.com/conformal/btcscript/stack.go Stack.PeekInt 100.00% (4/4)
github.com/conformal/btcscript/stack.go Stack.PeekBool 100.00% (4/4)
github.com/conformal/btcscript/stack.go Stack.PopInt 100.00% (4/4)
github.com/conformal/btcscript/script.go Script.curPC 100.00% (4/4)
github.com/conformal/btcscript/script.go isPushOnly 100.00% (4/4)
github.com/conformal/btcscript/stack.go asBool 100.00% (4/4)
github.com/conformal/btcscript/opcode.go opcodePushData 100.00% (4/4)
github.com/conformal/btcscript/opcode.go opcodeCheckMultiSigVerify 100.00% (4/4)
github.com/conformal/btcscript/script.go Script.DisasmPC 100.00% (4/4)
github.com/conformal/btcscript/script.go IsPayToScriptHash 100.00% (4/4)
github.com/conformal/btcscript/script.go isNullData 100.00% (4/4)
github.com/conformal/btcscript/script.go getStack 100.00% (4/4)
github.com/conformal/btcscript/script.go GetScriptClass 100.00% (4/4)
github.com/conformal/btcscript/script.go setStack 100.00% (3/3)
github.com/conformal/btcscript/script.go asSmallInt 100.00% (3/3)
github.com/conformal/btcscript/script.go isSmallInt 100.00% (3/3)
github.com/conformal/btcscript/script.go scriptUInt32 100.00% (3/3)
github.com/conformal/btcscript/script.go scriptUInt8 100.00% (3/3)
github.com/conformal/btcscript/stack.go fromBool 100.00% (3/3)
github.com/conformal/btcscript/script.go ScriptClass.String 100.00% (3/3)
github.com/conformal/btcscript/script.go asSmallInt 100.00% (3/3)
github.com/conformal/btcscript/script.go scriptUInt32 100.00% (3/3)
github.com/conformal/btcscript/script.go setStack 100.00% (3/3)
github.com/conformal/btcscript/script.go scriptUInt8 100.00% (3/3)
github.com/conformal/btcscript/script.go scriptUInt16 100.00% (3/3)
github.com/conformal/btcscript/opcode.go opcode1Negate 100.00% (2/2)
github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.PushOp 100.00% (2/2)
github.com/conformal/btcscript/opcode.go opcodeDepth 100.00% (2/2)
github.com/conformal/btcscript/opcode.go opcodeFalse 100.00% (2/2)
github.com/conformal/btcscript/opcode.go opcodeCodeSeparator 100.00% (2/2)
github.com/conformal/btcscript/script.go PayToScriptHashScript 100.00% (2/2)
github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.Reset 100.00% (2/2)
github.com/conformal/btcscript/opcode.go opcodeDepth 100.00% (2/2)
github.com/conformal/btcscript/stack.go Stack.NipN 100.00% (2/2)
github.com/conformal/btcscript/script.go GetSigOpCount 100.00% (2/2)
github.com/conformal/btcscript/opcode.go opcodeN 100.00% (2/2)
github.com/conformal/btcscript/opcode.go calcHash 100.00% (2/2)
github.com/conformal/btcscript/stack.go Stack.Depth 100.00% (2/2)
github.com/conformal/btcscript/script.go PayToPubKeyHashScript 100.00% (2/2)
github.com/conformal/btcscript/stack.go Stack.PushInt 100.00% (1/1)
github.com/conformal/btcscript/log.go init 100.00% (1/1)
github.com/conformal/btcscript/log.go DisableLog 100.00% (1/1)
github.com/conformal/btcscript/log.go newLogClosure 100.00% (1/1)
github.com/conformal/btcscript/opcode.go init 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeDisabled 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeReserved 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeInvalid 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeNop 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeReturn 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcode2Drop 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcode2Dup 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcode3Dup 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcode2Over 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcode2Rot 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcode2Swap 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeDrop 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeDup 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeNip 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeOver 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeRot 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeSwap 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeTuck 100.00% (1/1)
github.com/conformal/btcscript/opcode.go calcHash160 100.00% (1/1)
github.com/conformal/btcscript/stack.go Stack.PushByteArray 100.00% (1/1)
github.com/conformal/btcscript/stack.go Stack.PopByteArray 100.00% (1/1)
github.com/conformal/btcscript/stack.go Stack.PushBool 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeN 100.00% (2/2)
github.com/conformal/btcscript/opcode.go opcode1Negate 100.00% (2/2)
github.com/conformal/btcscript/opcode.go calcHash 100.00% (2/2)
github.com/conformal/btcscript/opcode.go opcodeCodeSeparator 100.00% (2/2)
github.com/conformal/btcscript/script.go GetSigOpCount 100.00% (2/2)
github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.PushOp 100.00% (2/2)
github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.Reset 100.00% (2/2)
github.com/conformal/btcscript/script.go Script.subScript 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcode2Rot 100.00% (1/1)
github.com/conformal/btcscript/log.go init 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeTuck 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeSwap 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeRot 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeNop 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeOver 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeNip 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeDup 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeReturn 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeDrop 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcode2Swap 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcode2Drop 100.00% (1/1)
github.com/conformal/btcscript/script.go isPubkey 100.00% (1/1)
github.com/conformal/btcscript/script.go isPubkeyHash 100.00% (1/1)
github.com/conformal/btcscript/script.go isScriptHash 100.00% (1/1)
github.com/conformal/btcscript/script.go parseScript 100.00% (1/1)
github.com/conformal/btcscript/script.go Script.disasm 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeDisabled 100.00% (1/1)
github.com/conformal/btcscript/script.go parseScript 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeReserved 100.00% (1/1)
github.com/conformal/btcscript/script.go Script.GetStack 100.00% (1/1)
github.com/conformal/btcscript/script.go Script.SetStack 100.00% (1/1)
github.com/conformal/btcscript/script.go Script.GetAltStack 100.00% (1/1)
github.com/conformal/btcscript/script.go Script.SetAltStack 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcode2Dup 100.00% (1/1)
github.com/conformal/btcscript/opcode.go init 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeInvalid 100.00% (1/1)
github.com/conformal/btcscript/script.go payToPubKeyHashScript 100.00% (1/1)
github.com/conformal/btcscript/script.go payToScriptHashScript 100.00% (1/1)
github.com/conformal/btcscript/script.go isScriptHash 100.00% (1/1)
github.com/conformal/btcscript/script.go SignatureScript 100.00% (1/1)
github.com/conformal/btcscript/log.go newLogClosure 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcode2Over 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcode3Dup 100.00% (1/1)
github.com/conformal/btcscript/script.go isPubkeyHash 100.00% (1/1)
github.com/conformal/btcscript/stack.go Stack.PopByteArray 100.00% (1/1)
github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.Script 100.00% (1/1)
github.com/conformal/btcscript/scriptbuilder.go NewScriptBuilder 100.00% (1/1)
github.com/conformal/btcscript/script.go Script.SetAltStack 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeCheckSig 90.00% (27/30)
github.com/conformal/btcscript/log.go DisableLog 100.00% (1/1)
github.com/conformal/btcscript/stack.go Stack.PushByteArray 100.00% (1/1)
github.com/conformal/btcscript/stack.go Stack.PushInt 100.00% (1/1)
github.com/conformal/btcscript/stack.go Stack.PushBool 100.00% (1/1)
github.com/conformal/btcscript/opcode.go calcHash160 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeCheckSig 93.10% (27/29)
github.com/conformal/btcscript/script.go unparseScript 85.71% (6/7)
github.com/conformal/btcscript/script.go expectedInputs 85.71% (6/7)
github.com/conformal/btcscript/script.go calcScriptHash 82.05% (32/39)
github.com/conformal/btcscript/script.go Script.CheckErrorCondition 78.57% (11/14)
github.com/conformal/btcscript/script.go IsPushOnlyScript 75.00% (3/4)
github.com/conformal/btcscript/opcode.go opcodeCheckSigVerify 75.00% (3/4)
github.com/conformal/btcscript/script.go IsPushOnlyScript 75.00% (3/4)
github.com/conformal/btcscript/script.go HasCanonicalPushes 66.67% (12/18)
github.com/conformal/btcscript/script.go Script.Execute 44.44% (8/18)
github.com/conformal/btcscript/log.go SetLogWriter 0.00% (0/10)
github.com/conformal/btcscript/script.go CalcMultiSigStats 0.00% (0/8)
github.com/conformal/btcscript/script.go @540:34 0.00% (0/6)
github.com/conformal/btcscript/script.go @528:34 0.00% (0/4)
github.com/conformal/btcscript/script.go @573:34 0.00% (0/3)
github.com/conformal/btcscript/log.go UseLogger 0.00% (0/1)
github.com/conformal/btcscript/log.go logClosure.String 0.00% (0/1)
github.com/conformal/btcscript --------------------------- 95.20% (1032/1084)
github.com/conformal/btcscript/opcode.go @1741:33 0.00% (0/1)
github.com/conformal/btcscript --------------------------- 95.14% (1037/1090)