diff --git a/data/script_invalid.json b/data/script_invalid.json index 75de4716..3574b9d1 100644 --- a/data/script_invalid.json +++ b/data/script_invalid.json @@ -154,6 +154,22 @@ ["1","NOP1 NOP2 NOP3 NOP4 NOP5 NOP6 NOP7 NOP8 NOP9 NOP10 2 EQUAL", "P2SH,STRICTENC"], ["'NOP_1_to_10' NOP1 NOP2 NOP3 NOP4 NOP5 NOP6 NOP7 NOP8 NOP9 NOP10","'NOP_1_to_11' EQUAL", "P2SH,STRICTENC"], +["Ensure 100% coverage of discouraged NOPS"], +["1", "NOP1", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], +["1", "NOP2", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], +["1", "NOP3", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], +["1", "NOP4", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], +["1", "NOP5", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], +["1", "NOP6", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], +["1", "NOP7", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], +["1", "NOP8", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], +["1", "NOP9", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], +["1", "NOP10", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], + +["NOP10", "1", "P2SH,DISCOURAGE_UPGRADABLE_NOPS", "Discouraged NOP10 in scriptSig"], + +["1 0x01 0xb9", "HASH160 0x14 0x15727299b05b45fdaf9ac9ecf7565cfe27c3e567 EQUAL", "P2SH,DISCOURAGE_UPGRADABLE_NOPS", "Discouraged NOP10 in redeemScript"], + ["0x50","1", "P2SH,STRICTENC", "opcode 0x50 is reserved"], ["1", "IF 0xba ELSE 1 ENDIF", "P2SH,STRICTENC", "opcodes above NOP10 invalid if executed"], ["1", "IF 0xbb ELSE 1 ENDIF", "P2SH,STRICTENC"], diff --git a/data/script_valid.json b/data/script_valid.json index c1db4c60..473bd37b 100644 --- a/data/script_valid.json +++ b/data/script_valid.json @@ -226,6 +226,10 @@ ["1","NOP1 NOP2 NOP3 NOP4 NOP5 NOP6 NOP7 NOP8 NOP9 NOP10 1 EQUAL", "P2SH,STRICTENC"], ["'NOP_1_to_10' NOP1 NOP2 NOP3 NOP4 NOP5 NOP6 NOP7 NOP8 NOP9 NOP10","'NOP_1_to_10' EQUAL", "P2SH,STRICTENC"], +["1", "NOP", "P2SH,STRICTENC,DISCOURAGE_UPGRADABLE_NOPS", "Discourage NOPx flag allows OP_NOP"], + +["0", "IF NOP10 ENDIF 1", "P2SH,STRICTENC,DISCOURAGE_UPGRADABLE_NOPS", "Discouraged NOPs are allowed if not executed"], + ["0", "IF 0xba ELSE 1 ENDIF", "P2SH,STRICTENC", "opcodes above NOP10 invalid if executed"], ["0", "IF 0xbb ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xbc ELSE 1 ENDIF", "P2SH,STRICTENC"], diff --git a/internal_test.go b/internal_test.go index 5886bb8d..4f74e1f1 100644 --- a/internal_test.go +++ b/internal_test.go @@ -3806,15 +3806,19 @@ func TestBitcoindInvalidTests(t *testing.T) { var tests [][]string err = json.Unmarshal(file, &tests) if err != nil { - t.Errorf("TestBitcoindInvalidTests couldn't Unmarshal: %v\n", + t.Errorf("TestBitcoindInvalidTests couldn't Unmarshal: %v", err) return } tx := btcwire.NewMsgTx() for x, test := range tests { + // Skip comments + if len(test) == 1 { + continue + } name, err := testName(test) if err != nil { - t.Errorf("TestBitcoindInvalidTests: invalid test #%d\n", + t.Errorf("TestBitcoindInvalidTests: invalid test #%d", x) continue } @@ -3857,15 +3861,19 @@ func TestBitcoindValidTests(t *testing.T) { var tests [][]string err = json.Unmarshal(file, &tests) if err != nil { - t.Errorf("TestBitcoindValidTests couldn't Unmarshal: %v\n", + t.Errorf("TestBitcoindValidTests couldn't Unmarshal: %v", err) return } tx := btcwire.NewMsgTx() for x, test := range tests { + // Skip comments + if len(test) == 1 { + continue + } name, err := testName(test) if err != nil { - t.Errorf("TestBitcoindValidTests: invalid test #%d\n", + t.Errorf("TestBitcoindValidTests: invalid test #%d", x) continue } @@ -4195,6 +4203,8 @@ func parseScriptFlags(flagStr string) (ScriptFlags, error) { sFlags := strings.Split(flagStr, ",") for _, flag := range sFlags { switch flag { + case "DISCOURAGE_UPGRADABLE_NOPS": + flags |= ScriptDiscourageUpgradableNops case "NONE": // Nothing. case "NULLDUMMY": diff --git a/opcode.go b/opcode.go index ca4fa8ff..07d6b30f 100644 --- a/opcode.go +++ b/opcode.go @@ -1085,7 +1085,13 @@ func opcodeN(op *parsedOpcode, s *Script) error { } func opcodeNop(op *parsedOpcode, s *Script) error { - // This page left intentionally blank + switch op.opcode.value { + case OP_NOP1, OP_NOP2, OP_NOP3, OP_NOP4, OP_NOP5, + OP_NOP6, OP_NOP7, OP_NOP8, OP_NOP9, OP_NOP10: + if s.discourageUpgradableNops { + return fmt.Errorf("%s reserved for soft-fork upgrades", opcodemap[op.opcode.value].name) + } + } return nil } diff --git a/script.go b/script.go index e6be9339..0a719e69 100644 --- a/script.go +++ b/script.go @@ -195,20 +195,21 @@ func (t ScriptClass) String() string { // Script is the virtual machine that executes btcscripts. type Script struct { - scripts [][]parsedOpcode - scriptidx int - scriptoff int - lastcodesep int - dstack Stack // data stack - astack Stack // alt stack - tx btcwire.MsgTx - txidx int - condStack []int - numOps int - bip16 bool // treat execution as pay-to-script-hash - der bool // enforce DER encoding - strictMultiSig bool // verify multisig stack item is zero length - savedFirstStack [][]byte // stack from first script for bip16 scripts + scripts [][]parsedOpcode + scriptidx int + scriptoff int + lastcodesep int + dstack Stack // data stack + astack Stack // alt stack + tx btcwire.MsgTx + txidx int + condStack []int + numOps int + bip16 bool // treat execution as pay-to-script-hash + der bool // enforce DER encoding + strictMultiSig bool // verify multisig stack item is zero length + discourageUpgradableNops bool // NOP1 to NOP10 are reserved for future soft-fork upgrades + savedFirstStack [][]byte // stack from first script for bip16 scripts } // isSmallInt returns whether or not the opcode is considered a small integer, @@ -513,6 +514,14 @@ const ( // ScriptStrictMultiSig defines whether to verify the stack item // used by CHECKMULTISIG is zero length. ScriptStrictMultiSig + + // ScriptDiscourageUpgradableNops defines whether to verify that + // NOP1 through NOP10 are reserved for future soft-fork upgrades. This + // flag must not be used for consensus critical code nor applied to + // blocks as this flag is only for stricter standard transaction + // checks. This flag is only applied when the above opcodes are + // executed. + ScriptDiscourageUpgradableNops ) // NewScript returns a new script engine for the provided tx and input idx with @@ -558,6 +567,9 @@ func NewScript(scriptSig []byte, scriptPubKey []byte, txidx int, tx *btcwire.Msg if flags&ScriptStrictMultiSig == ScriptStrictMultiSig { m.strictMultiSig = true } + if flags&ScriptDiscourageUpgradableNops == ScriptDiscourageUpgradableNops { + m.discourageUpgradableNops = true + } m.tx = *tx m.txidx = txidx diff --git a/test_coverage.txt b/test_coverage.txt index 61d9a98b..cc8ff18e 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,182 +1,186 @@ -github.com/conformal/btcscript/script.go calcScriptHash 100.00% (39/39) -github.com/conformal/btcscript/script.go Script.Step 100.00% (37/37) -github.com/conformal/btcscript/script.go parseScriptTemplate 100.00% (29/29) -github.com/conformal/btcscript/opcode.go opcodeCheckSig 100.00% (29/29) -github.com/conformal/btcscript/address.go ExtractPkScriptAddrs 100.00% (27/27) -github.com/conformal/btcscript/script.go NewScript 100.00% (25/25) -github.com/conformal/btcscript/script.go CalcScriptInfo 100.00% (25/25) -github.com/conformal/btcscript/stack.go asInt 100.00% (23/23) -github.com/conformal/btcscript/opcode.go parsedOpcode.bytes 100.00% (23/23) -github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.AddData 100.00% (22/22) -github.com/conformal/btcscript/opcode.go parsedOpcode.disabled 100.00% (17/17) -github.com/conformal/btcscript/opcode.go parsedOpcode.print 100.00% (16/16) -github.com/conformal/btcscript/stack.go Stack.nipN 100.00% (15/15) -github.com/conformal/btcscript/stack.go fromInt 100.00% (14/14) -github.com/conformal/btcscript/opcode.go parsedOpcode.exec 100.00% (13/13) -github.com/conformal/btcscript/script.go GetPreciseSigOpCount 100.00% (13/13) -github.com/conformal/btcscript/opcode.go opcodeWithin 100.00% (13/13) -github.com/conformal/btcscript/script.go isMultiSig 100.00% (13/13) -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/script.go PayToAddrScript 100.00% (11/11) -github.com/conformal/btcscript/script.go typeOfScript 100.00% (11/11) -github.com/conformal/btcscript/opcode.go opcodeMin 100.00% (10/10) -github.com/conformal/btcscript/log.go SetLogWriter 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/opcode.go opcodeLessThan 100.00% (10/10) -github.com/conformal/btcscript/opcode.go opcodeGreaterThan 100.00% (10/10) -github.com/conformal/btcscript/opcode.go opcodeLessThanOrEqual 100.00% (10/10) -github.com/conformal/btcscript/opcode.go opcodeGreaterThanOrEqual 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/script.go PushedData 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/script.go SignatureScript 100.00% (9/9) -github.com/conformal/btcscript/script.go Script.CheckErrorCondition 100.00% (9/9) -github.com/conformal/btcscript/stack.go Stack.SwapN 100.00% (9/9) -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/opcode.go opcodeEqual 100.00% (8/8) -github.com/conformal/btcscript/stack.go Stack.DupN 100.00% (8/8) -github.com/conformal/btcscript/script.go MultiSigScript 100.00% (8/8) -github.com/conformal/btcscript/opcode.go opcodeAdd 100.00% (8/8) -github.com/conformal/btcscript/script.go CalcMultiSigStats 100.00% (8/8) -github.com/conformal/btcscript/opcode.go opcodeSub 100.00% (8/8) -github.com/conformal/btcscript/script.go Script.Execute 100.00% (8/8) -github.com/conformal/btcscript/opcode.go opcode0NotEqual 100.00% (7/7) -github.com/conformal/btcscript/script.go HasCanonicalPushes 100.00% (7/7) -github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.AddUint64 100.00% (7/7) -github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.AddInt64 100.00% (7/7) -github.com/conformal/btcscript/stack.go Stack.DropN 100.00% (7/7) -github.com/conformal/btcscript/opcode.go opcodeNot 100.00% (7/7) -github.com/conformal/btcscript/opcode.go opcodeVerify 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 opcodeIfDup 100.00% (6/6) -github.com/conformal/btcscript/opcode.go parsedOpcode.conditional 100.00% (6/6) -github.com/conformal/btcscript/opcode.go opcode1Add 100.00% (5/5) -github.com/conformal/btcscript/opcode.go opcodeToAltStack 100.00% (5/5) -github.com/conformal/btcscript/stack.go Stack.PickN 100.00% (5/5) -github.com/conformal/btcscript/script.go Script.validPC 100.00% (5/5) -github.com/conformal/btcscript/opcode.go opcodeFromAltStack 100.00% (5/5) -github.com/conformal/btcscript/opcode.go opcodeSize 100.00% (5/5) -github.com/conformal/btcscript/stack.go Stack.RollN 100.00% (5/5) -github.com/conformal/btcscript/opcode.go opcodeSha256 100.00% (5/5) -github.com/conformal/btcscript/opcode.go opcodeRoll 100.00% (5/5) -github.com/conformal/btcscript/opcode.go opcodeAbs 100.00% (5/5) -github.com/conformal/btcscript/script.go removeOpcodeByData 100.00% (5/5) -github.com/conformal/btcscript/script.go removeOpcode 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 opcodePick 100.00% (5/5) -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/script.go Script.DisasmScript 100.00% (5/5) -github.com/conformal/btcscript/opcode.go opcodeNegate 100.00% (5/5) -github.com/conformal/btcscript/opcode.go opcode1Sub 100.00% (5/5) -github.com/conformal/btcscript/script.go Script.curPC 100.00% (4/4) -github.com/conformal/btcscript/opcode.go opcodeEqualVerify 100.00% (4/4) -github.com/conformal/btcscript/opcode.go opcodeNumEqualVerify 100.00% (4/4) -github.com/conformal/btcscript/opcode.go opcodeCheckSigVerify 100.00% (4/4) -github.com/conformal/btcscript/opcode.go opcodeCheckMultiSigVerify 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 isPushOnly 100.00% (4/4) -github.com/conformal/btcscript/script.go IsPushOnlyScript 100.00% (4/4) -github.com/conformal/btcscript/script.go GetScriptClass 100.00% (4/4) -github.com/conformal/btcscript/script.go Script.DisasmPC 100.00% (4/4) -github.com/conformal/btcscript/script.go getStack 100.00% (4/4) -github.com/conformal/btcscript/opcode.go parsedOpcode.alwaysIllegal 100.00% (4/4) -github.com/conformal/btcscript/script.go @1322:17 100.00% (4/4) -github.com/conformal/btcscript/stack.go asBool 100.00% (4/4) -github.com/conformal/btcscript/stack.go Stack.PopInt 100.00% (4/4) -github.com/conformal/btcscript/stack.go Stack.PopBool 100.00% (4/4) -github.com/conformal/btcscript/stack.go Stack.PeekByteArray 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 fromBool 100.00% (3/3) -github.com/conformal/btcscript/script.go ScriptClass.String 100.00% (3/3) -github.com/conformal/btcscript/script.go isSmallInt 100.00% (3/3) -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/opcode.go opcodePushData 100.00% (2/2) -github.com/conformal/btcscript/opcode.go calcHash 100.00% (2/2) -github.com/conformal/btcscript/opcode.go opcodeN 100.00% (2/2) -github.com/conformal/btcscript/stack.go Stack.NipN 100.00% (2/2) -github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.AddOp 100.00% (2/2) -github.com/conformal/btcscript/opcode.go opcodeCodeSeparator 100.00% (2/2) -github.com/conformal/btcscript/opcode.go opcodeDepth 100.00% (2/2) -github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.Reset 100.00% (2/2) -github.com/conformal/btcscript/opcode.go opcode1Negate 100.00% (2/2) -github.com/conformal/btcscript/opcode.go opcodeFalse 100.00% (2/2) -github.com/conformal/btcscript/script.go GetSigOpCount 100.00% (2/2) -github.com/conformal/btcscript/stack.go Stack.Depth 100.00% (2/2) -github.com/conformal/btcscript/script.go KeyClosure.GetKey 100.00% (1/1) -github.com/conformal/btcscript/stack.go Stack.PushBool 100.00% (1/1) -github.com/conformal/btcscript/opcode.go opcodeDup 100.00% (1/1) -github.com/conformal/btcscript/script.go Script.disasm 100.00% (1/1) -github.com/conformal/btcscript/script.go Script.subScript 100.00% (1/1) -github.com/conformal/btcscript/opcode.go calcHash160 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 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 opcodeDrop 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 payToPubKeyScript 100.00% (1/1) -github.com/conformal/btcscript/opcode.go init 100.00% (1/1) -github.com/conformal/btcscript/scriptbuilder.go NewScriptBuilder 100.00% (1/1) -github.com/conformal/btcscript/log.go UseLogger 100.00% (1/1) -github.com/conformal/btcscript/log.go DisableLog 100.00% (1/1) -github.com/conformal/btcscript/opcode.go opcode2Drop 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/opcode.go opcode2Dup 100.00% (1/1) -github.com/conformal/btcscript/opcode.go opcode3Dup 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/opcode.go opcode2Over 100.00% (1/1) -github.com/conformal/btcscript/opcode.go opcode2Rot 100.00% (1/1) -github.com/conformal/btcscript/stack.go Stack.PopByteArray 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/script.go parseScript 100.00% (1/1) -github.com/conformal/btcscript/opcode.go opcodeInvalid 100.00% (1/1) -github.com/conformal/btcscript/script.go ScriptClosure.GetScript 100.00% (1/1) -github.com/conformal/btcscript/log.go newLogClosure 100.00% (1/1) -github.com/conformal/btcscript/opcode.go opcode2Swap 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/scriptbuilder.go ScriptBuilder.Script 100.00% (1/1) -github.com/conformal/btcscript/opcode.go opcodeCheckMultiSig 98.48% (65/66) -github.com/conformal/btcscript/script.go mergeScripts 95.00% (19/20) -github.com/conformal/btcscript/script.go canonicalPush 92.86% (13/14) -github.com/conformal/btcscript/script.go signMultiSig 92.86% (13/14) -github.com/conformal/btcscript/script.go mergeMultiSig 88.10% (37/42) -github.com/conformal/btcscript/script.go signTxOutput 87.50% (7/8) -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 SignTxOutput 80.00% (12/15) -github.com/conformal/btcscript/script.go p2pkSignatureScript 75.00% (3/4) -github.com/conformal/btcscript/script.go sign 69.23% (18/26) -github.com/conformal/btcscript/script.go @586:34 0.00% (0/6) -github.com/conformal/btcscript/stack.go Stack.String 0.00% (0/4) -github.com/conformal/btcscript/script.go @574:34 0.00% (0/4) -github.com/conformal/btcscript/script.go @619:34 0.00% (0/3) -github.com/conformal/btcscript/opcode.go opcodeDisabled 0.00% (0/1) -github.com/conformal/btcscript/opcode.go @1804:33 0.00% (0/1) -github.com/conformal/btcscript/log.go logClosure.String 0.00% (0/1) -github.com/conformal/btcscript -------------------------- 96.52% (1221/1265) +github.com/btcsuite/btcscript/script.go calcScriptHash 100.00% (39/39) +github.com/btcsuite/btcscript/script.go Script.Step 100.00% (37/37) +github.com/btcsuite/btcscript/script.go parseScriptTemplate 100.00% (29/29) +github.com/btcsuite/btcscript/opcode.go opcodeCheckSig 100.00% (29/29) +github.com/btcsuite/btcscript/script.go NewScript 100.00% (27/27) +github.com/btcsuite/btcscript/address.go ExtractPkScriptAddrs 100.00% (27/27) +github.com/btcsuite/btcscript/scriptbuilder.go ScriptBuilder.addData 100.00% (25/25) +github.com/btcsuite/btcscript/script.go CalcScriptInfo 100.00% (25/25) +github.com/btcsuite/btcscript/stack.go asInt 100.00% (23/23) +github.com/btcsuite/btcscript/opcode.go parsedOpcode.bytes 100.00% (23/23) +github.com/btcsuite/btcscript/opcode.go parsedOpcode.disabled 100.00% (17/17) +github.com/btcsuite/btcscript/opcode.go parsedOpcode.print 100.00% (16/16) +github.com/btcsuite/btcscript/stack.go Stack.nipN 100.00% (15/15) +github.com/btcsuite/btcscript/scriptbuilder.go canonicalDataSize 100.00% (14/14) +github.com/btcsuite/btcscript/stack.go fromInt 100.00% (14/14) +github.com/btcsuite/btcscript/opcode.go opcodeWithin 100.00% (13/13) +github.com/btcsuite/btcscript/scriptbuilder.go ScriptBuilder.AddUint64 100.00% (13/13) +github.com/btcsuite/btcscript/opcode.go parsedOpcode.exec 100.00% (13/13) +github.com/btcsuite/btcscript/script.go isMultiSig 100.00% (13/13) +github.com/btcsuite/btcscript/scriptbuilder.go ScriptBuilder.AddInt64 100.00% (13/13) +github.com/btcsuite/btcscript/scriptbuilder.go ScriptBuilder.AddData 100.00% (13/13) +github.com/btcsuite/btcscript/script.go GetPreciseSigOpCount 100.00% (13/13) +github.com/btcsuite/btcscript/opcode.go opcodeNotIf 100.00% (11/11) +github.com/btcsuite/btcscript/script.go typeOfScript 100.00% (11/11) +github.com/btcsuite/btcscript/opcode.go opcodeIf 100.00% (11/11) +github.com/btcsuite/btcscript/script.go PayToAddrScript 100.00% (11/11) +github.com/btcsuite/btcscript/opcode.go opcodeLessThanOrEqual 100.00% (10/10) +github.com/btcsuite/btcscript/opcode.go opcodeGreaterThanOrEqual 100.00% (10/10) +github.com/btcsuite/btcscript/script.go PushedData 100.00% (10/10) +github.com/btcsuite/btcscript/opcode.go opcodeGreaterThan 100.00% (10/10) +github.com/btcsuite/btcscript/opcode.go opcodeMin 100.00% (10/10) +github.com/btcsuite/btcscript/opcode.go opcodeNumNotEqual 100.00% (10/10) +github.com/btcsuite/btcscript/stack.go Stack.Tuck 100.00% (10/10) +github.com/btcsuite/btcscript/script.go getSigOpCount 100.00% (10/10) +github.com/btcsuite/btcscript/log.go SetLogWriter 100.00% (10/10) +github.com/btcsuite/btcscript/opcode.go opcodeNumEqual 100.00% (10/10) +github.com/btcsuite/btcscript/opcode.go opcodeMax 100.00% (10/10) +github.com/btcsuite/btcscript/opcode.go opcodeBoolOr 100.00% (10/10) +github.com/btcsuite/btcscript/opcode.go opcodeBoolAnd 100.00% (10/10) +github.com/btcsuite/btcscript/opcode.go opcodeLessThan 100.00% (10/10) +github.com/btcsuite/btcscript/script.go DisasmString 100.00% (9/9) +github.com/btcsuite/btcscript/stack.go Stack.OverN 100.00% (9/9) +github.com/btcsuite/btcscript/stack.go Stack.SwapN 100.00% (9/9) +github.com/btcsuite/btcscript/script.go SignatureScript 100.00% (9/9) +github.com/btcsuite/btcscript/stack.go Stack.RotN 100.00% (9/9) +github.com/btcsuite/btcscript/script.go Script.CheckErrorCondition 100.00% (9/9) +github.com/btcsuite/btcscript/script.go Script.Execute 100.00% (8/8) +github.com/btcsuite/btcscript/opcode.go opcodeEqual 100.00% (8/8) +github.com/btcsuite/btcscript/script.go MultiSigScript 100.00% (8/8) +github.com/btcsuite/btcscript/script.go CalcMultiSigStats 100.00% (8/8) +github.com/btcsuite/btcscript/scriptbuilder.go ScriptBuilder.AddOp 100.00% (8/8) +github.com/btcsuite/btcscript/opcode.go opcodeAdd 100.00% (8/8) +github.com/btcsuite/btcscript/opcode.go opcodeSub 100.00% (8/8) +github.com/btcsuite/btcscript/stack.go Stack.DupN 100.00% (8/8) +github.com/btcsuite/btcscript/opcode.go opcodeNot 100.00% (7/7) +github.com/btcsuite/btcscript/stack.go Stack.DropN 100.00% (7/7) +github.com/btcsuite/btcscript/opcode.go opcodeNop 100.00% (7/7) +github.com/btcsuite/btcscript/opcode.go opcode0NotEqual 100.00% (7/7) +github.com/btcsuite/btcscript/script.go HasCanonicalPushes 100.00% (7/7) +github.com/btcsuite/btcscript/opcode.go opcodeElse 100.00% (6/6) +github.com/btcsuite/btcscript/opcode.go parsedOpcode.conditional 100.00% (6/6) +github.com/btcsuite/btcscript/opcode.go opcodeIfDup 100.00% (6/6) +github.com/btcsuite/btcscript/opcode.go opcodeVerify 100.00% (6/6) +github.com/btcsuite/btcscript/opcode.go opcodeEndif 100.00% (6/6) +github.com/btcsuite/btcscript/script.go removeOpcode 100.00% (5/5) +github.com/btcsuite/btcscript/opcode.go opcodeToAltStack 100.00% (5/5) +github.com/btcsuite/btcscript/opcode.go opcodeFromAltStack 100.00% (5/5) +github.com/btcsuite/btcscript/opcode.go opcodePick 100.00% (5/5) +github.com/btcsuite/btcscript/opcode.go opcodeRoll 100.00% (5/5) +github.com/btcsuite/btcscript/opcode.go opcodeSize 100.00% (5/5) +github.com/btcsuite/btcscript/opcode.go opcode1Add 100.00% (5/5) +github.com/btcsuite/btcscript/opcode.go opcode1Sub 100.00% (5/5) +github.com/btcsuite/btcscript/opcode.go opcodeNegate 100.00% (5/5) +github.com/btcsuite/btcscript/opcode.go opcodeAbs 100.00% (5/5) +github.com/btcsuite/btcscript/opcode.go opcodeRipemd160 100.00% (5/5) +github.com/btcsuite/btcscript/opcode.go opcodeSha1 100.00% (5/5) +github.com/btcsuite/btcscript/opcode.go opcodeSha256 100.00% (5/5) +github.com/btcsuite/btcscript/opcode.go opcodeHash160 100.00% (5/5) +github.com/btcsuite/btcscript/opcode.go opcodeHash256 100.00% (5/5) +github.com/btcsuite/btcscript/script.go Script.validPC 100.00% (5/5) +github.com/btcsuite/btcscript/script.go Script.DisasmScript 100.00% (5/5) +github.com/btcsuite/btcscript/script.go removeOpcodeByData 100.00% (5/5) +github.com/btcsuite/btcscript/stack.go Stack.PickN 100.00% (5/5) +github.com/btcsuite/btcscript/stack.go Stack.RollN 100.00% (5/5) +github.com/btcsuite/btcscript/script.go Script.curPC 100.00% (4/4) +github.com/btcsuite/btcscript/opcode.go opcodeCheckMultiSigVerify 100.00% (4/4) +github.com/btcsuite/btcscript/opcode.go opcodeCheckSigVerify 100.00% (4/4) +github.com/btcsuite/btcscript/opcode.go parsedOpcode.alwaysIllegal 100.00% (4/4) +github.com/btcsuite/btcscript/script.go IsPayToScriptHash 100.00% (4/4) +github.com/btcsuite/btcscript/stack.go Stack.PeekBool 100.00% (4/4) +github.com/btcsuite/btcscript/script.go isNullData 100.00% (4/4) +github.com/btcsuite/btcscript/stack.go Stack.PeekInt 100.00% (4/4) +github.com/btcsuite/btcscript/script.go IsPushOnlyScript 100.00% (4/4) +github.com/btcsuite/btcscript/stack.go Stack.PeekByteArray 100.00% (4/4) +github.com/btcsuite/btcscript/stack.go Stack.PopBool 100.00% (4/4) +github.com/btcsuite/btcscript/script.go GetScriptClass 100.00% (4/4) +github.com/btcsuite/btcscript/opcode.go opcodeNumEqualVerify 100.00% (4/4) +github.com/btcsuite/btcscript/stack.go Stack.PopInt 100.00% (4/4) +github.com/btcsuite/btcscript/opcode.go opcodeEqualVerify 100.00% (4/4) +github.com/btcsuite/btcscript/stack.go asBool 100.00% (4/4) +github.com/btcsuite/btcscript/script.go getStack 100.00% (4/4) +github.com/btcsuite/btcscript/script.go @1338:17 100.00% (4/4) +github.com/btcsuite/btcscript/script.go isPushOnly 100.00% (4/4) +github.com/btcsuite/btcscript/script.go Script.DisasmPC 100.00% (4/4) +github.com/btcsuite/btcscript/script.go ScriptClass.String 100.00% (3/3) +github.com/btcsuite/btcscript/script.go setStack 100.00% (3/3) +github.com/btcsuite/btcscript/script.go isSmallInt 100.00% (3/3) +github.com/btcsuite/btcscript/script.go asSmallInt 100.00% (3/3) +github.com/btcsuite/btcscript/scriptbuilder.go ScriptBuilder.AddFullData 100.00% (3/3) +github.com/btcsuite/btcscript/scriptbuilder.go ScriptBuilder.Reset 100.00% (3/3) +github.com/btcsuite/btcscript/stack.go fromBool 100.00% (3/3) +github.com/btcsuite/btcscript/stack.go Stack.NipN 100.00% (2/2) +github.com/btcsuite/btcscript/opcode.go opcodeCodeSeparator 100.00% (2/2) +github.com/btcsuite/btcscript/opcode.go calcHash 100.00% (2/2) +github.com/btcsuite/btcscript/opcode.go opcodeFalse 100.00% (2/2) +github.com/btcsuite/btcscript/opcode.go opcodePushData 100.00% (2/2) +github.com/btcsuite/btcscript/opcode.go opcode1Negate 100.00% (2/2) +github.com/btcsuite/btcscript/script.go GetSigOpCount 100.00% (2/2) +github.com/btcsuite/btcscript/stack.go Stack.Depth 100.00% (2/2) +github.com/btcsuite/btcscript/opcode.go opcodeDepth 100.00% (2/2) +github.com/btcsuite/btcscript/opcode.go opcodeN 100.00% (2/2) +github.com/btcsuite/btcscript/script.go Script.SetAltStack 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcodeDrop 100.00% (1/1) +github.com/btcsuite/btcscript/script.go payToPubKeyHashScript 100.00% (1/1) +github.com/btcsuite/btcscript/script.go payToScriptHashScript 100.00% (1/1) +github.com/btcsuite/btcscript/script.go payToPubKeyScript 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcode2Swap 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcode2Rot 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcode2Over 100.00% (1/1) +github.com/btcsuite/btcscript/scriptbuilder.go ErrScriptNotCanonical.Error 100.00% (1/1) +github.com/btcsuite/btcscript/script.go KeyClosure.GetKey 100.00% (1/1) +github.com/btcsuite/btcscript/script.go ScriptClosure.GetScript 100.00% (1/1) +github.com/btcsuite/btcscript/script.go Script.disasm 100.00% (1/1) +github.com/btcsuite/btcscript/script.go Script.subScript 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcodeSwap 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcodeNip 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcodeDup 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcodeTuck 100.00% (1/1) +github.com/btcsuite/btcscript/log.go UseLogger 100.00% (1/1) +github.com/btcsuite/btcscript/script.go Script.GetStack 100.00% (1/1) +github.com/btcsuite/btcscript/script.go Script.SetStack 100.00% (1/1) +github.com/btcsuite/btcscript/script.go Script.GetAltStack 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcodeInvalid 100.00% (1/1) +github.com/btcsuite/btcscript/script.go isPubkey 100.00% (1/1) +github.com/btcsuite/btcscript/scriptbuilder.go NewScriptBuilder 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcodeReserved 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcode2Dup 100.00% (1/1) +github.com/btcsuite/btcscript/stack.go Stack.PushByteArray 100.00% (1/1) +github.com/btcsuite/btcscript/stack.go Stack.PushInt 100.00% (1/1) +github.com/btcsuite/btcscript/stack.go Stack.PopByteArray 100.00% (1/1) +github.com/btcsuite/btcscript/script.go parseScript 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go calcHash160 100.00% (1/1) +github.com/btcsuite/btcscript/script.go isScriptHash 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go init 100.00% (1/1) +github.com/btcsuite/btcscript/log.go newLogClosure 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcodeOver 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcodeRot 100.00% (1/1) +github.com/btcsuite/btcscript/log.go DisableLog 100.00% (1/1) +github.com/btcsuite/btcscript/log.go init 100.00% (1/1) +github.com/btcsuite/btcscript/stack.go Stack.PushBool 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcode3Dup 100.00% (1/1) +github.com/btcsuite/btcscript/script.go isPubkeyHash 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcode2Drop 100.00% (1/1) +github.com/btcsuite/btcscript/scriptbuilder.go ScriptBuilder.Script 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcodeReturn 100.00% (1/1) +github.com/btcsuite/btcscript/opcode.go opcodeCheckMultiSig 98.48% (65/66) +github.com/btcsuite/btcscript/script.go mergeScripts 95.24% (20/21) +github.com/btcsuite/btcscript/script.go signMultiSig 93.33% (14/15) +github.com/btcsuite/btcscript/script.go canonicalPush 92.86% (13/14) +github.com/btcsuite/btcscript/script.go mergeMultiSig 88.37% (38/43) +github.com/btcsuite/btcscript/script.go RawTxInSignature 87.50% (7/8) +github.com/btcsuite/btcscript/script.go expectedInputs 85.71% (6/7) +github.com/btcsuite/btcscript/script.go unparseScript 85.71% (6/7) +github.com/btcsuite/btcscript/script.go SignTxOutput 80.00% (12/15) +github.com/btcsuite/btcscript/script.go p2pkSignatureScript 75.00% (3/4) +github.com/btcsuite/btcscript/script.go sign 69.23% (18/26) +github.com/btcsuite/btcscript/script.go @598:34 0.00% (0/6) +github.com/btcsuite/btcscript/script.go @586:34 0.00% (0/4) +github.com/btcsuite/btcscript/stack.go Stack.String 0.00% (0/4) +github.com/btcsuite/btcscript/script.go @631:34 0.00% (0/3) +github.com/btcsuite/btcscript/log.go logClosure.String 0.00% (0/1) +github.com/btcsuite/btcscript/opcode.go @1815:33 0.00% (0/1) +github.com/btcsuite/btcscript/opcode.go opcodeDisabled 0.00% (0/1) +github.com/btcsuite/btcscript --------------------------- 96.69% (1285/1329)