diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 5b97dbba..00000000 --- a/.gitignore +++ /dev/null @@ -1,28 +0,0 @@ -# Temp files -*~ - -# Log files -*.log - -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ae71c02f..00000000 --- a/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: go -go: release -install: go get -d -t -v ./... diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 67cfe82f..00000000 --- a/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (c) 2013-2014 Conformal Systems LLC. - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/cov_report.sh b/cov_report.sh deleted file mode 100644 index 307f05b7..00000000 --- a/cov_report.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# This script uses gocov to generate a test coverage report. -# The gocov tool my be obtained with the following command: -# go get github.com/axw/gocov/gocov -# -# It will be installed to $GOPATH/bin, so ensure that location is in your $PATH. - -# Check for gocov. -type gocov >/dev/null 2>&1 -if [ $? -ne 0 ]; then - echo >&2 "This script requires the gocov tool." - echo >&2 "You may obtain it with the following command:" - echo >&2 "go get github.com/axw/gocov/gocov" - exit 1 -fi -gocov test | gocov report diff --git a/test_coverage.txt b/test_coverage.txt deleted file mode 100644 index 972b97c8..00000000 --- a/test_coverage.txt +++ /dev/null @@ -1,186 +0,0 @@ - -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/opcode.go opcodeCheckSig 100.00% (29/29) -github.com/btcsuite/btcscript/script.go parseScriptTemplate 100.00% (29/29) -github.com/btcsuite/btcscript/script.go NewScript 100.00% (29/29) -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/opcode.go parsedOpcode.bytes 100.00% (23/23) -github.com/btcsuite/btcscript/stack.go asInt 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/scriptbuilder.go ScriptBuilder.AddUint64 100.00% (13/13) -github.com/btcsuite/btcscript/scriptbuilder.go ScriptBuilder.AddData 100.00% (13/13) -github.com/btcsuite/btcscript/script.go isMultiSig 100.00% (13/13) -github.com/btcsuite/btcscript/opcode.go opcodeWithin 100.00% (13/13) -github.com/btcsuite/btcscript/scriptbuilder.go ScriptBuilder.AddInt64 100.00% (13/13) -github.com/btcsuite/btcscript/opcode.go parsedOpcode.exec 100.00% (13/13) -github.com/btcsuite/btcscript/script.go GetPreciseSigOpCount 100.00% (13/13) -github.com/btcsuite/btcscript/opcode.go opcodeIf 100.00% (11/11) -github.com/btcsuite/btcscript/opcode.go opcodeNotIf 100.00% (11/11) -github.com/btcsuite/btcscript/script.go PayToAddrScript 100.00% (11/11) -github.com/btcsuite/btcscript/script.go typeOfScript 100.00% (11/11) -github.com/btcsuite/btcscript/opcode.go opcodeMax 100.00% (10/10) -github.com/btcsuite/btcscript/opcode.go opcodeLessThan 100.00% (10/10) -github.com/btcsuite/btcscript/opcode.go opcodeBoolAnd 100.00% (10/10) -github.com/btcsuite/btcscript/log.go SetLogWriter 100.00% (10/10) -github.com/btcsuite/btcscript/opcode.go opcodeGreaterThanOrEqual 100.00% (10/10) -github.com/btcsuite/btcscript/opcode.go opcodeMin 100.00% (10/10) -github.com/btcsuite/btcscript/opcode.go opcodeBoolOr 100.00% (10/10) -github.com/btcsuite/btcscript/opcode.go opcodeLessThanOrEqual 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/script.go PushedData 100.00% (10/10) -github.com/btcsuite/btcscript/opcode.go opcodeNumEqual 100.00% (10/10) -github.com/btcsuite/btcscript/opcode.go opcodeNumNotEqual 100.00% (10/10) -github.com/btcsuite/btcscript/opcode.go opcodeGreaterThan 100.00% (10/10) -github.com/btcsuite/btcscript/stack.go Stack.RotN 100.00% (9/9) -github.com/btcsuite/btcscript/script.go SignatureScript 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 DisasmString 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/stack.go Stack.DupN 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/opcode.go opcodeEqual 100.00% (8/8) -github.com/btcsuite/btcscript/script.go MultiSigScript 100.00% (8/8) -github.com/btcsuite/btcscript/opcode.go opcode0NotEqual 100.00% (7/7) -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/script.go HasCanonicalPushes 100.00% (7/7) -github.com/btcsuite/btcscript/opcode.go opcodeVerify 100.00% (6/6) -github.com/btcsuite/btcscript/opcode.go opcodeIfDup 100.00% (6/6) -github.com/btcsuite/btcscript/opcode.go parsedOpcode.conditional 100.00% (6/6) -github.com/btcsuite/btcscript/opcode.go opcodeElse 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/opcode.go opcodeCheckMultiSigVerify 100.00% (4/4) -github.com/btcsuite/btcscript/script.go IsPayToScriptHash 100.00% (4/4) -github.com/btcsuite/btcscript/script.go isNullData 100.00% (4/4) -github.com/btcsuite/btcscript/script.go IsPushOnlyScript 100.00% (4/4) -github.com/btcsuite/btcscript/opcode.go opcodeNumEqualVerify 100.00% (4/4) -github.com/btcsuite/btcscript/script.go GetScriptClass 100.00% (4/4) -github.com/btcsuite/btcscript/opcode.go opcodeEqualVerify 100.00% (4/4) -github.com/btcsuite/btcscript/script.go Script.DisasmPC 100.00% (4/4) -github.com/btcsuite/btcscript/script.go isPushOnly 100.00% (4/4) -github.com/btcsuite/btcscript/script.go @1346:17 100.00% (4/4) -github.com/btcsuite/btcscript/script.go getStack 100.00% (4/4) -github.com/btcsuite/btcscript/script.go Script.curPC 100.00% (4/4) -github.com/btcsuite/btcscript/opcode.go opcodeNop 100.00% (4/4) -github.com/btcsuite/btcscript/stack.go asBool 100.00% (4/4) -github.com/btcsuite/btcscript/stack.go Stack.PopInt 100.00% (4/4) -github.com/btcsuite/btcscript/stack.go Stack.PopBool 100.00% (4/4) -github.com/btcsuite/btcscript/stack.go Stack.PeekByteArray 100.00% (4/4) -github.com/btcsuite/btcscript/stack.go Stack.PeekInt 100.00% (4/4) -github.com/btcsuite/btcscript/stack.go Stack.PeekBool 100.00% (4/4) -github.com/btcsuite/btcscript/opcode.go parsedOpcode.alwaysIllegal 100.00% (4/4) -github.com/btcsuite/btcscript/opcode.go opcodeCheckSigVerify 100.00% (4/4) -github.com/btcsuite/btcscript/script.go asSmallInt 100.00% (3/3) -github.com/btcsuite/btcscript/script.go ScriptClass.String 100.00% (3/3) -github.com/btcsuite/btcscript/stack.go fromBool 100.00% (3/3) -github.com/btcsuite/btcscript/scriptbuilder.go ScriptBuilder.Reset 100.00% (3/3) -github.com/btcsuite/btcscript/script.go isSmallInt 100.00% (3/3) -github.com/btcsuite/btcscript/scriptbuilder.go ScriptBuilder.AddFullData 100.00% (3/3) -github.com/btcsuite/btcscript/script.go setStack 100.00% (3/3) -github.com/btcsuite/btcscript/opcode.go opcodeN 100.00% (2/2) -github.com/btcsuite/btcscript/stack.go Stack.Depth 100.00% (2/2) -github.com/btcsuite/btcscript/opcode.go calcHash 100.00% (2/2) -github.com/btcsuite/btcscript/opcode.go opcode1Negate 100.00% (2/2) -github.com/btcsuite/btcscript/opcode.go opcodeCodeSeparator 100.00% (2/2) -github.com/btcsuite/btcscript/stack.go Stack.NipN 100.00% (2/2) -github.com/btcsuite/btcscript/script.go GetSigOpCount 100.00% (2/2) -github.com/btcsuite/btcscript/opcode.go opcodeFalse 100.00% (2/2) -github.com/btcsuite/btcscript/opcode.go opcodeDepth 100.00% (2/2) -github.com/btcsuite/btcscript/opcode.go opcodePushData 100.00% (2/2) -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/opcode.go opcode3Dup 100.00% (1/1) -github.com/btcsuite/btcscript/opcode.go init 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/opcode.go opcode2Dup 100.00% (1/1) -github.com/btcsuite/btcscript/opcode.go opcodeOver 100.00% (1/1) -github.com/btcsuite/btcscript/opcode.go opcodeNip 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/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 opcode2Drop 100.00% (1/1) -github.com/btcsuite/btcscript/opcode.go opcodeDup 100.00% (1/1) -github.com/btcsuite/btcscript/opcode.go opcodeDrop 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/script.go Script.SetAltStack 100.00% (1/1) -github.com/btcsuite/btcscript/opcode.go opcode2Swap 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 opcodeInvalid 100.00% (1/1) -github.com/btcsuite/btcscript/scriptbuilder.go ScriptBuilder.Script 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/log.go newLogClosure 100.00% (1/1) -github.com/btcsuite/btcscript/stack.go Stack.PushByteArray 100.00% (1/1) -github.com/btcsuite/btcscript/script.go isPubkeyHash 100.00% (1/1) -github.com/btcsuite/btcscript/script.go isScriptHash 100.00% (1/1) -github.com/btcsuite/btcscript/stack.go Stack.PushInt 100.00% (1/1) -github.com/btcsuite/btcscript/opcode.go calcHash160 100.00% (1/1) -github.com/btcsuite/btcscript/stack.go Stack.PushBool 100.00% (1/1) -github.com/btcsuite/btcscript/stack.go Stack.PopByteArray 100.00% (1/1) -github.com/btcsuite/btcscript/script.go isPubkey 100.00% (1/1) -github.com/btcsuite/btcscript/log.go UseLogger 100.00% (1/1) -github.com/btcsuite/btcscript/script.go parseScript 100.00% (1/1) -github.com/btcsuite/btcscript/opcode.go opcodeTuck 100.00% (1/1) -github.com/btcsuite/btcscript/opcode.go opcodeSwap 100.00% (1/1) -github.com/btcsuite/btcscript/opcode.go opcodeRot 100.00% (1/1) -github.com/btcsuite/btcscript/opcode.go opcodeReturn 100.00% (1/1) -github.com/btcsuite/btcscript/scriptbuilder.go ErrScriptNotCanonical.Error 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 @606:34 0.00% (0/6) -github.com/btcsuite/btcscript/script.go @594:34 0.00% (0/4) -github.com/btcsuite/btcscript/stack.go Stack.String 0.00% (0/4) -github.com/btcsuite/btcscript/script.go @639:34 0.00% (0/3) -github.com/btcsuite/btcscript/opcode.go opcodeDisabled 0.00% (0/1) -github.com/btcsuite/btcscript/log.go logClosure.String 0.00% (0/1) -github.com/btcsuite/btcscript/opcode.go @1810:33 0.00% (0/1) -github.com/btcsuite/btcscript --------------------------- 96.69% (1284/1328) - diff --git a/README.md b/txscript/README.md similarity index 53% rename from README.md rename to txscript/README.md index 35340507..96fce144 100644 --- a/README.md +++ b/txscript/README.md @@ -1,20 +1,15 @@ -btcscript -========= +txscript +======== -[![Build Status](https://travis-ci.org/btcsuite/btcscript.png?branch=master)] -(https://travis-ci.org/btcsuite/btcscript) +[![Build Status](https://travis-ci.org/btcsuite/btcd.png?branch=master)] +(https://travis-ci.org/btcsuite/btcd) -Package btcscript implements the bitcoin transaction scripts. There is -a comprehensive test suite. `test_coverage.txt` contains the current -coverage statistics (generated using gocov). On a UNIX-like OS, the -script `cov_report.sh` can be used to generate the report. Package -btcscript is licensed under the liberal ISC license. +Package txscript implements the bitcoin transaction script language. There is +a comprehensive test suite. Package txscript is licensed under the liberal ISC +license. -This package is one of the core packages from btcd, an alternative full-node -implementation of bitcoin which is under active development by Conformal. -Although it was primarily written for btcd, this package has intentionally been -designed so it can be used as a standalone package for any projects needing to -use or validate bitcoin transaction scripts. +This package has intentionally been designed so it can be used as a standalone +package for any projects needing to use or validate bitcoin transaction scripts. ## Bitcoin Scripts @@ -25,39 +20,35 @@ can be found at https://en.bitcoin.it/wiki/Script ## Documentation -[![GoDoc](https://godoc.org/github.com/btcsuite/btcscript?status.png)] -(http://godoc.org/github.com/btcsuite/btcscript) +[![GoDoc](https://godoc.org/github.com/btcsuite/btcd/txscript?status.png)] +(http://godoc.org/github.com/btcsuite/btcd/txscript) Full `go doc` style documentation for the project can be viewed online without installing this package by using the GoDoc site -[here](http://godoc.org/github.com/btcsuite/btcscript). +[here](http://godoc.org/github.com/btcsuite/btcd/txscript). You can also view the documentation locally once the package is installed with the `godoc` tool by running `godoc -http=":6060"` and pointing your browser to -http://localhost:6060/pkg/github.com/btcsuite/btcscript +http://localhost:6060/pkg/github.com/btcsuite/btcd/txscript ## Installation ```bash -$ go get github.com/btcsuite/btcscript +$ go get github.com/btcsuite/btcd/txscript ``` ## Examples * [Standard Pay-to-pubkey-hash Script] - (http://godoc.org/github.com/btcsuite/btcscript#example-PayToAddrScript) + (http://godoc.org/github.com/btcsuite/btcd/txscript#example-PayToAddrScript) Demonstrates creating a script which pays to a bitcoin address. It also prints the created script hex and uses the DisasmString function to display the disassembled script. * [Extracting Details from Standard Scripts] - (http://godoc.org/github.com/btcsuite/btcscript#example-ExtractPkScriptAddrs) + (http://godoc.org/github.com/btcsuite/btcd/txscript#example-ExtractPkScriptAddrs) Demonstrates extracting information from a standard public key script. -## TODO - -- Increase test coverage to 100% - ## GPG Verification Key All official release tags are signed by Conformal so users can ensure the code @@ -80,4 +71,4 @@ signature perform the following: ## License -Package btcscript is licensed under the liberal ISC License. +Package txscript is licensed under the liberal ISC License. diff --git a/address.go b/txscript/address.go similarity index 97% rename from address.go rename to txscript/address.go index 7f6b9872..cfa5dd09 100644 --- a/address.go +++ b/txscript/address.go @@ -1,8 +1,8 @@ -// Copyright (c) 2013-2014 Conformal Systems LLC. +// Copyright (c) 2013-2015 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcscript +package txscript import ( "github.com/btcsuite/btcnet" diff --git a/address_test.go b/txscript/address_test.go similarity index 93% rename from address_test.go rename to txscript/address_test.go index 36598e88..9345e7d7 100644 --- a/address_test.go +++ b/txscript/address_test.go @@ -1,15 +1,15 @@ -// Copyright (c) 2013-2014 Conformal Systems LLC. +// Copyright (c) 2013-2015 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcscript_test +package txscript_test import ( "encoding/hex" "reflect" "testing" + "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcnet" - "github.com/btcsuite/btcscript" "github.com/btcsuite/btcutil" ) @@ -75,7 +75,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { script []byte addrs []btcutil.Address reqSigs int - class btcscript.ScriptClass + class txscript.ScriptClass }{ { name: "standard p2pk with compressed pubkey (0x02)", @@ -87,7 +87,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { "4895dca52c6b4")), }, reqSigs: 1, - class: btcscript.PubKeyTy, + class: txscript.PubKeyTy, }, { name: "standard p2pk with uncompressed pubkey (0x04)", @@ -103,7 +103,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { "412a3")), }, reqSigs: 1, - class: btcscript.PubKeyTy, + class: txscript.PubKeyTy, }, { name: "standard p2pk with hybrid pubkey (0x06)", @@ -119,7 +119,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { "f453e")), }, reqSigs: 1, - class: btcscript.PubKeyTy, + class: txscript.PubKeyTy, }, { name: "standard p2pk with compressed pubkey (0x03)", @@ -131,7 +131,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { "409273eb16e65")), }, reqSigs: 1, - class: btcscript.PubKeyTy, + class: txscript.PubKeyTy, }, { name: "2nd standard p2pk with uncompressed pubkey (0x04)", @@ -147,7 +147,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { "8ef7b")), }, reqSigs: 1, - class: btcscript.PubKeyTy, + class: txscript.PubKeyTy, }, { name: "standard p2pk with hybrid pubkey (0x07)", @@ -163,7 +163,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { "8ef7b")), }, reqSigs: 1, - class: btcscript.PubKeyTy, + class: txscript.PubKeyTy, }, { name: "standard p2pkh", @@ -174,7 +174,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { "cbca9a9e3713bd7587509a30564")), }, reqSigs: 1, - class: btcscript.PubKeyHashTy, + class: txscript.PubKeyHashTy, }, { name: "standard p2sh", @@ -185,7 +185,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { "ee0189dd5cc67f1b0e5f02f45cb")), }, reqSigs: 1, - class: btcscript.ScriptHashTy, + class: txscript.ScriptHashTy, }, // from real tx 60a20bd93aa49ab4b28d514ec10b06e1829ce6818ec06cd3aabd013ebcdc4bb1, vout 0 { @@ -210,7 +210,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { "342af")), }, reqSigs: 1, - class: btcscript.MultiSigTy, + class: txscript.MultiSigTy, }, // from real tx d646f82bd5fbdb94a36872ce460f97662b80c3050ad3209bef9d1e398ea277ab, vin 1 { @@ -243,7 +243,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { "0421a")), }, reqSigs: 2, - class: btcscript.MultiSigTy, + class: txscript.MultiSigTy, }, // The below are nonstandard script due to things such as @@ -258,7 +258,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { "f656b412a3"), addrs: nil, reqSigs: 0, - class: btcscript.NonStandardTy, + class: txscript.NonStandardTy, }, { name: "valid signature from a sigscript - no addresses", @@ -268,7 +268,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { "4622082221a8768d1d0901"), addrs: nil, reqSigs: 0, - class: btcscript.NonStandardTy, + class: txscript.NonStandardTy, }, // Note the technically the pubkey is the second item on the // stack, but since the address extraction intentionally only @@ -285,7 +285,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { "a75a71042d40388a4d307f887d"), addrs: nil, reqSigs: 0, - class: btcscript.NonStandardTy, + class: txscript.NonStandardTy, }, // from real tx 691dd277dc0e90a462a3d652a1171686de49cf19067cd33c7df0392833fb986a, vout 0 // invalid public keys @@ -303,7 +303,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { "35616463636453ae"), addrs: []btcutil.Address{}, reqSigs: 1, - class: btcscript.MultiSigTy, + class: txscript.MultiSigTy, }, // from real tx: 691dd277dc0e90a462a3d652a1171686de49cf19067cd33c7df0392833fb986a, vout 44 // invalid public keys @@ -319,27 +319,27 @@ func TestExtractPkScriptAddrs(t *testing.T) { "38613663663530616234636434340a00000053ae"), addrs: []btcutil.Address{}, reqSigs: 1, - class: btcscript.MultiSigTy, + class: txscript.MultiSigTy, }, { name: "empty script", script: []byte{}, addrs: nil, reqSigs: 0, - class: btcscript.NonStandardTy, + class: txscript.NonStandardTy, }, { name: "script that does not parse", - script: []byte{btcscript.OP_DATA_45}, + script: []byte{txscript.OP_DATA_45}, addrs: nil, reqSigs: 0, - class: btcscript.NonStandardTy, + class: txscript.NonStandardTy, }, } t.Logf("Running %d tests.", len(tests)) for i, test := range tests { - class, addrs, reqSigs, err := btcscript.ExtractPkScriptAddrs( + class, addrs, reqSigs, err := txscript.ExtractPkScriptAddrs( test.script, &btcnet.MainNetParams) if err != nil { } diff --git a/data/LICENSE b/txscript/data/LICENSE similarity index 100% rename from data/LICENSE rename to txscript/data/LICENSE diff --git a/data/script_invalid.json b/txscript/data/script_invalid.json similarity index 100% rename from data/script_invalid.json rename to txscript/data/script_invalid.json diff --git a/data/script_valid.json b/txscript/data/script_valid.json similarity index 100% rename from data/script_valid.json rename to txscript/data/script_valid.json diff --git a/data/tx_invalid.json b/txscript/data/tx_invalid.json similarity index 100% rename from data/tx_invalid.json rename to txscript/data/tx_invalid.json diff --git a/data/tx_valid.json b/txscript/data/tx_valid.json similarity index 100% rename from data/tx_valid.json rename to txscript/data/tx_valid.json diff --git a/doc.go b/txscript/doc.go similarity index 87% rename from doc.go rename to txscript/doc.go index 64d9e095..dfd1f2f2 100644 --- a/doc.go +++ b/txscript/doc.go @@ -1,9 +1,9 @@ -// Copyright (c) 2013-2014 Conformal Systems LLC. +// Copyright (c) 2013-2015 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. /* -Package btcscript implements bitcoin transaction scripts. +Package txscript implements the bitcoin transaction script language. A complete description of the script language used by bitcoin can be found at https://en.bitcoin.it/wiki/Script. The following only serves as a quick @@ -32,8 +32,8 @@ what conditions must be met in order to spend bitcoins. Errors -Errors returned by this package are of the form btcscript.ErrStackX where X +Errors returned by this package are of the form txscript.ErrStackX where X indicates the specific error. See Variables in the package documentation for a full list. */ -package btcscript +package txscript diff --git a/example_test.go b/txscript/example_test.go similarity index 87% rename from example_test.go rename to txscript/example_test.go index a798e288..4317ef5c 100644 --- a/example_test.go +++ b/txscript/example_test.go @@ -1,15 +1,15 @@ -// Copyright (c) 2014 Conformal Systems LLC. +// Copyright (c) 2014-2015 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcscript_test +package txscript_test import ( "encoding/hex" "fmt" + "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcnet" - "github.com/btcsuite/btcscript" "github.com/btcsuite/btcutil" ) @@ -29,14 +29,14 @@ func ExamplePayToAddrScript() { } // Create a public key script that pays to the address. - script, err := btcscript.PayToAddrScript(address) + script, err := txscript.PayToAddrScript(address) if err != nil { fmt.Println(err) return } fmt.Printf("Script Hex: %x\n", script) - disasm, err := btcscript.DisasmString(script) + disasm, err := txscript.DisasmString(script) if err != nil { fmt.Println(err) return @@ -60,7 +60,7 @@ func ExampleExtractPkScriptAddrs() { } // Extract and print details from the script. - scriptClass, addresses, reqSigs, err := btcscript.ExtractPkScriptAddrs( + scriptClass, addresses, reqSigs, err := txscript.ExtractPkScriptAddrs( script, &btcnet.MainNetParams) if err != nil { fmt.Println(err) diff --git a/internal_test.go b/txscript/internal_test.go similarity index 99% rename from internal_test.go rename to txscript/internal_test.go index fa2bf539..1bd9cd47 100644 --- a/internal_test.go +++ b/txscript/internal_test.go @@ -1,8 +1,8 @@ -// Copyright (c) 2013-2014 Conformal Systems LLC. +// Copyright (c) 2013-2015 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcscript +package txscript import ( "encoding/hex" diff --git a/log.go b/txscript/log.go similarity index 96% rename from log.go rename to txscript/log.go index 8f7cc5cf..60d86926 100644 --- a/log.go +++ b/txscript/log.go @@ -1,8 +1,8 @@ -// Copyright (c) 2013-2014 Conformal Systems LLC. +// Copyright (c) 2013-2015 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcscript +package txscript import ( "errors" diff --git a/log_test.go b/txscript/log_test.go similarity index 88% rename from log_test.go rename to txscript/log_test.go index 3b740de1..15f369c1 100644 --- a/log_test.go +++ b/txscript/log_test.go @@ -1,8 +1,8 @@ -// Copyright (c) 2013-2014 Conformal Systems LLC. +// Copyright (c) 2013-2015 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcscript_test +package txscript_test import ( "errors" @@ -10,7 +10,7 @@ import ( "os" "testing" - "github.com/btcsuite/btcscript" + "github.com/btcsuite/btcd/txscript" ) func TestSetLogWriter(t *testing.T) { @@ -48,7 +48,7 @@ func TestSetLogWriter(t *testing.T) { t.Logf("Running %d tests", len(tests)) for i, test := range tests { - err := btcscript.SetLogWriter(test.w, test.level) + err := txscript.SetLogWriter(test.w, test.level) if err != nil { if err.Error() != test.expected.Error() { t.Errorf("SetLogWriter #%d (%s) wrong result\n"+ diff --git a/opcode.go b/txscript/opcode.go similarity index 99% rename from opcode.go rename to txscript/opcode.go index 07d6b30f..6ae2f58c 100644 --- a/opcode.go +++ b/txscript/opcode.go @@ -1,8 +1,8 @@ -// Copyright (c) 2013-2014 Conformal Systems LLC. +// Copyright (c) 2013-2015 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcscript +package txscript import ( "bytes" @@ -20,7 +20,7 @@ import ( "github.com/btcsuite/fastsha256" ) -// An opcode defines the information related to a btcscript opcode. +// An opcode defines the information related to a txscript opcode. // opfunc if present is the function to call to perform the opcode on // the script. The current script is passed in as a slice with the firs // member being the opcode itself. diff --git a/opcode_test.go b/txscript/opcode_test.go similarity index 64% rename from opcode_test.go rename to txscript/opcode_test.go index 9b4ac4d8..b237df11 100644 --- a/opcode_test.go +++ b/txscript/opcode_test.go @@ -1,14 +1,14 @@ -// Copyright (c) 2013-2014 Conformal Systems LLC. +// Copyright (c) 2013-2015 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcscript_test +package txscript_test import ( "bytes" "testing" - "github.com/btcsuite/btcscript" + "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcwire" ) @@ -24,357 +24,357 @@ func TestScripts(t *testing.T) { shouldFail error }{ // does nothing, but doesn't put a true on the stack, should fail - {script: []byte{btcscript.OP_NOP}, shouldPass: false}, + {script: []byte{txscript.OP_NOP}, shouldPass: false}, // should just put true on the stack, thus passes. - {script: []byte{btcscript.OP_TRUE}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE}, shouldPass: true}, // should just put false on the stack, thus fails. - {script: []byte{btcscript.OP_FALSE}, shouldPass: false}, + {script: []byte{txscript.OP_FALSE}, shouldPass: false}, // tests OP_VERIFY (true). true is needed since else stack is empty. - {script: []byte{btcscript.OP_TRUE, btcscript.OP_VERIFY, - btcscript.OP_TRUE}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_VERIFY, + txscript.OP_TRUE}, shouldPass: true}, // tests OP_VERIFY (false), will error out. - {script: []byte{btcscript.OP_FALSE, btcscript.OP_VERIFY, - btcscript.OP_TRUE}, shouldPass: false}, + {script: []byte{txscript.OP_FALSE, txscript.OP_VERIFY, + txscript.OP_TRUE}, shouldPass: false}, // tests OP_VERIFY with empty stack (errors) - {script: []byte{btcscript.OP_VERIFY}, shouldPass: false}, + {script: []byte{txscript.OP_VERIFY}, shouldPass: false}, // test OP_RETURN immediately fails the script (empty stack) - {script: []byte{btcscript.OP_RETURN}, shouldPass: false}, + {script: []byte{txscript.OP_RETURN}, shouldPass: false}, // test OP_RETURN immediately fails the script (full stack) - {script: []byte{btcscript.OP_TRUE, btcscript.OP_RETURN}, + {script: []byte{txscript.OP_TRUE, txscript.OP_RETURN}, shouldPass: false}, // tests numequal with a trivial example (passing) - {script: []byte{btcscript.OP_TRUE, btcscript.OP_TRUE, - btcscript.OP_NUMEQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_TRUE, + txscript.OP_NUMEQUAL}, shouldPass: true}, // tests numequal with a trivial example (failing) - {script: []byte{btcscript.OP_TRUE, btcscript.OP_FALSE, - btcscript.OP_NUMEQUAL}, shouldPass: false}, + {script: []byte{txscript.OP_TRUE, txscript.OP_FALSE, + txscript.OP_NUMEQUAL}, shouldPass: false}, // tests numequal with insufficient arguments (1/2) - {script: []byte{btcscript.OP_TRUE, btcscript.OP_NUMEQUAL}, + {script: []byte{txscript.OP_TRUE, txscript.OP_NUMEQUAL}, shouldPass: false}, // tests numequal with insufficient arguments (0/2) - {script: []byte{btcscript.OP_NUMEQUAL}, shouldPass: false}, + {script: []byte{txscript.OP_NUMEQUAL}, shouldPass: false}, // tests numnotequal with a trivial example (passing) - {script: []byte{btcscript.OP_TRUE, btcscript.OP_FALSE, - btcscript.OP_NUMNOTEQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_FALSE, + txscript.OP_NUMNOTEQUAL}, shouldPass: true}, // tests numnotequal with a trivial example (failing) - {script: []byte{btcscript.OP_TRUE, btcscript.OP_TRUE, - btcscript.OP_NUMNOTEQUAL}, shouldPass: false}, + {script: []byte{txscript.OP_TRUE, txscript.OP_TRUE, + txscript.OP_NUMNOTEQUAL}, shouldPass: false}, // tests numnotequal with insufficient arguments (1/2) - {script: []byte{btcscript.OP_TRUE, btcscript.OP_NUMNOTEQUAL}, + {script: []byte{txscript.OP_TRUE, txscript.OP_NUMNOTEQUAL}, shouldPass: false}, // tests numnotequal with insufficient arguments (0/2) - {script: []byte{btcscript.OP_NUMNOTEQUAL}, shouldPass: false}, + {script: []byte{txscript.OP_NUMNOTEQUAL}, shouldPass: false}, // test numequal_verify with a trivial example (passing) - {script: []byte{btcscript.OP_TRUE, btcscript.OP_TRUE, - btcscript.OP_NUMEQUALVERIFY, btcscript.OP_TRUE}, + {script: []byte{txscript.OP_TRUE, txscript.OP_TRUE, + txscript.OP_NUMEQUALVERIFY, txscript.OP_TRUE}, shouldPass: true}, // test numequal_verify with a trivial example (failing) - {script: []byte{btcscript.OP_TRUE, btcscript.OP_FALSE, - btcscript.OP_NUMEQUALVERIFY, btcscript.OP_TRUE}, + {script: []byte{txscript.OP_TRUE, txscript.OP_FALSE, + txscript.OP_NUMEQUALVERIFY, txscript.OP_TRUE}, shouldPass: false}, // test OP_1ADD by adding 1 to 0 - {script: []byte{btcscript.OP_FALSE, btcscript.OP_1ADD}, + {script: []byte{txscript.OP_FALSE, txscript.OP_1ADD}, shouldPass: true}, // test OP_1ADD without args (should error) - {script: []byte{btcscript.OP_1ADD}, shouldPass: false}, + {script: []byte{txscript.OP_1ADD}, shouldPass: false}, // test OP_1NEGATE by adding 1 to -1 - {script: []byte{btcscript.OP_1NEGATE, btcscript.OP_1ADD}, + {script: []byte{txscript.OP_1NEGATE, txscript.OP_1ADD}, shouldPass: false}, // test OP_1NEGATE by adding negating -1 - {script: []byte{btcscript.OP_1NEGATE, btcscript.OP_NEGATE}, + {script: []byte{txscript.OP_1NEGATE, txscript.OP_NEGATE}, shouldPass: true}, // test OP_NEGATE by adding 1 to -1 - {script: []byte{btcscript.OP_TRUE, btcscript.OP_NEGATE, - btcscript.OP_1ADD}, shouldPass: false}, + {script: []byte{txscript.OP_TRUE, txscript.OP_NEGATE, + txscript.OP_1ADD}, shouldPass: false}, // test OP_NEGATE with no args - {script: []byte{btcscript.OP_NEGATE}, shouldPass: false}, + {script: []byte{txscript.OP_NEGATE}, shouldPass: false}, // test OP_1SUB -> 1 - 1 = 0 - {script: []byte{btcscript.OP_TRUE, btcscript.OP_1SUB}, + {script: []byte{txscript.OP_TRUE, txscript.OP_1SUB}, shouldPass: false}, // test OP_1SUB -> negate(0 -1) = 1 - {script: []byte{btcscript.OP_FALSE, btcscript.OP_1SUB, - btcscript.OP_NEGATE}, shouldPass: true}, + {script: []byte{txscript.OP_FALSE, txscript.OP_1SUB, + txscript.OP_NEGATE}, shouldPass: true}, // test OP_1SUB with empty stack - {script: []byte{btcscript.OP_1SUB}, shouldPass: false}, + {script: []byte{txscript.OP_1SUB}, shouldPass: false}, // OP_DEPTH with empty stack, means 0 on stack at end - {script: []byte{btcscript.OP_DEPTH}, shouldPass: false}, + {script: []byte{txscript.OP_DEPTH}, shouldPass: false}, // 1 +1 -1 = 1. tests depth + add - {script: []byte{btcscript.OP_TRUE, btcscript.OP_DEPTH, btcscript.OP_ADD, - btcscript.OP_1SUB}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_DEPTH, txscript.OP_ADD, + txscript.OP_1SUB}, shouldPass: true}, // 1 +1 -1 = 0 . tests dept + add - {script: []byte{btcscript.OP_TRUE, btcscript.OP_DEPTH, - btcscript.OP_ADD, btcscript.OP_1SUB, btcscript.OP_1SUB}, + {script: []byte{txscript.OP_TRUE, txscript.OP_DEPTH, + txscript.OP_ADD, txscript.OP_1SUB, txscript.OP_1SUB}, shouldPass: false}, // OP_ADD with only one thing on stack should error - {script: []byte{btcscript.OP_TRUE, btcscript.OP_ADD}, + {script: []byte{txscript.OP_TRUE, txscript.OP_ADD}, shouldPass: false}, // OP_ADD with nothing on stack should error - {script: []byte{btcscript.OP_ADD}, shouldPass: false}, + {script: []byte{txscript.OP_ADD}, shouldPass: false}, // OP_SUB: 1-1=0 - {script: []byte{btcscript.OP_TRUE, btcscript.OP_TRUE, - btcscript.OP_SUB}, shouldPass: false}, + {script: []byte{txscript.OP_TRUE, txscript.OP_TRUE, + txscript.OP_SUB}, shouldPass: false}, // OP_SUB: 1+1-1=1 - {script: []byte{btcscript.OP_TRUE, btcscript.OP_TRUE, btcscript.OP_TRUE, - btcscript.OP_ADD, btcscript.OP_SUB}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_TRUE, txscript.OP_TRUE, + txscript.OP_ADD, txscript.OP_SUB}, shouldPass: true}, // OP_SUB with only one thing on stack should error - {script: []byte{btcscript.OP_TRUE, btcscript.OP_SUB}, + {script: []byte{txscript.OP_TRUE, txscript.OP_SUB}, shouldPass: false}, // OP_SUB with nothing on stack should error - {script: []byte{btcscript.OP_SUB}, shouldPass: false}, + {script: []byte{txscript.OP_SUB}, shouldPass: false}, // OP_LESSTHAN 1 < 1 == false - {script: []byte{btcscript.OP_TRUE, btcscript.OP_TRUE, - btcscript.OP_LESSTHAN}, shouldPass: false}, + {script: []byte{txscript.OP_TRUE, txscript.OP_TRUE, + txscript.OP_LESSTHAN}, shouldPass: false}, // OP_LESSTHAN 1 < 0 == false - {script: []byte{btcscript.OP_TRUE, btcscript.OP_FALSE, - btcscript.OP_LESSTHAN}, shouldPass: false}, + {script: []byte{txscript.OP_TRUE, txscript.OP_FALSE, + txscript.OP_LESSTHAN}, shouldPass: false}, // OP_LESSTHAN 0 < 1 == true - {script: []byte{btcscript.OP_FALSE, btcscript.OP_TRUE, - btcscript.OP_LESSTHAN}, shouldPass: true}, + {script: []byte{txscript.OP_FALSE, txscript.OP_TRUE, + txscript.OP_LESSTHAN}, shouldPass: true}, // OP_LESSTHAN only one arg - {script: []byte{btcscript.OP_TRUE, btcscript.OP_LESSTHAN}, + {script: []byte{txscript.OP_TRUE, txscript.OP_LESSTHAN}, shouldPass: false}, // OP_LESSTHAN no args - {script: []byte{btcscript.OP_LESSTHAN}, shouldPass: false}, + {script: []byte{txscript.OP_LESSTHAN}, shouldPass: false}, // OP_LESSTHANOREQUAL 1 <= 1 == true - {script: []byte{btcscript.OP_TRUE, btcscript.OP_TRUE, - btcscript.OP_LESSTHANOREQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_TRUE, + txscript.OP_LESSTHANOREQUAL}, shouldPass: true}, // OP_LESSTHANOREQUAL 1 <= 0 == false - {script: []byte{btcscript.OP_TRUE, btcscript.OP_FALSE, - btcscript.OP_LESSTHANOREQUAL}, shouldPass: false}, + {script: []byte{txscript.OP_TRUE, txscript.OP_FALSE, + txscript.OP_LESSTHANOREQUAL}, shouldPass: false}, // OP_LESSTHANOREQUAL 0 <= 1 == true - {script: []byte{btcscript.OP_FALSE, btcscript.OP_TRUE, - btcscript.OP_LESSTHANOREQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_FALSE, txscript.OP_TRUE, + txscript.OP_LESSTHANOREQUAL}, shouldPass: true}, // OP_LESSTHANOREQUAL only one arg - {script: []byte{btcscript.OP_TRUE, btcscript.OP_LESSTHANOREQUAL}, + {script: []byte{txscript.OP_TRUE, txscript.OP_LESSTHANOREQUAL}, shouldPass: false}, // OP_LESSTHANOREQUAL no args - {script: []byte{btcscript.OP_LESSTHANOREQUAL}, shouldPass: false}, + {script: []byte{txscript.OP_LESSTHANOREQUAL}, shouldPass: false}, // OP_GREATERTHAN 1 > 1 == false - {script: []byte{btcscript.OP_TRUE, btcscript.OP_TRUE, - btcscript.OP_GREATERTHAN}, shouldPass: false}, + {script: []byte{txscript.OP_TRUE, txscript.OP_TRUE, + txscript.OP_GREATERTHAN}, shouldPass: false}, // OP_GREATERTHAN 1 > 0 == true - {script: []byte{btcscript.OP_TRUE, btcscript.OP_FALSE, - btcscript.OP_GREATERTHAN}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_FALSE, + txscript.OP_GREATERTHAN}, shouldPass: true}, // OP_GREATERTHAN 0 > 1 == false - {script: []byte{btcscript.OP_FALSE, btcscript.OP_TRUE, - btcscript.OP_GREATERTHAN}, shouldPass: false}, + {script: []byte{txscript.OP_FALSE, txscript.OP_TRUE, + txscript.OP_GREATERTHAN}, shouldPass: false}, // OP_GREATERTHAN only one arg - {script: []byte{btcscript.OP_TRUE, btcscript.OP_GREATERTHAN}, + {script: []byte{txscript.OP_TRUE, txscript.OP_GREATERTHAN}, shouldPass: false}, // OP_GREATERTHAN no args - {script: []byte{btcscript.OP_GREATERTHAN}, shouldPass: false}, + {script: []byte{txscript.OP_GREATERTHAN}, shouldPass: false}, // OP_GREATERTHANOREQUAL 1 >= 1 == true - {script: []byte{btcscript.OP_TRUE, btcscript.OP_TRUE, - btcscript.OP_GREATERTHANOREQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_TRUE, + txscript.OP_GREATERTHANOREQUAL}, shouldPass: true}, // OP_GREATERTHANOREQUAL 1 >= 0 == false - {script: []byte{btcscript.OP_TRUE, btcscript.OP_FALSE, - btcscript.OP_GREATERTHANOREQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_FALSE, + txscript.OP_GREATERTHANOREQUAL}, shouldPass: true}, // OP_GREATERTHANOREQUAL 0 >= 1 == true - {script: []byte{btcscript.OP_FALSE, btcscript.OP_TRUE, - btcscript.OP_GREATERTHANOREQUAL}, shouldPass: false}, + {script: []byte{txscript.OP_FALSE, txscript.OP_TRUE, + txscript.OP_GREATERTHANOREQUAL}, shouldPass: false}, // OP_GREATERTHANOREQUAL only one arg - {script: []byte{btcscript.OP_TRUE, btcscript.OP_GREATERTHANOREQUAL}, + {script: []byte{txscript.OP_TRUE, txscript.OP_GREATERTHANOREQUAL}, shouldPass: false}, // OP_GREATERTHANOREQUAL no args - {script: []byte{btcscript.OP_GREATERTHANOREQUAL}, shouldPass: false}, + {script: []byte{txscript.OP_GREATERTHANOREQUAL}, shouldPass: false}, // OP_MIN basic functionality -> min(0,1) = 0 = min(1,0) - {script: []byte{btcscript.OP_TRUE, btcscript.OP_FALSE, - btcscript.OP_MIN}, shouldPass: false}, - {script: []byte{btcscript.OP_FALSE, btcscript.OP_TRUE, - btcscript.OP_MIN}, shouldPass: false}, + {script: []byte{txscript.OP_TRUE, txscript.OP_FALSE, + txscript.OP_MIN}, shouldPass: false}, + {script: []byte{txscript.OP_FALSE, txscript.OP_TRUE, + txscript.OP_MIN}, shouldPass: false}, // OP_MIN -> 1 arg errors - {script: []byte{btcscript.OP_TRUE, btcscript.OP_MIN}, + {script: []byte{txscript.OP_TRUE, txscript.OP_MIN}, shouldPass: false}, // OP_MIN -> 0 arg errors - {script: []byte{btcscript.OP_MIN}, shouldPass: false}, + {script: []byte{txscript.OP_MIN}, shouldPass: false}, // OP_MAX basic functionality -> max(0,1) = 1 = max(1,0) - {script: []byte{btcscript.OP_TRUE, btcscript.OP_FALSE, - btcscript.OP_MAX}, shouldPass: true}, - {script: []byte{btcscript.OP_FALSE, btcscript.OP_TRUE, - btcscript.OP_MAX}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_FALSE, + txscript.OP_MAX}, shouldPass: true}, + {script: []byte{txscript.OP_FALSE, txscript.OP_TRUE, + txscript.OP_MAX}, shouldPass: true}, // OP_MAX -> 1 arg errors - {script: []byte{btcscript.OP_TRUE, btcscript.OP_MAX}, + {script: []byte{txscript.OP_TRUE, txscript.OP_MAX}, shouldPass: false}, // OP_MAX -> 0 arg errors - {script: []byte{btcscript.OP_MAX}, shouldPass: false}, + {script: []byte{txscript.OP_MAX}, shouldPass: false}, // By this point we know a number of operations appear to be working // correctly. we can use them to test the other number pushing // operations - {script: []byte{btcscript.OP_TRUE, btcscript.OP_1ADD, btcscript.OP_2, - btcscript.OP_EQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_2, btcscript.OP_1ADD, btcscript.OP_3, - btcscript.OP_EQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_3, btcscript.OP_1ADD, btcscript.OP_4, - btcscript.OP_EQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_4, btcscript.OP_1ADD, btcscript.OP_5, - btcscript.OP_EQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_5, btcscript.OP_1ADD, btcscript.OP_6, - btcscript.OP_EQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_6, btcscript.OP_1ADD, btcscript.OP_7, - btcscript.OP_EQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_7, btcscript.OP_1ADD, btcscript.OP_8, - btcscript.OP_EQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_8, btcscript.OP_1ADD, btcscript.OP_9, - btcscript.OP_EQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_9, btcscript.OP_1ADD, btcscript.OP_10, - btcscript.OP_EQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_10, btcscript.OP_1ADD, btcscript.OP_11, - btcscript.OP_EQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_11, btcscript.OP_1ADD, btcscript.OP_12, - btcscript.OP_EQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_12, btcscript.OP_1ADD, btcscript.OP_13, - btcscript.OP_EQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_13, btcscript.OP_1ADD, btcscript.OP_14, - btcscript.OP_EQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_14, btcscript.OP_1ADD, btcscript.OP_15, - btcscript.OP_EQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_15, btcscript.OP_1ADD, btcscript.OP_16, - btcscript.OP_EQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_1ADD, txscript.OP_2, + txscript.OP_EQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_2, txscript.OP_1ADD, txscript.OP_3, + txscript.OP_EQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_3, txscript.OP_1ADD, txscript.OP_4, + txscript.OP_EQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_4, txscript.OP_1ADD, txscript.OP_5, + txscript.OP_EQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_5, txscript.OP_1ADD, txscript.OP_6, + txscript.OP_EQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_6, txscript.OP_1ADD, txscript.OP_7, + txscript.OP_EQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_7, txscript.OP_1ADD, txscript.OP_8, + txscript.OP_EQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_8, txscript.OP_1ADD, txscript.OP_9, + txscript.OP_EQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_9, txscript.OP_1ADD, txscript.OP_10, + txscript.OP_EQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_10, txscript.OP_1ADD, txscript.OP_11, + txscript.OP_EQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_11, txscript.OP_1ADD, txscript.OP_12, + txscript.OP_EQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_12, txscript.OP_1ADD, txscript.OP_13, + txscript.OP_EQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_13, txscript.OP_1ADD, txscript.OP_14, + txscript.OP_EQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_14, txscript.OP_1ADD, txscript.OP_15, + txscript.OP_EQUAL}, shouldPass: true}, + {script: []byte{txscript.OP_15, txscript.OP_1ADD, txscript.OP_16, + txscript.OP_EQUAL}, shouldPass: true}, // Test OP_WITHIN x, min, max // 0 <= 1 < 2 - {script: []byte{btcscript.OP_TRUE, btcscript.OP_FALSE, btcscript.OP_2, - btcscript.OP_WITHIN}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_FALSE, txscript.OP_2, + txscript.OP_WITHIN}, shouldPass: true}, // 1 <= 0 < 2 FAIL - {script: []byte{btcscript.OP_FALSE, btcscript.OP_TRUE, btcscript.OP_2, - btcscript.OP_WITHIN}, shouldPass: false}, + {script: []byte{txscript.OP_FALSE, txscript.OP_TRUE, txscript.OP_2, + txscript.OP_WITHIN}, shouldPass: false}, // 1 <= 1 < 2 - {script: []byte{btcscript.OP_TRUE, btcscript.OP_TRUE, btcscript.OP_2, - btcscript.OP_WITHIN}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_TRUE, txscript.OP_2, + txscript.OP_WITHIN}, shouldPass: true}, // 1 <= 2 < 2 FAIL - {script: []byte{btcscript.OP_2, btcscript.OP_TRUE, btcscript.OP_2, - btcscript.OP_WITHIN}, shouldPass: false}, + {script: []byte{txscript.OP_2, txscript.OP_TRUE, txscript.OP_2, + txscript.OP_WITHIN}, shouldPass: false}, // only two arguments - {script: []byte{btcscript.OP_TRUE, btcscript.OP_FALSE, - btcscript.OP_WITHIN}, shouldPass: false}, + {script: []byte{txscript.OP_TRUE, txscript.OP_FALSE, + txscript.OP_WITHIN}, shouldPass: false}, // only one argument - {script: []byte{btcscript.OP_TRUE, btcscript.OP_WITHIN}, + {script: []byte{txscript.OP_TRUE, txscript.OP_WITHIN}, shouldPass: false}, // no arguments - {script: []byte{btcscript.OP_WITHIN}, shouldPass: false}, + {script: []byte{txscript.OP_WITHIN}, shouldPass: false}, // OP_BOOLAND // 1 && 1 == 1 - {script: []byte{btcscript.OP_TRUE, btcscript.OP_TRUE, - btcscript.OP_BOOLAND}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_TRUE, + txscript.OP_BOOLAND}, shouldPass: true}, // 1 && 0 == 0 - {script: []byte{btcscript.OP_TRUE, btcscript.OP_FALSE, - btcscript.OP_BOOLAND}, shouldPass: false}, + {script: []byte{txscript.OP_TRUE, txscript.OP_FALSE, + txscript.OP_BOOLAND}, shouldPass: false}, // 0 && 1 == 0 - {script: []byte{btcscript.OP_FALSE, btcscript.OP_TRUE, - btcscript.OP_BOOLAND}, shouldPass: false}, + {script: []byte{txscript.OP_FALSE, txscript.OP_TRUE, + txscript.OP_BOOLAND}, shouldPass: false}, // 0 && 0 == 0 - {script: []byte{btcscript.OP_FALSE, btcscript.OP_FALSE, - btcscript.OP_BOOLAND}, shouldPass: false}, + {script: []byte{txscript.OP_FALSE, txscript.OP_FALSE, + txscript.OP_BOOLAND}, shouldPass: false}, // 0 && - boom - {script: []byte{btcscript.OP_TRUE, btcscript.OP_BOOLAND}, + {script: []byte{txscript.OP_TRUE, txscript.OP_BOOLAND}, shouldPass: false}, // && - boom - {script: []byte{btcscript.OP_BOOLAND}, shouldPass: false}, + {script: []byte{txscript.OP_BOOLAND}, shouldPass: false}, // OP_BOOLOR // 1 || 1 == 1 - {script: []byte{btcscript.OP_TRUE, btcscript.OP_TRUE, - btcscript.OP_BOOLOR}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_TRUE, + txscript.OP_BOOLOR}, shouldPass: true}, // 1 || 0 == 1 - {script: []byte{btcscript.OP_TRUE, btcscript.OP_FALSE, - btcscript.OP_BOOLOR}, shouldPass: true}, + {script: []byte{txscript.OP_TRUE, txscript.OP_FALSE, + txscript.OP_BOOLOR}, shouldPass: true}, // 0 || 1 == 1 - {script: []byte{btcscript.OP_FALSE, btcscript.OP_TRUE, - btcscript.OP_BOOLOR}, shouldPass: true}, + {script: []byte{txscript.OP_FALSE, txscript.OP_TRUE, + txscript.OP_BOOLOR}, shouldPass: true}, // 0 || 0 == 0 - {script: []byte{btcscript.OP_FALSE, btcscript.OP_FALSE, - btcscript.OP_BOOLOR}, shouldPass: false}, + {script: []byte{txscript.OP_FALSE, txscript.OP_FALSE, + txscript.OP_BOOLOR}, shouldPass: false}, // 0 && - boom - {script: []byte{btcscript.OP_TRUE, btcscript.OP_BOOLOR}, + {script: []byte{txscript.OP_TRUE, txscript.OP_BOOLOR}, shouldPass: false}, // && - boom - {script: []byte{btcscript.OP_BOOLOR}, shouldPass: false}, + {script: []byte{txscript.OP_BOOLOR}, shouldPass: false}, // OP_0NOTEQUAL // 1 with input != 0 XXX check output is actually 1. - {script: []byte{btcscript.OP_TRUE, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_TRUE, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_2, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_2, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_3, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_3, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_4, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_4, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_5, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_5, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_6, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_6, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_7, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_7, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_8, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_8, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_9, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_9, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_10, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_10, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_11, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_11, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_12, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_12, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_13, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_13, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_14, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_14, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_15, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_15, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_16, btcscript.OP_0NOTEQUAL}, + {script: []byte{txscript.OP_16, txscript.OP_0NOTEQUAL}, shouldPass: true}, - {script: []byte{btcscript.OP_FALSE, btcscript.OP_0NOTEQUAL}, shouldPass: false}, + {script: []byte{txscript.OP_FALSE, txscript.OP_0NOTEQUAL}, shouldPass: false}, // No arguments also blows up - {script: []byte{btcscript.OP_0NOTEQUAL}, shouldPass: false}, + {script: []byte{txscript.OP_0NOTEQUAL}, shouldPass: false}, // OP_NOT: 1 i input is 0, else 0 - {script: []byte{btcscript.OP_TRUE, btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_2, btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_3, btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_4, btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_5, btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_6, btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_7, btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_8, btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_9, btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_10, btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_11, btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_12, btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_13, btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_14, btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_15, btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_16, btcscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_TRUE, txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_2, txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_3, txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_4, txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_5, txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_6, txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_7, txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_8, txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_9, txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_10, txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_11, txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_12, txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_13, txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_14, txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_15, txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_16, txscript.OP_NOT}, shouldPass: false}, // check negative numbers too - {script: []byte{btcscript.OP_TRUE, btcscript.OP_NEGATE, - btcscript.OP_NOT}, shouldPass: false}, - {script: []byte{btcscript.OP_FALSE, btcscript.OP_NOT}, + {script: []byte{txscript.OP_TRUE, txscript.OP_NEGATE, + txscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_FALSE, txscript.OP_NOT}, shouldPass: true}, // No arguments also blows up - {script: []byte{btcscript.OP_NOT}, shouldPass: false}, + {script: []byte{txscript.OP_NOT}, shouldPass: false}, // Conditional Execution - {script: []byte{btcscript.OP_0, btcscript.OP_IF, btcscript.OP_0, btcscript.OP_ELSE, btcscript.OP_2, btcscript.OP_ENDIF}, shouldPass: true}, - {script: []byte{btcscript.OP_1, btcscript.OP_IF, btcscript.OP_0, btcscript.OP_ELSE, btcscript.OP_2, btcscript.OP_ENDIF}, shouldPass: false}, - {script: []byte{btcscript.OP_1, btcscript.OP_NOTIF, btcscript.OP_0, btcscript.OP_ELSE, btcscript.OP_2, btcscript.OP_ENDIF}, shouldPass: true}, - {script: []byte{btcscript.OP_0, btcscript.OP_NOTIF, btcscript.OP_0, btcscript.OP_ELSE, btcscript.OP_2, btcscript.OP_ENDIF}, shouldPass: false}, - {script: []byte{btcscript.OP_0, btcscript.OP_IF, btcscript.OP_0, btcscript.OP_ELSE, btcscript.OP_2}, shouldFail: btcscript.ErrStackMissingEndif}, - {script: []byte{btcscript.OP_1, btcscript.OP_NOTIF, btcscript.OP_0, btcscript.OP_ELSE, btcscript.OP_2}, shouldFail: btcscript.ErrStackMissingEndif}, - {script: []byte{btcscript.OP_1, btcscript.OP_1, btcscript.OP_IF, btcscript.OP_IF, btcscript.OP_1, btcscript.OP_ELSE, btcscript.OP_0, btcscript.OP_ENDIF, btcscript.OP_ENDIF}, shouldPass: true}, - {script: []byte{btcscript.OP_1, btcscript.OP_IF, btcscript.OP_IF, btcscript.OP_1, btcscript.OP_ELSE, btcscript.OP_0, btcscript.OP_ENDIF, btcscript.OP_ENDIF}, shouldFail: btcscript.ErrStackUnderflow}, - {script: []byte{btcscript.OP_0, btcscript.OP_IF, btcscript.OP_IF, btcscript.OP_0, btcscript.OP_ELSE, btcscript.OP_0, btcscript.OP_ENDIF, btcscript.OP_ELSE, btcscript.OP_1, btcscript.OP_ENDIF}, shouldPass: true}, - {script: []byte{btcscript.OP_0, btcscript.OP_IF, btcscript.OP_NOTIF, btcscript.OP_0, btcscript.OP_ELSE, btcscript.OP_0, btcscript.OP_ENDIF, btcscript.OP_ELSE, btcscript.OP_1, btcscript.OP_ENDIF}, shouldPass: true}, - {script: []byte{btcscript.OP_NOTIF, btcscript.OP_0, btcscript.OP_ENDIF}, shouldFail: btcscript.ErrStackUnderflow}, - {script: []byte{btcscript.OP_ELSE, btcscript.OP_0, btcscript.OP_ENDIF}, shouldFail: btcscript.ErrStackNoIf}, - {script: []byte{btcscript.OP_ENDIF}, shouldFail: btcscript.ErrStackNoIf}, + {script: []byte{txscript.OP_0, txscript.OP_IF, txscript.OP_0, txscript.OP_ELSE, txscript.OP_2, txscript.OP_ENDIF}, shouldPass: true}, + {script: []byte{txscript.OP_1, txscript.OP_IF, txscript.OP_0, txscript.OP_ELSE, txscript.OP_2, txscript.OP_ENDIF}, shouldPass: false}, + {script: []byte{txscript.OP_1, txscript.OP_NOTIF, txscript.OP_0, txscript.OP_ELSE, txscript.OP_2, txscript.OP_ENDIF}, shouldPass: true}, + {script: []byte{txscript.OP_0, txscript.OP_NOTIF, txscript.OP_0, txscript.OP_ELSE, txscript.OP_2, txscript.OP_ENDIF}, shouldPass: false}, + {script: []byte{txscript.OP_0, txscript.OP_IF, txscript.OP_0, txscript.OP_ELSE, txscript.OP_2}, shouldFail: txscript.ErrStackMissingEndif}, + {script: []byte{txscript.OP_1, txscript.OP_NOTIF, txscript.OP_0, txscript.OP_ELSE, txscript.OP_2}, shouldFail: txscript.ErrStackMissingEndif}, + {script: []byte{txscript.OP_1, txscript.OP_1, txscript.OP_IF, txscript.OP_IF, txscript.OP_1, txscript.OP_ELSE, txscript.OP_0, txscript.OP_ENDIF, txscript.OP_ENDIF}, shouldPass: true}, + {script: []byte{txscript.OP_1, txscript.OP_IF, txscript.OP_IF, txscript.OP_1, txscript.OP_ELSE, txscript.OP_0, txscript.OP_ENDIF, txscript.OP_ENDIF}, shouldFail: txscript.ErrStackUnderflow}, + {script: []byte{txscript.OP_0, txscript.OP_IF, txscript.OP_IF, txscript.OP_0, txscript.OP_ELSE, txscript.OP_0, txscript.OP_ENDIF, txscript.OP_ELSE, txscript.OP_1, txscript.OP_ENDIF}, shouldPass: true}, + {script: []byte{txscript.OP_0, txscript.OP_IF, txscript.OP_NOTIF, txscript.OP_0, txscript.OP_ELSE, txscript.OP_0, txscript.OP_ENDIF, txscript.OP_ELSE, txscript.OP_1, txscript.OP_ENDIF}, shouldPass: true}, + {script: []byte{txscript.OP_NOTIF, txscript.OP_0, txscript.OP_ENDIF}, shouldFail: txscript.ErrStackUnderflow}, + {script: []byte{txscript.OP_ELSE, txscript.OP_0, txscript.OP_ENDIF}, shouldFail: txscript.ErrStackNoIf}, + {script: []byte{txscript.OP_ENDIF}, shouldFail: txscript.ErrStackNoIf}, /* up here because error from sig parsing is undefined. */ - {script: []byte{btcscript.OP_1, btcscript.OP_1, btcscript.OP_DATA_65, + {script: []byte{txscript.OP_1, txscript.OP_1, txscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, 0x99, 0xa2, 0xf7, 0x15, 0x9b, 0x22, 0x25, 0xf3, 0x74, 0xcd, 0x37, 0x8d, 0x71, 0x30, 0x2f, @@ -382,10 +382,10 @@ func TestScripts(t *testing.T) { 0xa7, 0xdf, 0x5f, 0x14, 0x2c, 0x21, 0xc1, 0xb7, 0x30, 0x3b, 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, - btcscript.OP_1, btcscript.OP_CHECKMULTISIG}, + txscript.OP_1, txscript.OP_CHECKMULTISIG}, canonical: false, shouldPass: false}, - {script: []byte{btcscript.OP_1, btcscript.OP_1, btcscript.OP_DATA_65, + {script: []byte{txscript.OP_1, txscript.OP_1, txscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, 0x99, 0xa2, 0xf7, 0x15, 0x9b, 0x22, 0x25, 0xf3, 0x74, 0xcd, 0x37, 0x8d, 0x71, 0x30, 0x2f, @@ -393,11 +393,11 @@ func TestScripts(t *testing.T) { 0xa7, 0xdf, 0x5f, 0x14, 0x2c, 0x21, 0xc1, 0xb7, 0x30, 0x3b, 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, - btcscript.OP_1, btcscript.OP_CHECKMULTISIG}, + txscript.OP_1, txscript.OP_CHECKMULTISIG}, canonical: true, shouldPass: false}, /* up here because no defined error case. */ - {script: []byte{btcscript.OP_1, btcscript.OP_1, btcscript.OP_DATA_65, + {script: []byte{txscript.OP_1, txscript.OP_1, txscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, 0x99, 0xa2, 0xf7, 0x15, 0x9b, 0x22, 0x25, 0xf3, 0x74, 0xcd, 0x37, 0x8d, 0x71, 0x30, 0x2f, @@ -405,7 +405,7 @@ func TestScripts(t *testing.T) { 0xa7, 0xdf, 0x5f, 0x14, 0x2c, 0x21, 0xc1, 0xb7, 0x30, 0x3b, 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, - btcscript.OP_1, btcscript.OP_CHECKMULTISIGVERIFY}, + txscript.OP_1, txscript.OP_CHECKMULTISIGVERIFY}, shouldPass: false}, // Invalid Opcodes @@ -488,7 +488,7 @@ func TestScripts(t *testing.T) { Hash: btcwire.ShaHash{}, Index: 0xffffffff, }, - SignatureScript: []byte{btcscript.OP_NOP}, + SignatureScript: []byte{txscript.OP_NOP}, Sequence: 0xffffffff, }, }, @@ -503,13 +503,13 @@ func TestScripts(t *testing.T) { for i, test := range tests { // Parse and execute the test script. - var flags btcscript.ScriptFlags + var flags txscript.ScriptFlags if test.canonical { - flags = btcscript.ScriptCanonicalSignatures + flags = txscript.ScriptCanonicalSignatures } mockTx.TxOut[0].PkScript = test.script sigScript := mockTx.TxIn[0].SignatureScript - engine, err := btcscript.NewScript(sigScript, test.script, 0, + engine, err := txscript.NewScript(sigScript, test.script, 0, mockTx, flags) if err == nil { err = engine.Execute() @@ -557,317 +557,317 @@ var detailedTests = []detailedTest{ { name: "noop", before: [][]byte{{1}, {2}, {3}, {4}, {5}}, - script: []byte{btcscript.OP_NOP}, + script: []byte{txscript.OP_NOP}, after: [][]byte{{1}, {2}, {3}, {4}, {5}}, disassembly: "OP_NOP", }, { name: "dup", before: [][]byte{{1}}, - script: []byte{btcscript.OP_DUP}, + script: []byte{txscript.OP_DUP}, after: [][]byte{{1}, {1}}, disassembly: "OP_DUP", }, { name: "dup2", before: [][]byte{{1}, {2}}, - script: []byte{btcscript.OP_2DUP}, + script: []byte{txscript.OP_2DUP}, after: [][]byte{{1}, {2}, {1}, {2}}, disassembly: "OP_2DUP", }, { name: "dup3", before: [][]byte{{1}, {2}, {3}}, - script: []byte{btcscript.OP_3DUP}, + script: []byte{txscript.OP_3DUP}, after: [][]byte{{1}, {2}, {3}, {1}, {2}, {3}}, disassembly: "OP_3DUP", }, { name: "dup too much", before: [][]byte{}, - script: []byte{btcscript.OP_DUP}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_DUP}, + expectedReturn: txscript.ErrStackUnderflow, after: [][]byte{}, disassembly: "OP_DUP", }, { name: "2dup too much", before: [][]byte{{1}}, - script: []byte{btcscript.OP_2DUP}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_2DUP}, + expectedReturn: txscript.ErrStackUnderflow, after: [][]byte{}, disassembly: "OP_2DUP", }, { name: "2dup way too much", before: [][]byte{}, - script: []byte{btcscript.OP_2DUP}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_2DUP}, + expectedReturn: txscript.ErrStackUnderflow, after: [][]byte{}, disassembly: "OP_2DUP", }, { name: "3dup too much", before: [][]byte{{1}, {2}}, - script: []byte{btcscript.OP_3DUP}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_3DUP}, + expectedReturn: txscript.ErrStackUnderflow, after: [][]byte{}, disassembly: "OP_3DUP", }, { name: "3dup kinda too much", before: [][]byte{{1}}, - script: []byte{btcscript.OP_3DUP}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_3DUP}, + expectedReturn: txscript.ErrStackUnderflow, after: [][]byte{}, disassembly: "OP_3DUP", }, { name: "3dup way too much", before: [][]byte{}, - script: []byte{btcscript.OP_3DUP}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_3DUP}, + expectedReturn: txscript.ErrStackUnderflow, after: [][]byte{}, disassembly: "OP_3DUP", }, { name: "Nip", before: [][]byte{{1}, {2}, {3}}, - script: []byte{btcscript.OP_NIP}, + script: []byte{txscript.OP_NIP}, after: [][]byte{{1}, {3}}, disassembly: "OP_NIP", }, { name: "Nip too much", before: [][]byte{{1}}, - script: []byte{btcscript.OP_NIP}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_NIP}, + expectedReturn: txscript.ErrStackUnderflow, after: [][]byte{{2}, {3}}, disassembly: "OP_NIP", }, { name: "keep on tucking", before: [][]byte{{1}, {2}, {3}}, - script: []byte{btcscript.OP_TUCK}, + script: []byte{txscript.OP_TUCK}, after: [][]byte{{1}, {3}, {2}, {3}}, disassembly: "OP_TUCK", }, { name: "a little tucked up", before: [][]byte{{1}}, // too few arguments for tuck - script: []byte{btcscript.OP_TUCK}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_TUCK}, + expectedReturn: txscript.ErrStackUnderflow, after: [][]byte{}, disassembly: "OP_TUCK", }, { name: "all tucked up", before: [][]byte{}, // too few arguments for tuck - script: []byte{btcscript.OP_TUCK}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_TUCK}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_TUCK", }, { name: "drop 1", before: [][]byte{{1}, {2}, {3}, {4}}, - script: []byte{btcscript.OP_DROP}, + script: []byte{txscript.OP_DROP}, after: [][]byte{{1}, {2}, {3}}, disassembly: "OP_DROP", }, { name: "drop 2", before: [][]byte{{1}, {2}, {3}, {4}}, - script: []byte{btcscript.OP_2DROP}, + script: []byte{txscript.OP_2DROP}, after: [][]byte{{1}, {2}}, disassembly: "OP_2DROP", }, { name: "drop too much", before: [][]byte{}, - script: []byte{btcscript.OP_DROP}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_DROP}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_DROP", }, { name: "2drop too much", before: [][]byte{{1}}, - script: []byte{btcscript.OP_2DROP}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_2DROP}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_2DROP", }, { name: "2drop far too much", before: [][]byte{}, - script: []byte{btcscript.OP_2DROP}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_2DROP}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_2DROP", }, { name: "Rot1", before: [][]byte{{1}, {2}, {3}, {4}}, - script: []byte{btcscript.OP_ROT}, + script: []byte{txscript.OP_ROT}, after: [][]byte{{1}, {3}, {4}, {2}}, disassembly: "OP_ROT", }, { name: "Rot2", before: [][]byte{{1}, {2}, {3}, {4}, {5}, {6}}, - script: []byte{btcscript.OP_2ROT}, + script: []byte{txscript.OP_2ROT}, after: [][]byte{{3}, {4}, {5}, {6}, {1}, {2}}, disassembly: "OP_2ROT", }, { name: "Rot too little", before: [][]byte{{1}, {2}}, - script: []byte{btcscript.OP_ROT}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_ROT}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_ROT", }, { name: "Swap1", before: [][]byte{{1}, {2}, {3}, {4}}, - script: []byte{btcscript.OP_SWAP}, + script: []byte{txscript.OP_SWAP}, after: [][]byte{{1}, {2}, {4}, {3}}, disassembly: "OP_SWAP", }, { name: "Swap2", before: [][]byte{{1}, {2}, {3}, {4}}, - script: []byte{btcscript.OP_2SWAP}, + script: []byte{txscript.OP_2SWAP}, after: [][]byte{{3}, {4}, {1}, {2}}, disassembly: "OP_2SWAP", }, { name: "Swap too little", before: [][]byte{{1}}, - script: []byte{btcscript.OP_SWAP}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_SWAP}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_SWAP", }, { name: "Over1", before: [][]byte{{1}, {2}, {3}, {4}}, - script: []byte{btcscript.OP_OVER}, + script: []byte{txscript.OP_OVER}, after: [][]byte{{1}, {2}, {3}, {4}, {3}}, disassembly: "OP_OVER", }, { name: "Over2", before: [][]byte{{1}, {2}, {3}, {4}}, - script: []byte{btcscript.OP_2OVER}, + script: []byte{txscript.OP_2OVER}, after: [][]byte{{1}, {2}, {3}, {4}, {1}, {2}}, disassembly: "OP_2OVER", }, { name: "Over too little", before: [][]byte{{1}}, - script: []byte{btcscript.OP_OVER}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_OVER}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_OVER", }, { name: "Pick1", before: [][]byte{{1}, {2}, {3}, {4}, {1}}, - script: []byte{btcscript.OP_PICK}, + script: []byte{txscript.OP_PICK}, after: [][]byte{{1}, {2}, {3}, {4}, {3}}, disassembly: "OP_PICK", }, { name: "Pick2", before: [][]byte{{1}, {2}, {3}, {4}, {2}}, - script: []byte{btcscript.OP_PICK}, + script: []byte{txscript.OP_PICK}, after: [][]byte{{1}, {2}, {3}, {4}, {2}}, disassembly: "OP_PICK", }, { name: "Pick too little", before: [][]byte{{1}, {1}}, - script: []byte{btcscript.OP_PICK}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_PICK}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_PICK", }, { name: "Pick nothing", before: [][]byte{{}}, - script: []byte{btcscript.OP_PICK}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_PICK}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_PICK", }, { name: "Pick no args", before: [][]byte{}, - script: []byte{btcscript.OP_PICK}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_PICK}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_PICK", }, { name: "Pick stupid numbers", before: [][]byte{{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}, - script: []byte{btcscript.OP_PICK}, - expectedReturn: btcscript.ErrStackNumberTooBig, + script: []byte{txscript.OP_PICK}, + expectedReturn: txscript.ErrStackNumberTooBig, disassembly: "OP_PICK", }, { name: "Roll1", before: [][]byte{{1}, {2}, {3}, {4}, {1}}, - script: []byte{btcscript.OP_ROLL}, + script: []byte{txscript.OP_ROLL}, after: [][]byte{{1}, {2}, {4}, {3}}, disassembly: "OP_ROLL", }, { name: "Roll2", before: [][]byte{{1}, {2}, {3}, {4}, {2}}, - script: []byte{btcscript.OP_ROLL}, + script: []byte{txscript.OP_ROLL}, after: [][]byte{{1}, {3}, {4}, {2}}, disassembly: "OP_ROLL", }, { name: "Roll too little", before: [][]byte{{1}, {1}}, - script: []byte{btcscript.OP_ROLL}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_ROLL}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_ROLL", }, { name: "Roll nothing ", before: [][]byte{{1}}, - script: []byte{btcscript.OP_ROLL}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_ROLL}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_ROLL", }, { name: "Roll no args ", before: [][]byte{}, - script: []byte{btcscript.OP_ROLL}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_ROLL}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_ROLL", }, { name: "Roll stupid numbers", before: [][]byte{{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}, - script: []byte{btcscript.OP_ROLL}, - expectedReturn: btcscript.ErrStackNumberTooBig, + script: []byte{txscript.OP_ROLL}, + expectedReturn: txscript.ErrStackNumberTooBig, disassembly: "OP_ROLL", }, { name: "ifdup (positive)", before: [][]byte{{1}}, - script: []byte{btcscript.OP_IFDUP}, + script: []byte{txscript.OP_IFDUP}, after: [][]byte{{1}, {1}}, disassembly: "OP_IFDUP", }, { name: "ifdup (negative)", before: [][]byte{{0}}, - script: []byte{btcscript.OP_IFDUP}, + script: []byte{txscript.OP_IFDUP}, after: [][]byte{{0}}, disassembly: "OP_IFDUP", }, { name: "ifdup (empty)", before: [][]byte{}, - script: []byte{btcscript.OP_IFDUP}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_IFDUP}, + expectedReturn: txscript.ErrStackUnderflow, after: [][]byte{{0}}, disassembly: "OP_IFDUP", }, @@ -876,7 +876,7 @@ var detailedTests = []detailedTest{ name: "toaltstack", before: [][]byte{{1}}, altbefore: [][]byte{}, - script: []byte{btcscript.OP_TOALTSTACK}, + script: []byte{txscript.OP_TOALTSTACK}, after: [][]byte{}, altafter: [][]byte{}, disassembly: "OP_TOALTSTACK", @@ -885,15 +885,15 @@ var detailedTests = []detailedTest{ name: "toaltastack (empty)", before: [][]byte{}, altbefore: [][]byte{}, - script: []byte{btcscript.OP_TOALTSTACK}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_TOALTSTACK}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_TOALTSTACK", }, { name: "fromaltastack", before: [][]byte{}, altbefore: [][]byte{{1}}, - script: []byte{btcscript.OP_FROMALTSTACK}, + script: []byte{txscript.OP_FROMALTSTACK}, after: [][]byte{{1}}, altafter: [][]byte{}, disassembly: "OP_FROMALTSTACK", @@ -902,28 +902,28 @@ var detailedTests = []detailedTest{ name: "fromaltastack (empty)", before: [][]byte{}, altbefore: [][]byte{}, - script: []byte{btcscript.OP_FROMALTSTACK}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_FROMALTSTACK}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_FROMALTSTACK", }, { name: "op_size (1)", before: [][]byte{{1}}, - script: []byte{btcscript.OP_SIZE}, + script: []byte{txscript.OP_SIZE}, after: [][]byte{{1}, {1}}, disassembly: "OP_SIZE", }, { name: "op_size (5)", before: [][]byte{{1, 2, 3, 4, 5}}, - script: []byte{btcscript.OP_SIZE}, + script: []byte{txscript.OP_SIZE}, after: [][]byte{{1, 2, 3, 4, 5}, {5}}, disassembly: "OP_SIZE", }, { name: "op_size (0)", before: [][]byte{{}}, - script: []byte{btcscript.OP_SIZE}, + script: []byte{txscript.OP_SIZE}, // pushInt(0) actually gives an empty array, still counts as 0 after: [][]byte{{}, {}}, disassembly: "OP_SIZE", @@ -931,178 +931,178 @@ var detailedTests = []detailedTest{ { name: "op_size (invalid)", before: [][]byte{}, - script: []byte{btcscript.OP_SIZE}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_SIZE}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_SIZE", }, { name: "OP_EQUAL (valid)", before: [][]byte{{1, 2, 3, 4}, {1, 2, 3, 4}}, - script: []byte{btcscript.OP_EQUAL}, + script: []byte{txscript.OP_EQUAL}, after: [][]byte{{1}}, disassembly: "OP_EQUAL", }, { name: "OP_EQUAL (invalid)", before: [][]byte{{1, 2, 3, 4}, {1, 2, 3, 3}}, - script: []byte{btcscript.OP_EQUAL}, + script: []byte{txscript.OP_EQUAL}, after: [][]byte{{0}}, disassembly: "OP_EQUAL", }, { name: "OP_EQUAL (one arg)", before: [][]byte{{1, 2, 3, 4}}, - script: []byte{btcscript.OP_EQUAL}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_EQUAL}, + expectedReturn: txscript.ErrStackUnderflow, after: [][]byte{{0}}, disassembly: "OP_EQUAL", }, { name: "OP_EQUAL (no arg)", before: [][]byte{}, - script: []byte{btcscript.OP_EQUAL}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_EQUAL}, + expectedReturn: txscript.ErrStackUnderflow, after: [][]byte{{0}}, disassembly: "OP_EQUAL", }, { name: "OP_EQUALVERIFY (valid)", before: [][]byte{{1, 2, 3, 4}, {1, 2, 3, 4}}, - script: []byte{btcscript.OP_EQUALVERIFY}, + script: []byte{txscript.OP_EQUALVERIFY}, after: [][]byte{}, disassembly: "OP_EQUALVERIFY", }, { name: "OP_EQUALVERIFY (invalid)", before: [][]byte{{1, 2, 3, 4}, {1, 2, 3, 3}}, - script: []byte{btcscript.OP_EQUALVERIFY}, - expectedReturn: btcscript.ErrStackVerifyFailed, + script: []byte{txscript.OP_EQUALVERIFY}, + expectedReturn: txscript.ErrStackVerifyFailed, after: [][]byte{}, disassembly: "OP_EQUALVERIFY", }, { name: "OP_EQUALVERIFY (one arg)", before: [][]byte{{1, 2, 3, 4}}, - script: []byte{btcscript.OP_EQUALVERIFY}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_EQUALVERIFY}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_EQUALVERIFY", }, { name: "OP_EQUALVERIFY (no arg)", before: [][]byte{}, - script: []byte{btcscript.OP_EQUALVERIFY}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_EQUALVERIFY}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_EQUALVERIFY", }, { name: "OP_1NEGATE", before: [][]byte{}, - script: []byte{btcscript.OP_1NEGATE}, + script: []byte{txscript.OP_1NEGATE}, after: [][]byte{{0x81}}, disassembly: "-1", }, { name: "add one to minus one", before: [][]byte{}, - script: []byte{btcscript.OP_1NEGATE, btcscript.OP_1ADD}, + script: []byte{txscript.OP_1NEGATE, txscript.OP_1ADD}, after: [][]byte{{}}, // 0 disassembly: "-1 OP_1ADD", }, { name: "OP_ABS (positive)", before: [][]byte{{1}}, - script: []byte{btcscript.OP_ABS}, + script: []byte{txscript.OP_ABS}, after: [][]byte{{1}}, disassembly: "OP_ABS", }, { name: "OP_ABS (negative)", before: [][]byte{{0x81}}, - script: []byte{btcscript.OP_ABS}, + script: []byte{txscript.OP_ABS}, after: [][]byte{{1}}, disassembly: "OP_ABS", }, { name: "OP_ABS (empty)", before: [][]byte{}, - script: []byte{btcscript.OP_ABS}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_ABS}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_ABS", }, { name: "op_data_1", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_1, 1}, + script: []byte{txscript.OP_DATA_1, 1}, after: [][]byte{{1}}, disassembly: "01", }, { name: "op_data_2", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_2, 1, 2}, + script: []byte{txscript.OP_DATA_2, 1, 2}, after: [][]byte{{1, 2}}, disassembly: "0102", }, { name: "op_data_3", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_3, 1, 2, 3}, + script: []byte{txscript.OP_DATA_3, 1, 2, 3}, after: [][]byte{{1, 2, 3}}, disassembly: "010203", }, { name: "op_data_4", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_4, 1, 2, 3, 4}, + script: []byte{txscript.OP_DATA_4, 1, 2, 3, 4}, after: [][]byte{{1, 2, 3, 4}}, disassembly: "01020304", }, { name: "op_data_5", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_5, 1, 2, 3, 4, 5}, + script: []byte{txscript.OP_DATA_5, 1, 2, 3, 4, 5}, after: [][]byte{{1, 2, 3, 4, 5}}, disassembly: "0102030405", }, { name: "op_data_6", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_6, 1, 2, 3, 4, 5, 6}, + script: []byte{txscript.OP_DATA_6, 1, 2, 3, 4, 5, 6}, after: [][]byte{{1, 2, 3, 4, 5, 6}}, disassembly: "010203040506", }, { name: "op_data_7", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_7, 1, 2, 3, 4, 5, 6, 7}, + script: []byte{txscript.OP_DATA_7, 1, 2, 3, 4, 5, 6, 7}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7}}, disassembly: "01020304050607", }, { name: "op_data_8", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_8, 1, 2, 3, 4, 5, 6, 7, 8}, + script: []byte{txscript.OP_DATA_8, 1, 2, 3, 4, 5, 6, 7, 8}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8}}, disassembly: "0102030405060708", }, { name: "op_data_9", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_9, 1, 2, 3, 4, 5, 6, 7, 8, 9}, + script: []byte{txscript.OP_DATA_9, 1, 2, 3, 4, 5, 6, 7, 8, 9}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9}}, disassembly: "010203040506070809", }, { name: "op_data_10", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, + script: []byte{txscript.OP_DATA_10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}, disassembly: "0102030405060708090a", }, { name: "op_data_11", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_11, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}}, disassembly: "0102030405060708090a0b", @@ -1110,7 +1110,7 @@ var detailedTests = []detailedTest{ { name: "op_data_12", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_12, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}}, disassembly: "0102030405060708090a0b0c", @@ -1118,7 +1118,7 @@ var detailedTests = []detailedTest{ { name: "op_data_13", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_13, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}, disassembly: "0102030405060708090a0b0c0d", @@ -1126,7 +1126,7 @@ var detailedTests = []detailedTest{ { name: "op_data_14", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_14, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}}, disassembly: "0102030405060708090a0b0c0d0e", @@ -1134,7 +1134,7 @@ var detailedTests = []detailedTest{ { name: "op_data_15", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_15, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}}, @@ -1143,7 +1143,7 @@ var detailedTests = []detailedTest{ { name: "op_data_16", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_16, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}}, @@ -1152,7 +1152,7 @@ var detailedTests = []detailedTest{ { name: "op_data_17", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_17, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_17, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}}, @@ -1161,7 +1161,7 @@ var detailedTests = []detailedTest{ { name: "op_data_18", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_18, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_18, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18}}, @@ -1170,7 +1170,7 @@ var detailedTests = []detailedTest{ { name: "op_data_19", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_19, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_19, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}}, @@ -1179,7 +1179,7 @@ var detailedTests = []detailedTest{ { name: "op_data_20", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_20, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}}, @@ -1188,7 +1188,7 @@ var detailedTests = []detailedTest{ { name: "op_data_21", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_21, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_21, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21}}, @@ -1197,7 +1197,7 @@ var detailedTests = []detailedTest{ { name: "op_data_22", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_22, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_22, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, @@ -1207,7 +1207,7 @@ var detailedTests = []detailedTest{ { name: "op_data_23", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_23, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_23, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, @@ -1217,7 +1217,7 @@ var detailedTests = []detailedTest{ { name: "op_data_24", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_24, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_24, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, @@ -1227,7 +1227,7 @@ var detailedTests = []detailedTest{ { name: "op_data_25", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_25, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_25, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, @@ -1237,7 +1237,7 @@ var detailedTests = []detailedTest{ { name: "op_data_26", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_26, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_26, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, @@ -1247,7 +1247,7 @@ var detailedTests = []detailedTest{ { name: "op_data_27", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_27, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_27, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, @@ -1258,7 +1258,7 @@ var detailedTests = []detailedTest{ { name: "op_data_28", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_28, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_28, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, @@ -1269,7 +1269,7 @@ var detailedTests = []detailedTest{ { name: "op_data_29", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_29, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_29, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, @@ -1280,7 +1280,7 @@ var detailedTests = []detailedTest{ { name: "op_data_30", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_30, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_30, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, @@ -1291,7 +1291,7 @@ var detailedTests = []detailedTest{ { name: "op_data_31", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_31, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_31, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, @@ -1302,7 +1302,7 @@ var detailedTests = []detailedTest{ { name: "op_data_32", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_32, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_32, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, @@ -1313,7 +1313,7 @@ var detailedTests = []detailedTest{ { name: "op_data_33", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_33, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_33, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33}, after: [][]byte{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, @@ -1324,7 +1324,7 @@ var detailedTests = []detailedTest{ { name: "op_data_34", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_34, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_34, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34}, @@ -1336,7 +1336,7 @@ var detailedTests = []detailedTest{ { name: "op_data_35", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_35, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_35, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35}, @@ -1348,7 +1348,7 @@ var detailedTests = []detailedTest{ { name: "op_data_36", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_36, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_36, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36}, @@ -1360,7 +1360,7 @@ var detailedTests = []detailedTest{ { name: "op_data_37", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_37, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_37, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37}, @@ -1372,7 +1372,7 @@ var detailedTests = []detailedTest{ { name: "op_data_38", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_38, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_38, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38}, @@ -1384,7 +1384,7 @@ var detailedTests = []detailedTest{ { name: "op_data_39", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_39, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_39, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39}, @@ -1397,7 +1397,7 @@ var detailedTests = []detailedTest{ { name: "op_data_40", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_40, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_40, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40}, @@ -1410,7 +1410,7 @@ var detailedTests = []detailedTest{ { name: "op_data_41", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_41, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_41, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41}, @@ -1423,7 +1423,7 @@ var detailedTests = []detailedTest{ { name: "op_data_42", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_42, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_42, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42}, @@ -1436,7 +1436,7 @@ var detailedTests = []detailedTest{ { name: "op_data_43", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_43, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_43, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43}, @@ -1449,7 +1449,7 @@ var detailedTests = []detailedTest{ { name: "op_data_44", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_44, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_44, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44}, @@ -1462,7 +1462,7 @@ var detailedTests = []detailedTest{ { name: "op_data_45", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_45, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_45, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45}, @@ -1475,7 +1475,7 @@ var detailedTests = []detailedTest{ { name: "op_data_46", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_46, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_46, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1489,7 +1489,7 @@ var detailedTests = []detailedTest{ { name: "op_data_47", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_47, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_47, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1503,7 +1503,7 @@ var detailedTests = []detailedTest{ { name: "op_data_48", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_48, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_48, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1517,7 +1517,7 @@ var detailedTests = []detailedTest{ { name: "op_data_49", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_49, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_49, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1531,7 +1531,7 @@ var detailedTests = []detailedTest{ { name: "op_data_50", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_50, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_50, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1545,7 +1545,7 @@ var detailedTests = []detailedTest{ { name: "op_data_51", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_51, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_51, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1560,7 +1560,7 @@ var detailedTests = []detailedTest{ { name: "op_data_52", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_52, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_52, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1575,7 +1575,7 @@ var detailedTests = []detailedTest{ { name: "op_data_53", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_53, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_53, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1590,7 +1590,7 @@ var detailedTests = []detailedTest{ { name: "op_data_54", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_54, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_54, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1605,7 +1605,7 @@ var detailedTests = []detailedTest{ { name: "op_data_55", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_55, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_55, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1620,7 +1620,7 @@ var detailedTests = []detailedTest{ { name: "op_data_56", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_56, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_56, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1635,7 +1635,7 @@ var detailedTests = []detailedTest{ { name: "op_data_57", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_57, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_57, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1650,7 +1650,7 @@ var detailedTests = []detailedTest{ { name: "op_data_58", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_58, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_58, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1666,7 +1666,7 @@ var detailedTests = []detailedTest{ { name: "op_data_59", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_59, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_59, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1682,7 +1682,7 @@ var detailedTests = []detailedTest{ { name: "op_data_60", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_60, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_60, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1698,7 +1698,7 @@ var detailedTests = []detailedTest{ { name: "op_data_61", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_61, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_61, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1714,7 +1714,7 @@ var detailedTests = []detailedTest{ { name: "op_data_62", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_62, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_62, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1730,7 +1730,7 @@ var detailedTests = []detailedTest{ { name: "op_data_63", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_63, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_63, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1747,7 +1747,7 @@ var detailedTests = []detailedTest{ { name: "op_data_64", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_64, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1764,7 +1764,7 @@ var detailedTests = []detailedTest{ { name: "op_data_65", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_65, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_65, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1781,7 +1781,7 @@ var detailedTests = []detailedTest{ { name: "op_data_66", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_66, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_66, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1798,7 +1798,7 @@ var detailedTests = []detailedTest{ { name: "op_data_67", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_67, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_67, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1815,7 +1815,7 @@ var detailedTests = []detailedTest{ { name: "op_data_68", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_68, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_68, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1832,7 +1832,7 @@ var detailedTests = []detailedTest{ { name: "op_data_69", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_69, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_69, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1849,7 +1849,7 @@ var detailedTests = []detailedTest{ { name: "op_data_70", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_70, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_70, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1867,7 +1867,7 @@ var detailedTests = []detailedTest{ { name: "op_data_71", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_71, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_71, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1885,7 +1885,7 @@ var detailedTests = []detailedTest{ { name: "op_data_72", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_72, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_72, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1903,7 +1903,7 @@ var detailedTests = []detailedTest{ { name: "op_data_73", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_73, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_73, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1921,7 +1921,7 @@ var detailedTests = []detailedTest{ { name: "op_data_74", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_74, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_74, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1940,7 +1940,7 @@ var detailedTests = []detailedTest{ { name: "op_data_75", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_75, 1, 2, 3, 4, 5, 6, 7, 8, 9, + script: []byte{txscript.OP_DATA_75, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1959,48 +1959,48 @@ var detailedTests = []detailedTest{ { name: "op_data too short", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_2, 1}, - expectedReturn: btcscript.ErrStackShortScript, - disassemblyerr: btcscript.ErrStackShortScript, + script: []byte{txscript.OP_DATA_2, 1}, + expectedReturn: txscript.ErrStackShortScript, + disassemblyerr: txscript.ErrStackShortScript, }, { name: "op_pushdata_1", before: [][]byte{}, - script: []byte{btcscript.OP_PUSHDATA1, 1, 2}, + script: []byte{txscript.OP_PUSHDATA1, 1, 2}, after: [][]byte{{2}}, disassembly: "02", }, { name: "op_pushdata_1 too short", - script: []byte{btcscript.OP_PUSHDATA1, 1}, - expectedReturn: btcscript.ErrStackShortScript, - disassemblyerr: btcscript.ErrStackShortScript, + script: []byte{txscript.OP_PUSHDATA1, 1}, + expectedReturn: txscript.ErrStackShortScript, + disassemblyerr: txscript.ErrStackShortScript, }, { name: "op_pushdata_2", before: [][]byte{}, - script: []byte{btcscript.OP_PUSHDATA2, 2, 0, 2, 4}, + script: []byte{txscript.OP_PUSHDATA2, 2, 0, 2, 4}, after: [][]byte{{2, 4}}, disassembly: "0204", }, { name: "op_pushdata_2 too short", - script: []byte{btcscript.OP_PUSHDATA2, 2, 0}, - expectedReturn: btcscript.ErrStackShortScript, - disassemblyerr: btcscript.ErrStackShortScript, + script: []byte{txscript.OP_PUSHDATA2, 2, 0}, + expectedReturn: txscript.ErrStackShortScript, + disassemblyerr: txscript.ErrStackShortScript, }, { name: "op_pushdata_4", before: [][]byte{}, - script: []byte{btcscript.OP_PUSHDATA4, 4, 0, 0, 0, 2, 4, 8, 16}, + script: []byte{txscript.OP_PUSHDATA4, 4, 0, 0, 0, 2, 4, 8, 16}, after: [][]byte{{2, 4, 8, 16}}, disassembly: "02040810", }, { name: "op_pushdata_4 too short", - script: []byte{btcscript.OP_PUSHDATA4, 4, 0, 0, 0}, - expectedReturn: btcscript.ErrStackShortScript, - disassemblyerr: btcscript.ErrStackShortScript, + script: []byte{txscript.OP_PUSHDATA4, 4, 0, 0, 0}, + expectedReturn: txscript.ErrStackShortScript, + disassemblyerr: txscript.ErrStackShortScript, }, // XXX also pushdata cases where the pushed data isn't long enough, // no real error type defined for that as of yet. @@ -2008,14 +2008,14 @@ var detailedTests = []detailedTest{ { name: "OP_SHA1 no args", before: [][]byte{}, - script: []byte{btcscript.OP_SHA1}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_SHA1}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_SHA1", }, { name: "OP_SHA1", before: [][]byte{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, - script: []byte{btcscript.OP_SHA1}, + script: []byte{txscript.OP_SHA1}, after: [][]byte{{0x5d, 0x21, 0x1b, 0xad, 0x8f, 0x4e, 0xe7, 0x0e, 0x16, 0xc7, 0xd3, 0x43, 0xa8, 0x38, 0xfc, 0x34, 0x4a, 0x1e, 0xd9, 0x61}}, @@ -2024,15 +2024,15 @@ var detailedTests = []detailedTest{ { name: "OP_SHA256 no args", before: [][]byte{}, - script: []byte{btcscript.OP_SHA256}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_SHA256}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_SHA256", }, { name: "OP_RIPEMD160 no args", before: [][]byte{}, - script: []byte{btcscript.OP_RIPEMD160}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_RIPEMD160}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_RIPEMD160", }, // data taken from transaction @@ -2050,7 +2050,7 @@ var detailedTests = []detailedTest{ 0xe9, 0x91, 0x94, 0xaa, 0x69, 0x27, 0xaf, 0xf2, 0x54, 0x16, 0xec, 0x48, 0x9d, 0x45, 0x3a, 0x80, 0x7e, 0x03, 0xc0, 0x83}}, - script: []byte{btcscript.OP_SHA256, btcscript.OP_RIPEMD160}, + script: []byte{txscript.OP_SHA256, txscript.OP_RIPEMD160}, after: [][]byte{{0x8b, 0xfa, 0x5c, 0x1f, 0x68, 0x5f, 0x13, 0x86, 0x3e, 0x74, 0x2e, 0x1b, 0xaf, 0x15, 0xf1, 0x71, 0xad, 0x49, 0x8b, 0x8f}}, @@ -2067,7 +2067,7 @@ var detailedTests = []detailedTest{ 0xe9, 0x91, 0x94, 0xaa, 0x69, 0x27, 0xaf, 0xf2, 0x54, 0x16, 0xec, 0x48, 0x9d, 0x45, 0x3a, 0x80, 0x7e, 0x03, 0xc0, 0x83}}, - script: []byte{btcscript.OP_HASH160}, + script: []byte{txscript.OP_HASH160}, after: [][]byte{{0x8b, 0xfa, 0x5c, 0x1f, 0x68, 0x5f, 0x13, 0x86, 0x3e, 0x74, 0x2e, 0x1b, 0xaf, 0x15, 0xf1, 0x71, 0xad, 0x49, 0x8b, 0x8f}}, @@ -2077,7 +2077,7 @@ var detailedTests = []detailedTest{ { name: "op_hash160 full script", before: [][]byte{}, - script: []byte{btcscript.OP_DATA_65, + script: []byte{txscript.OP_DATA_65, 0x04, 0x0f, 0xa4, 0x92, 0xe3, 0x59, 0xde, 0xe8, 0x4b, 0x53, 0xfe, 0xc5, 0xe9, 0x18, 0xb7, 0xfd, 0x62, 0x1e, 0xb7, 0xe5, 0x63, 0x38, 0xc5, 0xfb, 0xff, 0x71, 0xd9, @@ -2086,18 +2086,18 @@ var detailedTests = []detailedTest{ 0xe9, 0x91, 0x94, 0xaa, 0x69, 0x27, 0xaf, 0xf2, 0x54, 0x16, 0xec, 0x48, 0x9d, 0x45, 0x3a, 0x80, 0x7e, 0x03, 0xc0, 0x83, - btcscript.OP_HASH160, btcscript.OP_DATA_20, + txscript.OP_HASH160, txscript.OP_DATA_20, 0x8b, 0xfa, 0x5c, 0x1f, 0x68, 0x5f, 0x13, 0x86, 0x3e, 0x74, 0x2e, 0x1b, 0xaf, 0x15, 0xf1, 0x71, 0xad, 0x49, 0x8b, 0x8f, - btcscript.OP_EQUALVERIFY}, + txscript.OP_EQUALVERIFY}, after: [][]byte{}, disassembly: "040fa492e359dee84b53fec5e918b7fd621eb7e56338c5fbff71d91d1722da58f10f9e8f412f399cb30670a727e99194aa6927aff25416ec489d453a807e03c083 OP_HASH160 8bfa5c1f685f13863e742e1baf15f171ad498b8f OP_EQUALVERIFY", }, { name: "op_hash160 no args", - script: []byte{btcscript.OP_HASH160}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_HASH160}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_HASH160", }, // hash256 test taken from spend of: @@ -2113,7 +2113,7 @@ var detailedTests = []detailedTest{ 0xc8, 0x1b, 0xc3, 0x88, 0x8a, 0x51, 0x32, 0x3a, 0x9f, 0xb8, 0xaa, 0x4b, 0x1e, 0x5e, 0x4a, 0x29, 0xab, 0x5f, 0x49, 0xff, 0xff, 0x00, 0x1d, 0x1d, 0xac, 0x2b, 0x7c}}, - script: []byte{btcscript.OP_HASH256}, + script: []byte{txscript.OP_HASH256}, after: [][]byte{{0x6f, 0xe2, 0x8c, 0x0a, 0xb6, 0xf1, 0xb3, 0x72, 0xc1, 0xa6, 0xa2, 0x46, 0xae, 0x63, 0xf7, 0x4f, 0x93, 0x1e, 0x83, 0x65, 0xe1, 0x5a, 0x08, 0x9c, 0x68, 0xd6, 0x19, @@ -2122,8 +2122,8 @@ var detailedTests = []detailedTest{ }, { name: "OP_HASH256 no args", - script: []byte{btcscript.OP_HASH256}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_HASH256}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_HASH256", }, // We need a more involved setup to test OP_CHECKSIG and @@ -2131,69 +2131,69 @@ var detailedTests = []detailedTest{ // invalid arguments here quite easily. { name: "OP_CHECKSIG one arg", - script: []byte{btcscript.OP_1, btcscript.OP_CHECKSIG}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_1, txscript.OP_CHECKSIG}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "1 OP_CHECKSIG", nSigOps: 1, nPreciseSigOps: 1, }, { name: "OP_CHECKSIG no arg", - script: []byte{btcscript.OP_CHECKSIG}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_CHECKSIG}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_CHECKSIG", nSigOps: 1, nPreciseSigOps: 1, }, { name: "OP_CHECKSIGVERIFY one arg", - script: []byte{btcscript.OP_1, - btcscript.OP_CHECKSIGVERIFY}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_1, + txscript.OP_CHECKSIGVERIFY}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "1 OP_CHECKSIGVERIFY", nSigOps: 1, nPreciseSigOps: 1, }, { name: "OP_CHECKSIGVERIFY no arg", - script: []byte{btcscript.OP_CHECKSIGVERIFY}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_CHECKSIGVERIFY}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_CHECKSIGVERIFY", nSigOps: 1, nPreciseSigOps: 1, }, { name: "OP_CHECKMULTISIG no args", - script: []byte{btcscript.OP_CHECKMULTISIG}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_CHECKMULTISIG}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_CHECKMULTISIG", nSigOps: 20, nPreciseSigOps: 20, }, { name: "OP_CHECKMULTISIG huge number", - script: []byte{btcscript.OP_PUSHDATA1, + script: []byte{txscript.OP_PUSHDATA1, 0x9, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, - btcscript.OP_CHECKMULTISIG}, - expectedReturn: btcscript.ErrStackNumberTooBig, + txscript.OP_CHECKMULTISIG}, + expectedReturn: txscript.ErrStackNumberTooBig, disassembly: "010203040506070809 OP_CHECKMULTISIG", nSigOps: 20, nPreciseSigOps: 20, }, { name: "OP_CHECKMULTISIG too many keys", - script: []byte{btcscript.OP_DATA_1, 21, - btcscript.OP_CHECKMULTISIG}, - expectedReturn: btcscript.ErrStackTooManyPubkeys, + script: []byte{txscript.OP_DATA_1, 21, + txscript.OP_CHECKMULTISIG}, + expectedReturn: txscript.ErrStackTooManyPubkeys, disassembly: "15 OP_CHECKMULTISIG", nSigOps: 20, nPreciseSigOps: 20, }, { name: "OP_CHECKMULTISIG lying about pubkeys", - script: []byte{btcscript.OP_1, - btcscript.OP_CHECKMULTISIG}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_1, + txscript.OP_CHECKMULTISIG}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "1 OP_CHECKMULTISIG", nSigOps: 20, nPreciseSigOps: 1, @@ -2202,7 +2202,7 @@ var detailedTests = []detailedTest{ // pubkey comes from blockchain name: "OP_CHECKMULTISIG no sigs", script: []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, 0x99, 0xa2, 0xf7, 0x15, 0x9b, 0x22, 0x25, 0xf3, 0x74, 0xcd, 0x37, 0x8d, @@ -2211,9 +2211,9 @@ var detailedTests = []detailedTest{ 0x21, 0xc1, 0xb7, 0x30, 0x3b, 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, - btcscript.OP_1, - btcscript.OP_CHECKMULTISIG}, - expectedReturn: btcscript.ErrStackUnderflow, + txscript.OP_1, + txscript.OP_CHECKMULTISIG}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c 1 OP_CHECKMULTISIG", nSigOps: 20, nPreciseSigOps: 1, @@ -2222,9 +2222,9 @@ var detailedTests = []detailedTest{ // pubkey comes from blockchain name: "OP_CHECKMULTISIG sigs huge no", script: []byte{ - btcscript.OP_PUSHDATA1, + txscript.OP_PUSHDATA1, 0x9, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, 0x99, 0xa2, 0xf7, 0x15, 0x9b, 0x22, 0x25, 0xf3, 0x74, 0xcd, 0x37, 0x8d, @@ -2233,17 +2233,17 @@ var detailedTests = []detailedTest{ 0x21, 0xc1, 0xb7, 0x30, 0x3b, 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, - btcscript.OP_1, - btcscript.OP_CHECKMULTISIG}, - expectedReturn: btcscript.ErrStackNumberTooBig, + txscript.OP_1, + txscript.OP_CHECKMULTISIG}, + expectedReturn: txscript.ErrStackNumberTooBig, disassembly: "010203040506070809 04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c 1 OP_CHECKMULTISIG", nSigOps: 20, nPreciseSigOps: 1, }, { name: "OP_CHECKMULTISIG too few sigs", - script: []byte{btcscript.OP_1, - btcscript.OP_DATA_65, + script: []byte{txscript.OP_1, + txscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, 0x99, 0xa2, 0xf7, 0x15, 0x9b, 0x22, 0x25, 0xf3, 0x74, 0xcd, 0x37, 0x8d, @@ -2252,9 +2252,9 @@ var detailedTests = []detailedTest{ 0x21, 0xc1, 0xb7, 0x30, 0x3b, 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, - btcscript.OP_1, - btcscript.OP_CHECKMULTISIG}, - expectedReturn: btcscript.ErrStackUnderflow, + txscript.OP_1, + txscript.OP_CHECKMULTISIG}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "1 04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c 1 OP_CHECKMULTISIG", nSigOps: 20, nPreciseSigOps: 1, @@ -2262,8 +2262,8 @@ var detailedTests = []detailedTest{ { // pubkey and sig comes from blockchain, are unrelated name: "OP_CHECKMULTISIG won't verify", - script: []byte{btcscript.OP_1, - btcscript.OP_DATA_71, + script: []byte{txscript.OP_1, + txscript.OP_DATA_71, 0x30, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69, 0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1, 0xa2, 0x5f, 0xdf, 0x3f, 0x4f, 0x77, 0x32, 0xe9, 0xd6, 0x24, @@ -2272,8 +2272,8 @@ var detailedTests = []detailedTest{ 0xde, 0x48, 0x60, 0xa4, 0xac, 0xdd, 0x12, 0x90, 0x9d, 0x83, 0x1c, 0xc5, 0x6c, 0xbb, 0xac, 0x46, 0x22, 0x08, 0x22, 0x21, 0xa8, 0x76, 0x8d, 0x1d, 0x09, 0x01, - btcscript.OP_1, - btcscript.OP_DATA_65, + txscript.OP_1, + txscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, 0x99, 0xa2, 0xf7, 0x15, 0x9b, 0x22, 0x25, 0xf3, 0x74, 0xcd, 0x37, 0x8d, @@ -2282,8 +2282,8 @@ var detailedTests = []detailedTest{ 0x21, 0xc1, 0xb7, 0x30, 0x3b, 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, - btcscript.OP_1, - btcscript.OP_CHECKMULTISIG}, + txscript.OP_1, + txscript.OP_CHECKMULTISIG}, after: [][]byte{{0}}, disassembly: "1 304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901 1 04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c 1 OP_CHECKMULTISIG", nSigOps: 20, @@ -2294,8 +2294,8 @@ var detailedTests = []detailedTest{ // error. There are pubkeys in the blockchain that don't // parse with any validity. name: "OP_CHECKMULTISIG sigs bad pubkey", - script: []byte{btcscript.OP_1, - btcscript.OP_DATA_71, + script: []byte{txscript.OP_1, + txscript.OP_DATA_71, 0x30, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69, 0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1, 0xa2, 0x5f, 0xdf, 0x3f, 0x4f, 0x77, 0x32, 0xe9, 0xd6, 0x24, @@ -2304,9 +2304,9 @@ var detailedTests = []detailedTest{ 0xde, 0x48, 0x60, 0xa4, 0xac, 0xdd, 0x12, 0x90, 0x9d, 0x83, 0x1c, 0xc5, 0x6c, 0xbb, 0xac, 0x46, 0x22, 0x08, 0x22, 0x21, 0xa8, 0x76, 0x8d, 0x1d, 0x09, 0x01, - btcscript.OP_1, - btcscript.OP_1, btcscript.OP_1, - btcscript.OP_CHECKMULTISIG}, + txscript.OP_1, + txscript.OP_1, txscript.OP_1, + txscript.OP_CHECKMULTISIG}, after: [][]byte{{0}}, disassembly: "1 304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901 1 1 1 OP_CHECKMULTISIG", nSigOps: 20, @@ -2316,36 +2316,36 @@ var detailedTests = []detailedTest{ // disabled opcodes { name: "OP_CHECKMULTISIGVERIFY no args", - script: []byte{btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_CHECKMULTISIGVERIFY}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 20, }, { name: "OP_CHECKMULTISIGVERIFY huge number", - script: []byte{btcscript.OP_PUSHDATA1, + script: []byte{txscript.OP_PUSHDATA1, 0x9, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, - btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.ErrStackNumberTooBig, + txscript.OP_CHECKMULTISIGVERIFY}, + expectedReturn: txscript.ErrStackNumberTooBig, disassembly: "010203040506070809 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 20, }, { name: "OP_CHECKMULTISIGVERIFY too many keys", - script: []byte{btcscript.OP_DATA_1, 21, - btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.ErrStackTooManyPubkeys, + script: []byte{txscript.OP_DATA_1, 21, + txscript.OP_CHECKMULTISIGVERIFY}, + expectedReturn: txscript.ErrStackTooManyPubkeys, disassembly: "15 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 20, }, { name: "OP_CHECKMULTISIGVERIFY lying about pubkeys", - script: []byte{btcscript.OP_1, - btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.ErrStackUnderflow, + script: []byte{txscript.OP_1, + txscript.OP_CHECKMULTISIGVERIFY}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "1 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 1, @@ -2354,7 +2354,7 @@ var detailedTests = []detailedTest{ // pubkey comes from blockchain name: "OP_CHECKMULTISIGVERIFY no sigs", script: []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, 0x99, 0xa2, 0xf7, 0x15, 0x9b, 0x22, 0x25, 0xf3, 0x74, 0xcd, 0x37, 0x8d, @@ -2363,9 +2363,9 @@ var detailedTests = []detailedTest{ 0x21, 0xc1, 0xb7, 0x30, 0x3b, 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, - btcscript.OP_1, - btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.ErrStackUnderflow, + txscript.OP_1, + txscript.OP_CHECKMULTISIGVERIFY}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c 1 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 1, @@ -2373,9 +2373,9 @@ var detailedTests = []detailedTest{ { name: "OP_CHECKMULTISIGVERIFY sigs huge no", script: []byte{ - btcscript.OP_PUSHDATA1, + txscript.OP_PUSHDATA1, 0x9, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, 0x99, 0xa2, 0xf7, 0x15, 0x9b, 0x22, 0x25, 0xf3, 0x74, 0xcd, 0x37, 0x8d, @@ -2384,17 +2384,17 @@ var detailedTests = []detailedTest{ 0x21, 0xc1, 0xb7, 0x30, 0x3b, 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, - btcscript.OP_1, - btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.ErrStackNumberTooBig, + txscript.OP_1, + txscript.OP_CHECKMULTISIGVERIFY}, + expectedReturn: txscript.ErrStackNumberTooBig, disassembly: "010203040506070809 04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c 1 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 1, }, { name: "OP_CHECKMULTISIGVERIFY too few sigs", - script: []byte{btcscript.OP_1, - btcscript.OP_DATA_65, + script: []byte{txscript.OP_1, + txscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, 0x99, 0xa2, 0xf7, 0x15, 0x9b, 0x22, 0x25, 0xf3, 0x74, 0xcd, 0x37, 0x8d, @@ -2403,9 +2403,9 @@ var detailedTests = []detailedTest{ 0x21, 0xc1, 0xb7, 0x30, 0x3b, 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, - btcscript.OP_1, - btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.ErrStackUnderflow, + txscript.OP_1, + txscript.OP_CHECKMULTISIGVERIFY}, + expectedReturn: txscript.ErrStackUnderflow, disassembly: "1 04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c 1 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 1, @@ -2413,8 +2413,8 @@ var detailedTests = []detailedTest{ { // pubkey and sig comes from blockchain, are unrelated name: "OP_CHECKMULTISIGVERIFY won't verify", - script: []byte{btcscript.OP_1, - btcscript.OP_DATA_71, + script: []byte{txscript.OP_1, + txscript.OP_DATA_71, 0x30, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69, 0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1, 0xa2, 0x5f, 0xdf, 0x3f, 0x4f, 0x77, 0x32, 0xe9, 0xd6, 0x24, @@ -2423,8 +2423,8 @@ var detailedTests = []detailedTest{ 0xde, 0x48, 0x60, 0xa4, 0xac, 0xdd, 0x12, 0x90, 0x9d, 0x83, 0x1c, 0xc5, 0x6c, 0xbb, 0xac, 0x46, 0x22, 0x08, 0x22, 0x21, 0xa8, 0x76, 0x8d, 0x1d, 0x09, 0x01, - btcscript.OP_1, - btcscript.OP_DATA_65, + txscript.OP_1, + txscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, 0x99, 0xa2, 0xf7, 0x15, 0x9b, 0x22, 0x25, 0xf3, 0x74, 0xcd, 0x37, 0x8d, @@ -2433,9 +2433,9 @@ var detailedTests = []detailedTest{ 0x21, 0xc1, 0xb7, 0x30, 0x3b, 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, - btcscript.OP_1, - btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.ErrStackVerifyFailed, + txscript.OP_1, + txscript.OP_CHECKMULTISIGVERIFY}, + expectedReturn: txscript.ErrStackVerifyFailed, disassembly: "1 304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901 1 04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c 1 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 1, @@ -2445,8 +2445,8 @@ var detailedTests = []detailedTest{ // error. There are pubkeys in the blockchain that don't // parse with any validity. name: "OP_CHECKMULTISIGVERIFY sigs bad pubkey", - script: []byte{btcscript.OP_1, - btcscript.OP_DATA_71, + script: []byte{txscript.OP_1, + txscript.OP_DATA_71, 0x30, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69, 0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1, 0xa2, 0x5f, 0xdf, 0x3f, 0x4f, 0x77, 0x32, 0xe9, 0xd6, 0x24, @@ -2455,10 +2455,10 @@ var detailedTests = []detailedTest{ 0xde, 0x48, 0x60, 0xa4, 0xac, 0xdd, 0x12, 0x90, 0x9d, 0x83, 0x1c, 0xc5, 0x6c, 0xbb, 0xac, 0x46, 0x22, 0x08, 0x22, 0x21, 0xa8, 0x76, 0x8d, 0x1d, 0x09, 0x01, - btcscript.OP_1, - btcscript.OP_1, btcscript.OP_1, - btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.ErrStackVerifyFailed, + txscript.OP_1, + txscript.OP_1, txscript.OP_1, + txscript.OP_CHECKMULTISIGVERIFY}, + expectedReturn: txscript.ErrStackVerifyFailed, disassembly: "1 304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901 1 1 1 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 1, @@ -2466,208 +2466,208 @@ var detailedTests = []detailedTest{ { // 201 operations + one push, should just fit limits name: "max operations", - script: []byte{btcscript.OP_1, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, + script: []byte{txscript.OP_1, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, }, after: [][]byte{{1}, {1}}, disassembly: "1 OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP", @@ -2675,425 +2675,425 @@ var detailedTests = []detailedTest{ { // 202 operations + one push name: "too many operations", - script: []byte{btcscript.OP_1, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, + script: []byte{txscript.OP_1, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, }, - expectedReturn: btcscript.ErrStackTooManyOperations, + expectedReturn: txscript.ErrStackTooManyOperations, disassembly: "1 OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP", }, { // 202 operations + one push name: "too many operations multisig", - script: []byte{btcscript.OP_1, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_DUP, - btcscript.OP_DROP, - btcscript.OP_1, - btcscript.OP_1, - btcscript.OP_1, - btcscript.OP_1, - btcscript.OP_2, - btcscript.OP_CHECKMULTISIG, + script: []byte{txscript.OP_1, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_DUP, + txscript.OP_DROP, + txscript.OP_1, + txscript.OP_1, + txscript.OP_1, + txscript.OP_1, + txscript.OP_2, + txscript.OP_CHECKMULTISIG, }, - expectedReturn: btcscript.ErrStackTooManyOperations, + expectedReturn: txscript.ErrStackTooManyOperations, disassembly: "1 OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP 1 1 1 1 2 OP_CHECKMULTISIG", nSigOps: 20, nPreciseSigOps: 2, @@ -3102,7 +3102,7 @@ var detailedTests = []detailedTest{ name: "push largest", // 521 bytes before: [][]byte{}, - script: []byte{btcscript.OP_PUSHDATA2, 0x08, 0x02, + script: []byte{txscript.OP_PUSHDATA2, 0x08, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, @@ -3225,7 +3225,7 @@ var detailedTests = []detailedTest{ { name: "push too large", // 521 bytes - script: []byte{btcscript.OP_PUSHDATA2, 0x09, 0x02, + script: []byte{txscript.OP_PUSHDATA2, 0x09, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, @@ -3284,966 +3284,966 @@ var detailedTests = []detailedTest{ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - expectedReturn: btcscript.ErrStackElementTooBig, + expectedReturn: txscript.ErrStackElementTooBig, // element too big is a parse error. disassembly: "0102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708", }, { name: "OP_CAT disabled", - script: []byte{btcscript.OP_CAT}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_CAT}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_CAT", }, { name: "OP_SUBSTR disabled", - script: []byte{btcscript.OP_SUBSTR}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_SUBSTR}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_SUBSTR", }, { name: "OP_LEFT disabled", - script: []byte{btcscript.OP_LEFT}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_LEFT}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_LEFT", }, { name: "OP_RIGHT disabled", - script: []byte{btcscript.OP_RIGHT}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_RIGHT}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_RIGHT", }, { name: "OP_INVERT disabled", - script: []byte{btcscript.OP_INVERT}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_INVERT}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_INVERT", }, { name: "OP_AND disabled", - script: []byte{btcscript.OP_AND}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_AND}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_AND", }, { name: "OP_OR disabled", - script: []byte{btcscript.OP_OR}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_OR}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_OR", }, { name: "OP_XOR disabled", - script: []byte{btcscript.OP_XOR}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_XOR}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_XOR", }, { name: "OP_2MUL disabled", - script: []byte{btcscript.OP_2MUL}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_2MUL}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_2MUL", }, { name: "OP_2DIV disabled", - script: []byte{btcscript.OP_2DIV}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_2DIV}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_2DIV", }, { name: "OP_2DIV disabled", - script: []byte{btcscript.OP_2DIV}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_2DIV}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_2DIV", }, { name: "OP_MUL disabled", - script: []byte{btcscript.OP_MUL}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_MUL}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_MUL", }, { name: "OP_DIV disabled", - script: []byte{btcscript.OP_DIV}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_DIV}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_DIV", }, { name: "OP_MOD disabled", - script: []byte{btcscript.OP_MOD}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_MOD}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_MOD", }, { name: "OP_LSHIFT disabled", - script: []byte{btcscript.OP_LSHIFT}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_LSHIFT}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_LSHIFT", }, { name: "OP_RSHIFT disabled", - script: []byte{btcscript.OP_RSHIFT}, - expectedReturn: btcscript.ErrStackOpDisabled, + script: []byte{txscript.OP_RSHIFT}, + expectedReturn: txscript.ErrStackOpDisabled, disassembly: "OP_RSHIFT", }, // Reserved opcodes { name: "OP_RESERVED reserved", - script: []byte{btcscript.OP_RESERVED}, - expectedReturn: btcscript.ErrStackReservedOpcode, + script: []byte{txscript.OP_RESERVED}, + expectedReturn: txscript.ErrStackReservedOpcode, disassembly: "OP_RESERVED", }, { name: "OP_VER reserved", - script: []byte{btcscript.OP_VER}, - expectedReturn: btcscript.ErrStackReservedOpcode, + script: []byte{txscript.OP_VER}, + expectedReturn: txscript.ErrStackReservedOpcode, disassembly: "OP_VER", }, { name: "OP_VERIF reserved", - script: []byte{btcscript.OP_VERIF}, - expectedReturn: btcscript.ErrStackReservedOpcode, + script: []byte{txscript.OP_VERIF}, + expectedReturn: txscript.ErrStackReservedOpcode, disassembly: "OP_VERIF", }, { name: "OP_VERNOTIF reserved", - script: []byte{btcscript.OP_VERNOTIF}, - expectedReturn: btcscript.ErrStackReservedOpcode, + script: []byte{txscript.OP_VERNOTIF}, + expectedReturn: txscript.ErrStackReservedOpcode, disassembly: "OP_VERNOTIF", }, { name: "OP_RESERVED1 reserved", - script: []byte{btcscript.OP_RESERVED1}, - expectedReturn: btcscript.ErrStackReservedOpcode, + script: []byte{txscript.OP_RESERVED1}, + expectedReturn: txscript.ErrStackReservedOpcode, disassembly: "OP_RESERVED1", }, { name: "OP_RESERVED2 reserved", - script: []byte{btcscript.OP_RESERVED2}, - expectedReturn: btcscript.ErrStackReservedOpcode, + script: []byte{txscript.OP_RESERVED2}, + expectedReturn: txscript.ErrStackReservedOpcode, disassembly: "OP_RESERVED2", }, // Invalid Opcodes { name: "invalid opcode 186", - script: []byte{btcscript.OP_UNKNOWN186}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN186}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN186", }, { name: "invalid opcode 187", - script: []byte{btcscript.OP_UNKNOWN187}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN187}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN187", }, { name: "invalid opcode 188", - script: []byte{btcscript.OP_UNKNOWN188}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN188}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN188", }, { name: "invalid opcode 189", - script: []byte{btcscript.OP_UNKNOWN189}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN189}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN189", }, { name: "invalid opcode 190", - script: []byte{btcscript.OP_UNKNOWN190}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN190}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN190", }, { name: "invalid opcode 191", - script: []byte{btcscript.OP_UNKNOWN191}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN191}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN191", }, { name: "invalid opcode 192", - script: []byte{btcscript.OP_UNKNOWN192}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN192}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN192", }, { name: "invalid opcode 193", - script: []byte{btcscript.OP_UNKNOWN193}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN193}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN193", }, { name: "invalid opcode 194", - script: []byte{btcscript.OP_UNKNOWN194}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN194}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN194", }, { name: "invalid opcode 195", - script: []byte{btcscript.OP_UNKNOWN195}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN195}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN195", }, { name: "invalid opcode 196", - script: []byte{btcscript.OP_UNKNOWN196}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN196}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN196", }, { name: "invalid opcode 197", - script: []byte{btcscript.OP_UNKNOWN197}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN197}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN197", }, { name: "invalid opcode 198", - script: []byte{btcscript.OP_UNKNOWN198}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN198}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN198", }, { name: "invalid opcode 199", - script: []byte{btcscript.OP_UNKNOWN199}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN199}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN199", }, { name: "invalid opcode 200", - script: []byte{btcscript.OP_UNKNOWN200}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN200}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN200", }, { name: "invalid opcode 201", - script: []byte{btcscript.OP_UNKNOWN201}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN201}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN201", }, { name: "invalid opcode 202", - script: []byte{btcscript.OP_UNKNOWN202}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN202}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN202", }, { name: "invalid opcode 203", - script: []byte{btcscript.OP_UNKNOWN203}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN203}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN203", }, { name: "invalid opcode 204", - script: []byte{btcscript.OP_UNKNOWN204}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN204}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN204", }, { name: "invalid opcode 205", - script: []byte{btcscript.OP_UNKNOWN205}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN205}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN205", }, { name: "invalid opcode 206", - script: []byte{btcscript.OP_UNKNOWN206}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN206}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN206", }, { name: "invalid opcode 207", - script: []byte{btcscript.OP_UNKNOWN207}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN207}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN207", }, { name: "invalid opcode 208", - script: []byte{btcscript.OP_UNKNOWN208}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN208}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN208", }, { name: "invalid opcode 209", - script: []byte{btcscript.OP_UNKNOWN209}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN209}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN209", }, { name: "invalid opcode 210", - script: []byte{btcscript.OP_UNKNOWN210}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN210}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN210", }, { name: "invalid opcode 211", - script: []byte{btcscript.OP_UNKNOWN211}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN211}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN211", }, { name: "invalid opcode 212", - script: []byte{btcscript.OP_UNKNOWN212}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN212}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN212", }, { name: "invalid opcode 213", - script: []byte{btcscript.OP_UNKNOWN213}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN213}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN213", }, { name: "invalid opcode 214", - script: []byte{btcscript.OP_UNKNOWN214}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN214}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN214", }, { name: "invalid opcode 215", - script: []byte{btcscript.OP_UNKNOWN215}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN215}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN215", }, { name: "invalid opcode 216", - script: []byte{btcscript.OP_UNKNOWN216}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN216}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN216", }, { name: "invalid opcode 217", - script: []byte{btcscript.OP_UNKNOWN217}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN217}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN217", }, { name: "invalid opcode 218", - script: []byte{btcscript.OP_UNKNOWN218}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN218}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN218", }, { name: "invalid opcode 219", - script: []byte{btcscript.OP_UNKNOWN219}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN219}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN219", }, { name: "invalid opcode 220", - script: []byte{btcscript.OP_UNKNOWN220}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN220}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN220", }, { name: "invalid opcode 221", - script: []byte{btcscript.OP_UNKNOWN221}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN221}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN221", }, { name: "invalid opcode 222", - script: []byte{btcscript.OP_UNKNOWN222}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN222}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN222", }, { name: "invalid opcode 223", - script: []byte{btcscript.OP_UNKNOWN223}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN223}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN223", }, { name: "invalid opcode 224", - script: []byte{btcscript.OP_UNKNOWN224}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN224}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN224", }, { name: "invalid opcode 225", - script: []byte{btcscript.OP_UNKNOWN225}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN225}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN225", }, { name: "invalid opcode 226", - script: []byte{btcscript.OP_UNKNOWN226}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN226}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN226", }, { name: "invalid opcode 227", - script: []byte{btcscript.OP_UNKNOWN227}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN227}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN227", }, { name: "invalid opcode 228", - script: []byte{btcscript.OP_UNKNOWN228}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN228}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN228", }, { name: "invalid opcode 229", - script: []byte{btcscript.OP_UNKNOWN229}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN229}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN229", }, { name: "invalid opcode 230", - script: []byte{btcscript.OP_UNKNOWN230}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN230}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN230", }, { name: "invalid opcode 231", - script: []byte{btcscript.OP_UNKNOWN231}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN231}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN231", }, { name: "invalid opcode 232", - script: []byte{btcscript.OP_UNKNOWN232}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN232}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN232", }, { name: "invalid opcode 233", - script: []byte{btcscript.OP_UNKNOWN233}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN233}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN233", }, { name: "invalid opcode 234", - script: []byte{btcscript.OP_UNKNOWN234}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN234}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN234", }, { name: "invalid opcode 235", - script: []byte{btcscript.OP_UNKNOWN235}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN235}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN235", }, { name: "invalid opcode 236", - script: []byte{btcscript.OP_UNKNOWN236}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN236}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN236", }, { name: "invalid opcode 237", - script: []byte{btcscript.OP_UNKNOWN237}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN237}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN237", }, { name: "invalid opcode 238", - script: []byte{btcscript.OP_UNKNOWN238}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN238}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN238", }, { name: "invalid opcode 239", - script: []byte{btcscript.OP_UNKNOWN239}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN239}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN239", }, { name: "invalid opcode 240", - script: []byte{btcscript.OP_UNKNOWN240}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN240}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN240", }, { name: "invalid opcode 241", - script: []byte{btcscript.OP_UNKNOWN241}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN241}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN241", }, { name: "invalid opcode 242", - script: []byte{btcscript.OP_UNKNOWN242}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN242}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN242", }, { name: "invalid opcode 243", - script: []byte{btcscript.OP_UNKNOWN243}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN243}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN243", }, { name: "invalid opcode 244", - script: []byte{btcscript.OP_UNKNOWN244}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN244}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN244", }, { name: "invalid opcode 245", - script: []byte{btcscript.OP_UNKNOWN245}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN245}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN245", }, { name: "invalid opcode 246", - script: []byte{btcscript.OP_UNKNOWN246}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN246}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN246", }, { name: "invalid opcode 247", - script: []byte{btcscript.OP_UNKNOWN247}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN247}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN247", }, { name: "invalid opcode 248", - script: []byte{btcscript.OP_UNKNOWN248}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN248}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN248", }, { name: "invalid opcode 249", - script: []byte{btcscript.OP_UNKNOWN249}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN249}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN249", }, { name: "invalid opcode 250", - script: []byte{btcscript.OP_UNKNOWN250}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN250}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN250", }, { name: "invalid opcode 251", - script: []byte{btcscript.OP_UNKNOWN251}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN251}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN251", }, { name: "invalid opcode 252", - script: []byte{btcscript.OP_UNKNOWN252}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_UNKNOWN252}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN252", }, { name: "invalid opcode 186 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN186, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN186, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN186 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 187 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN187, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN187, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN187 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 188 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN188, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN188, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN188 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 189 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN189, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN189, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN189 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 190 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN190, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN190, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN190 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 191 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN191, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN191, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN191 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 192 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN192, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN192, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN192 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 193 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN193, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN193, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN193 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 194 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN194, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN194, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN194 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 195 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN195, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN195, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN195 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 196 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN196, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN196, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN196 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 197 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN197, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN197, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN197 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 198 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN198, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN198, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN198 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 199 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN199, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN199, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN199 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 200 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN200, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN200, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN200 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 201 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN201, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN201, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN201 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 202 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN202, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN202, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN202 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 203 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN203, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN203, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN203 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 204 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN204, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN204, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN204 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 205 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN205, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN205, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN205 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 206 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN206, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN206, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN206 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 207 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN207, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN207, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN207 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 208 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN208, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN208, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN208 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 209 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN209, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN209, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN209 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 210 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN210, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN210, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN210 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 211 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN211, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN211, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN211 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 212 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN212, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN212, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN212 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 213 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN213, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN213, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN213 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 214 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN214, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN214, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN214 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 215 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN215, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN215, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN215 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 216 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN216, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN216, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN216 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 217 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN217, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN217, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN217 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 218 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN218, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN218, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN218 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 219 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN219, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN219, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN219 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 220 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN220, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN220, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN220 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 221 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN221, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN221, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN221 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 222 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN222, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN222, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN222 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 223 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN223, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN223, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN223 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 224 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN224, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN224, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN224 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 225 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN225, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN225, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN225 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 226 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN226, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN226, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN226 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 227 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN227, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN227, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN227 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 228 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN228, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN228, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN228 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 229 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN229, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN229, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN229 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 230 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN230, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN230, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN230 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 231 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN231, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN231, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN231 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 232 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN232, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN232, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN232 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 233 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN233, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN233, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN233 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 234 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN234, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN234, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN234 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 235 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN235, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN235, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN235 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 236 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN236, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN236, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN236 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 237 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN237, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN237, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN237 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 238 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN238, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN238, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN238 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 239 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN239, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN239, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN239 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 240 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN240, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN240, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN240 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 241 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN241, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN241, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN241 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 242 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN242, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN242, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN242 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 243 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN243, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN243, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN243 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 244 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN244, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN244, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN244 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 245 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN245, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN245, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN245 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 246 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN246, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN246, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN246 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 247 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN247, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN247, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN247 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 248 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN248, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN248, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN248 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 249 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN249, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN249, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN249 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 250 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN250, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN250, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN250 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 251 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN251, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN251, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN251 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode 252 if noexec", - script: []byte{btcscript.OP_FALSE, btcscript.OP_IF, btcscript.OP_UNKNOWN252, btcscript.OP_ELSE, btcscript.OP_TRUE, btcscript.OP_ENDIF}, + script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN252, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, after: [][]byte{{0x01}}, disassembly: "0 OP_IF OP_UNKNOWN252 OP_ELSE 1 OP_ENDIF", }, { name: "invalid opcode OP_PUBKEY", - script: []byte{btcscript.OP_PUBKEY}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_PUBKEY}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_PUBKEY", }, { name: "invalid opcode OP_PUBKEYHASH", - script: []byte{btcscript.OP_PUBKEYHASH}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_PUBKEYHASH}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_PUBKEYHASH", }, { name: "invalid opcode OP_INVALIDOPCODE", - script: []byte{btcscript.OP_INVALIDOPCODE}, - expectedReturn: btcscript.ErrStackInvalidOpcode, + script: []byte{txscript.OP_INVALIDOPCODE}, + expectedReturn: txscript.ErrStackInvalidOpcode, disassembly: "OP_INVALIDOPCODE", }, } @@ -4286,7 +4286,7 @@ func testOpcode(t *testing.T, test *detailedTest) { tx.TxOut[0].PkScript = test.script - engine, err := btcscript.NewScript(tx.TxIn[0].SignatureScript, + engine, err := txscript.NewScript(tx.TxIn[0].SignatureScript, tx.TxOut[0].PkScript, 0, tx, 0) if err != nil { if err != test.expectedReturn { @@ -4321,7 +4321,7 @@ func testOpcode(t *testing.T, test *detailedTest) { test.name, err) } _, err = engine.DisasmScript(2) - if err != btcscript.ErrStackInvalidIndex { + if err != txscript.ErrStackInvalidIndex { t.Errorf("%s: got unexpected error for invalid "+ "disassembly index: \"%v\"", test.name, err) } @@ -4383,7 +4383,7 @@ func TestOpcodes(t *testing.T) { func testDisasmString(t *testing.T, test *detailedTest) { // mock up fake tx. - dis, err := btcscript.DisasmString(test.script) + dis, err := txscript.DisasmString(test.script) if err != nil { if err != test.disassemblyerr { t.Errorf("%s: disassembly got error %v expected %v", test.name, @@ -4421,7 +4421,7 @@ func TestSigOps(t *testing.T) { t.Parallel() for _, test := range detailedTests { - count := btcscript.GetSigOpCount(test.script) + count := txscript.GetSigOpCount(test.script) if count != test.nSigOps { t.Errorf("%s: expected count of %d, got %d", test.name, test.nSigOps, count) @@ -4441,8 +4441,8 @@ func TestPreciseSigOps(t *testing.T) { t.Parallel() for _, test := range detailedTests { - count := btcscript.GetPreciseSigOpCount( - []byte{btcscript.OP_1}, test.script, false) + count := txscript.GetPreciseSigOpCount( + []byte{txscript.OP_1}, test.script, false) if count != test.nPreciseSigOps { t.Errorf("%s: expected count of %d, got %d", test.name, test.nPreciseSigOps, count) diff --git a/script.go b/txscript/script.go similarity index 99% rename from script.go rename to txscript/script.go index 86d71ea9..5aa074b0 100644 --- a/script.go +++ b/txscript/script.go @@ -1,8 +1,8 @@ -// Copyright (c) 2013-2014 Conformal Systems LLC. +// Copyright (c) 2013-2015 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcscript +package txscript import ( "bytes" @@ -193,7 +193,7 @@ func (t ScriptClass) String() string { return scriptClassToName[t] } -// Script is the virtual machine that executes btcscripts. +// Script is the virtual machine that executes scripts. type Script struct { scripts [][]parsedOpcode scriptidx int diff --git a/script_test.go b/txscript/script_test.go similarity index 83% rename from script_test.go rename to txscript/script_test.go index e8d9c372..b4c7959d 100644 --- a/script_test.go +++ b/txscript/script_test.go @@ -1,8 +1,8 @@ -// Copyright (c) 2013-2014 Conformal Systems LLC. +// Copyright (c) 2013-2015 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcscript_test +package txscript_test import ( "bytes" @@ -10,9 +10,9 @@ import ( "fmt" "testing" + "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcec" "github.com/btcsuite/btcnet" - "github.com/btcsuite/btcscript" "github.com/btcsuite/btcutil" "github.com/btcsuite/btcwire" ) @@ -21,7 +21,7 @@ import ( // allows access to the script from a known good script built with the builder. // Any errors are converted to a panic since it is only, and must only, be used // with hard coded, and therefore, known good, scripts. -func builderScript(builder *btcscript.ScriptBuilder) []byte { +func builderScript(builder *txscript.ScriptBuilder) []byte { script, err := builder.Script() if err != nil { panic(err) @@ -38,12 +38,12 @@ func TestPushedData(t *testing.T) { valid bool }{ { - []byte{btcscript.OP_0, btcscript.OP_IF, btcscript.OP_0, btcscript.OP_ELSE, btcscript.OP_2, btcscript.OP_ENDIF}, + []byte{txscript.OP_0, txscript.OP_IF, txscript.OP_0, txscript.OP_ELSE, txscript.OP_2, txscript.OP_ENDIF}, [][]byte{{}, {}}, true, }, { - builderScript(btcscript.NewScriptBuilder().AddInt64(16777216).AddInt64(10000000)), + builderScript(txscript.NewScriptBuilder().AddInt64(16777216).AddInt64(10000000)), [][]byte{ {0x00, 0x00, 0x00, 0x01}, // 16777216 {0x80, 0x96, 0x98, 0x00}, // 10000000 @@ -51,9 +51,9 @@ func TestPushedData(t *testing.T) { true, }, { - builderScript(btcscript.NewScriptBuilder().AddOp(btcscript.OP_DUP).AddOp(btcscript.OP_HASH160). - AddData([]byte("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem")).AddOp(btcscript.OP_EQUALVERIFY). - AddOp(btcscript.OP_CHECKSIG)), + builderScript(txscript.NewScriptBuilder().AddOp(txscript.OP_DUP).AddOp(txscript.OP_HASH160). + AddData([]byte("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem")).AddOp(txscript.OP_EQUALVERIFY). + AddOp(txscript.OP_CHECKSIG)), [][]byte{ // 17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem { @@ -66,15 +66,15 @@ func TestPushedData(t *testing.T) { true, }, { - builderScript(btcscript.NewScriptBuilder().AddOp(btcscript.OP_PUSHDATA4).AddInt64(1000). - AddOp(btcscript.OP_EQUAL)), + builderScript(txscript.NewScriptBuilder().AddOp(txscript.OP_PUSHDATA4).AddInt64(1000). + AddOp(txscript.OP_EQUAL)), [][]byte{}, false, }, } for x, test := range tests { - pushedData, err := btcscript.PushedData(test.in) + pushedData, err := txscript.PushedData(test.in) if test.valid && err != nil { t.Errorf("TestPushedData failed test #%d: %v\n", x, err) continue @@ -95,35 +95,35 @@ func TestStandardPushes(t *testing.T) { t.Parallel() for i := 0; i < 65535; i++ { - builder := btcscript.NewScriptBuilder() + builder := txscript.NewScriptBuilder() builder.AddInt64(int64(i)) script, err := builder.Script() if err != nil { t.Errorf("StandardPushesTests test #%d unexpected error: %v\n", i, err) continue } - if result := btcscript.IsPushOnlyScript(script); !result { + if result := txscript.IsPushOnlyScript(script); !result { t.Errorf("StandardPushesTests IsPushOnlyScript test #%d failed: %x\n", i, script) continue } - if result := btcscript.HasCanonicalPushes(script); !result { + if result := txscript.HasCanonicalPushes(script); !result { t.Errorf("StandardPushesTests HasCanonicalPushes test #%d failed: %x\n", i, script) continue } } - for i := 0; i <= btcscript.MaxScriptElementSize; i++ { - builder := btcscript.NewScriptBuilder() + for i := 0; i <= txscript.MaxScriptElementSize; i++ { + builder := txscript.NewScriptBuilder() builder.AddData(bytes.Repeat([]byte{0x49}, i)) script, err := builder.Script() if err != nil { t.Errorf("StandardPushesTests test #%d unexpected error: %v\n", i, err) continue } - if result := btcscript.IsPushOnlyScript(script); !result { + if result := txscript.IsPushOnlyScript(script); !result { t.Errorf("StandardPushesTests IsPushOnlyScript test #%d failed: %x\n", i, script) continue } - if result := btcscript.HasCanonicalPushes(script); !result { + if result := txscript.HasCanonicalPushes(script); !result { t.Errorf("StandardPushesTests HasCanonicalPushes test #%d failed: %x\n", i, script) continue } @@ -133,16 +133,16 @@ func TestStandardPushes(t *testing.T) { type txTest struct { name string tx *btcwire.MsgTx - pkScript []byte // output script of previous tx - idx int // tx idx to be run. - bip16 bool // is bip16 active? - canonicalSigs bool // should signatures be validated as canonical? - parseErr error // failure of NewScript - err error // Failure of Executre - shouldFail bool // Execute should fail with nonspecified error. - nSigOps int // result of GetPreciseSigOpsCount - scriptInfo btcscript.ScriptInfo // result of ScriptInfo - scriptInfoErr error // error return of ScriptInfo + pkScript []byte // output script of previous tx + idx int // tx idx to be run. + bip16 bool // is bip16 active? + canonicalSigs bool // should signatures be validated as canonical? + parseErr error // failure of NewScript + err error // Failure of Executre + shouldFail bool // Execute should fail with nonspecified error. + nSigOps int // result of GetPreciseSigOpsCount + scriptInfo txscript.ScriptInfo // result of ScriptInfo + scriptInfoErr error // error return of ScriptInfo } var txTests = []txTest{ @@ -168,7 +168,7 @@ var txTests = []txTest{ Index: 0, }, SignatureScript: []uint8{ - btcscript.OP_DATA_71, + txscript.OP_DATA_71, 0x30, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69, 0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, @@ -193,7 +193,7 @@ var txTests = []txTest{ { Value: 1000000000, PkScript: []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, @@ -207,13 +207,13 @@ var txTests = []txTest{ 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, - btcscript.OP_CHECKSIG, + txscript.OP_CHECKSIG, }, }, { Value: 4000000000, PkScript: []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, @@ -227,14 +227,14 @@ var txTests = []txTest{ 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, 0x12, 0xa3, - btcscript.OP_CHECKSIG, + txscript.OP_CHECKSIG, }, }, }, LockTime: 0, }, pkScript: []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, 0x2e, 0x97, 0xb1, 0x48, 0x2e, 0xca, 0xd7, @@ -242,12 +242,12 @@ var txTests = []txTest{ 0xdd, 0xfb, 0x84, 0xcc, 0xf9, 0x74, 0x44, 0x64, 0xf8, 0x2e, 0x16, 0x0b, 0xfa, 0x9b, 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, - 0x12, 0xa3, btcscript.OP_CHECKSIG, + 0x12, 0xa3, txscript.OP_CHECKSIG, }, idx: 0, nSigOps: 1, - scriptInfo: btcscript.ScriptInfo{ - PkScriptClass: btcscript.PubKeyTy, + scriptInfo: txscript.ScriptInfo{ + PkScriptClass: txscript.PubKeyTy, NumInputs: 1, ExpectedInputs: 1, SigOps: 1, @@ -274,7 +274,7 @@ var txTests = []txTest{ Index: 0, }, SignatureScript: []uint8{ - btcscript.OP_DATA_71, + txscript.OP_DATA_71, 0x30, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69, 0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, @@ -299,7 +299,7 @@ var txTests = []txTest{ { Value: 1000000000, PkScript: []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, @@ -313,13 +313,13 @@ var txTests = []txTest{ 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, - btcscript.OP_CHECKSIG, + txscript.OP_CHECKSIG, }, }, { Value: 5000000000, PkScript: []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, @@ -333,14 +333,14 @@ var txTests = []txTest{ 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, 0x12, 0xa3, - btcscript.OP_CHECKSIG, + txscript.OP_CHECKSIG, }, }, }, LockTime: 0, }, pkScript: []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, 0x2e, 0x97, 0xb1, 0x48, 0x2e, 0xca, 0xd7, @@ -348,13 +348,13 @@ var txTests = []txTest{ 0xdd, 0xfb, 0x84, 0xcc, 0xf9, 0x74, 0x44, 0x64, 0xf8, 0x2e, 0x16, 0x0b, 0xfa, 0x9b, 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, - 0x12, 0xa3, btcscript.OP_CHECKSIG, + 0x12, 0xa3, txscript.OP_CHECKSIG, }, idx: 0, - err: btcscript.ErrStackScriptFailed, + err: txscript.ErrStackScriptFailed, nSigOps: 1, - scriptInfo: btcscript.ScriptInfo{ - PkScriptClass: btcscript.PubKeyTy, + scriptInfo: txscript.ScriptInfo{ + PkScriptClass: txscript.PubKeyTy, NumInputs: 1, ExpectedInputs: 1, SigOps: 1, @@ -382,7 +382,7 @@ var txTests = []txTest{ // Signature has length fiddled to // fail parsing. SignatureScript: []uint8{ - btcscript.OP_DATA_71, + txscript.OP_DATA_71, 0x30, 0x45, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69, 0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, @@ -407,7 +407,7 @@ var txTests = []txTest{ { Value: 1000000000, PkScript: []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, @@ -421,13 +421,13 @@ var txTests = []txTest{ 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, - btcscript.OP_CHECKSIG, + txscript.OP_CHECKSIG, }, }, { Value: 4000000000, PkScript: []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, @@ -441,14 +441,14 @@ var txTests = []txTest{ 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, 0x12, 0xa3, - btcscript.OP_CHECKSIG, + txscript.OP_CHECKSIG, }, }, }, LockTime: 0, }, pkScript: []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, 0x2e, 0x97, 0xb1, 0x48, 0x2e, 0xca, 0xd7, @@ -456,13 +456,13 @@ var txTests = []txTest{ 0xdd, 0xfb, 0x84, 0xcc, 0xf9, 0x74, 0x44, 0x64, 0xf8, 0x2e, 0x16, 0x0b, 0xfa, 0x9b, 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, - 0x12, 0xa3, btcscript.OP_CHECKSIG, + 0x12, 0xa3, txscript.OP_CHECKSIG, }, idx: 0, shouldFail: true, nSigOps: 1, - scriptInfo: btcscript.ScriptInfo{ - PkScriptClass: btcscript.PubKeyTy, + scriptInfo: txscript.ScriptInfo{ + PkScriptClass: txscript.PubKeyTy, NumInputs: 1, ExpectedInputs: 1, SigOps: 1, @@ -488,7 +488,7 @@ var txTests = []txTest{ Index: 0, }, SignatureScript: []uint8{ - btcscript.OP_DATA_71, + txscript.OP_DATA_71, 0x30, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69, 0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, @@ -513,7 +513,7 @@ var txTests = []txTest{ { Value: 1000000000, PkScript: []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, @@ -527,13 +527,13 @@ var txTests = []txTest{ 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, - btcscript.OP_CHECKSIG, + txscript.OP_CHECKSIG, }, }, { Value: 4000000000, PkScript: []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, @@ -547,7 +547,7 @@ var txTests = []txTest{ 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, 0x12, 0xa3, - btcscript.OP_CHECKSIG, + txscript.OP_CHECKSIG, }, }, }, @@ -555,7 +555,7 @@ var txTests = []txTest{ }, // pubkey header magic byte has been changed to parse wrong. pkScript: []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x02, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, 0x2e, 0x97, 0xb1, 0x48, 0x2e, 0xca, 0xd7, @@ -563,13 +563,13 @@ var txTests = []txTest{ 0xdd, 0xfb, 0x84, 0xcc, 0xf9, 0x74, 0x44, 0x64, 0xf8, 0x2e, 0x16, 0x0b, 0xfa, 0x9b, 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, - 0x12, 0xa3, btcscript.OP_CHECKSIG, + 0x12, 0xa3, txscript.OP_CHECKSIG, }, idx: 0, shouldFail: true, nSigOps: 1, - scriptInfo: btcscript.ScriptInfo{ - PkScriptClass: btcscript.PubKeyTy, + scriptInfo: txscript.ScriptInfo{ + PkScriptClass: txscript.PubKeyTy, NumInputs: 1, ExpectedInputs: 1, SigOps: 1, @@ -597,7 +597,7 @@ var txTests = []txTest{ Index: 1, }, SignatureScript: []byte{ - btcscript.OP_DATA_71, + txscript.OP_DATA_71, 0x30, 0x44, 0x02, 0x20, 0xbb, 0x4f, 0xbc, 0x49, 0x5a, 0xa2, 0x3b, 0xab, 0xb2, 0xc2, 0xbe, @@ -613,7 +613,7 @@ var txTests = []txTest{ 0x75, 0x67, 0x82, 0xee, 0x6f, 0x8a, 0x22, 0xa9, 0x59, 0xa2, 0x02, - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0xf1, 0x93, 0x9a, 0xe6, 0xb0, 0x1e, 0x84, 0x9b, 0xf0, 0x5d, 0x0e, 0xd5, 0x1f, 0xd5, @@ -635,49 +635,49 @@ var txTests = []txTest{ { Value: 1000000, PkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x66, 0x0d, 0x4e, 0xf3, 0xa7, 0x43, 0xe3, 0xe6, 0x96, 0xad, 0x99, 0x03, 0x64, 0xe5, 0x55, 0xc2, 0x71, 0xad, 0x50, 0x4b, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, }, { Value: 29913632, PkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x21, 0xc4, 0x3c, 0xe4, 0x00, 0x90, 0x13, 0x12, 0xa6, 0x03, 0xe4, 0x20, 0x7a, 0xad, 0xfd, 0x74, 0x2b, 0xe8, 0xe7, 0xda, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, }, }, LockTime: 0, }, pkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x21, 0xc4, 0x3c, 0xe4, 0x00, 0x90, 0x13, 0x12, 0xa6, 0x03, 0xe4, 0x20, 0x7a, 0xad, 0xfd, 0x74, 0x2b, 0xe8, 0xe7, 0xda, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, idx: 0, bip16: true, // after threshold nSigOps: 1, - scriptInfo: btcscript.ScriptInfo{ - PkScriptClass: btcscript.PubKeyHashTy, + scriptInfo: txscript.ScriptInfo{ + PkScriptClass: txscript.PubKeyHashTy, NumInputs: 2, ExpectedInputs: 2, SigOps: 1, @@ -703,7 +703,7 @@ var txTests = []txTest{ Index: 1, }, SignatureScript: []byte{ - btcscript.OP_DATA_71, + txscript.OP_DATA_71, 0x30, 0x44, 0x02, 0x20, 0xa0, 0x42, 0xde, 0xe5, 0x52, 0x6b, 0xf2, 0x29, 0x4d, 0x3f, 0x3e, @@ -719,7 +719,7 @@ var txTests = []txTest{ 0x68, 0x02, 0x6a, 0x97, 0x5c, 0x7d, 0xae, 0x11, 0x2e, 0x4f, 0x01, - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0x49, 0x45, 0x33, 0x18, 0xbd, 0x5e, 0xcf, 0xea, 0x5f, 0x86, 0x32, 0x8c, 0x6d, 0x8e, @@ -751,7 +751,7 @@ var txTests = []txTest{ Index: 1, }, SignatureScript: []byte{ - btcscript.OP_DATA_71, + txscript.OP_DATA_71, 0x30, 0x44, 0x02, 0x20, 0xc3, 0x02, 0x3b, 0xed, 0x85, 0x0d, 0x94, 0x27, 0x8e, 0x06, 0xd2, @@ -767,7 +767,7 @@ var txTests = []txTest{ 0x4a, 0x72, 0x73, 0xeb, 0x5b, 0x8d, 0x1d, 0xd7, 0x02, 0xcc, 0x01, - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0x49, 0x5c, 0x8f, 0x66, 0x90, 0x0d, 0xb7, 0x62, 0x69, 0x0b, 0x54, 0x49, 0xa1, 0xf4, @@ -789,43 +789,43 @@ var txTests = []txTest{ { Value: 630320000, PkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x43, 0xdc, 0x32, 0x1b, 0x66, 0x00, 0x51, 0x1f, 0xe0, 0xa9, 0x6a, 0x97, 0xc2, 0x59, 0x3a, 0x90, 0x54, 0x29, 0x74, 0xd6, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, }, { Value: 100000181, PkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0xa4, 0x05, 0xea, 0x18, 0x09, 0x14, 0xa9, 0x11, 0xd0, 0xb8, 0x07, 0x99, 0x19, 0x2b, 0x0b, 0x84, 0xae, 0x80, 0x1e, 0xbd, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, }, { Value: 596516343, PkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x24, 0x56, 0x76, 0x45, 0x4f, 0x6f, 0xff, 0x28, 0x88, 0x39, 0x47, 0xea, 0x70, 0x23, 0x86, 0x9b, 0x8a, 0x71, 0xa3, 0x05, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, }, }, @@ -833,22 +833,22 @@ var txTests = []txTest{ }, // Test input 0 pkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0xfd, 0xf6, 0xea, 0xe7, 0x10, 0xa0, 0xc4, 0x49, 0x7a, 0x8d, 0x0f, 0xd2, 0x9a, 0xf6, 0x6b, 0xac, 0x94, 0xaf, 0x6c, 0x98, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, idx: 0, canonicalSigs: true, shouldFail: true, nSigOps: 1, - scriptInfo: btcscript.ScriptInfo{ - PkScriptClass: btcscript.PubKeyHashTy, + scriptInfo: txscript.ScriptInfo{ + PkScriptClass: txscript.PubKeyHashTy, NumInputs: 2, ExpectedInputs: 2, SigOps: 1, @@ -877,7 +877,7 @@ var txTests = []txTest{ Index: 1, }, SignatureScript: []byte{ - btcscript.OP_DATA_72, + txscript.OP_DATA_72, 0x30, 0x45, 0x02, 0x20, 0x58, 0x53, 0xc7, 0xf1, 0x39, 0x57, 0x85, 0xbf, 0xab, 0xb0, 0x3c, @@ -893,7 +893,7 @@ var txTests = []txTest{ 0x7d, 0x48, 0x5d, 0xc5, 0x29, 0xaf, 0xc5, 0x16, 0xc2, 0xdd, 0xb4, 0x81, - btcscript.OP_DATA_33, + txscript.OP_DATA_33, 0x03, 0x05, 0x58, 0x49, 0x80, 0x36, 0x7b, 0x32, 0x1f, 0xad, 0x7f, 0x1c, 0x1f, 0x4d, 0x5d, @@ -919,7 +919,7 @@ var txTests = []txTest{ Index: 1, }, SignatureScript: []byte{ - btcscript.OP_DATA_73, + txscript.OP_DATA_73, 0x30, 0x46, 0x02, 0x21, 0x00, 0x82, 0x69, 0xc9, 0xd7, 0xba, 0x0a, 0x7e, 0x73, 0x0d, 0xd1, @@ -935,7 +935,7 @@ var txTests = []txTest{ 0xbc, 0xff, 0x0d, 0x81, 0xd0, 0x5b, 0x39, 0xff, 0x0f, 0x42, 0x17, 0xb2, 0x81, - btcscript.OP_DATA_33, + txscript.OP_DATA_33, 0x03, 0xaa, 0xe3, 0x03, 0xd8, 0x25, 0x42, 0x15, 0x45, 0xc5, 0xbc, 0x7c, 0xcd, 0x5a, 0xc8, @@ -951,35 +951,35 @@ var txTests = []txTest{ { Value: 300000, PkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x5c, 0x11, 0xf9, 0x17, 0x88, 0x3b, 0x92, 0x7e, 0xef, 0x77, 0xdc, 0x57, 0x70, 0x7a, 0xeb, 0x85, 0x3f, 0x6d, 0x38, 0x94, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, }, }, LockTime: 0, }, pkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x85, 0x51, 0xe4, 0x8a, 0x53, 0xde, 0xcd, 0x1c, 0xfc, 0x63, 0x07, 0x9a, 0x45, 0x81, 0xbc, 0xcc, 0xfa, 0xd1, 0xa9, 0x3c, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, idx: 0, bip16: true, // after threshold nSigOps: 1, - scriptInfo: btcscript.ScriptInfo{ - PkScriptClass: btcscript.PubKeyHashTy, + scriptInfo: txscript.ScriptInfo{ + PkScriptClass: txscript.PubKeyHashTy, NumInputs: 2, ExpectedInputs: 2, SigOps: 1, @@ -1007,7 +1007,7 @@ var txTests = []txTest{ Index: 0, }, SignatureScript: []byte{ - btcscript.OP_DATA_71, + txscript.OP_DATA_71, 0x30, 0x44, 0x02, 0x20, 0x02, 0xdb, 0xe4, 0xb5, 0xa2, 0xfb, 0xb5, 0x21, 0xe4, 0xdc, 0x5f, @@ -1045,8 +1045,8 @@ var txTests = []txTest{ Index: 1, }, SignatureScript: []uint8{ - btcscript.OP_FALSE, - btcscript.OP_DATA_72, + txscript.OP_FALSE, + txscript.OP_DATA_72, 0x30, 0x45, 0x02, 0x20, 0x10, 0x6a, 0x3e, 0x4e, 0xf0, 0xb5, 0x1b, 0x76, 0x4a, 0x28, 0x87, @@ -1062,9 +1062,9 @@ var txTests = []txTest{ 0x1f, 0xe0, 0x72, 0x82, 0xe3, 0xb6, 0xec, 0xb5, 0xf3, 0xbb, 0x28, 0x01, - btcscript.OP_CODESEPARATOR, - btcscript.OP_TRUE, - btcscript.OP_DATA_33, + txscript.OP_CODESEPARATOR, + txscript.OP_TRUE, + txscript.OP_DATA_33, 0x02, 0x32, 0xab, 0xdc, 0x89, 0x3e, 0x7f, 0x06, 0x31, 0x36, 0x4d, 0x7f, 0xd0, 0x1c, 0xb3, @@ -1072,8 +1072,8 @@ var txTests = []txTest{ 0x9a, 0x00, 0x35, 0x7b, 0x3a, 0x78, 0x86, 0x21, 0x1a, 0xb4, 0x14, 0xd5, 0x5a, - btcscript.OP_TRUE, - btcscript.OP_CHECKMULTISIG, + txscript.OP_TRUE, + txscript.OP_CHECKMULTISIG, }, Sequence: 4294967295, }, @@ -1082,15 +1082,15 @@ var txTests = []txTest{ { Value: 4800000, PkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x0d, 0x77, 0x13, 0x64, 0x9f, 0x9a, 0x06, 0x78, 0xf4, 0xe8, 0x80, 0xb4, 0x0f, 0x86, 0xb9, 0x32, 0x89, 0xd1, 0xbb, 0x27, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, }, }, @@ -1098,16 +1098,16 @@ var txTests = []txTest{ }, // This is a very weird script... pkScript: []byte{ - btcscript.OP_DATA_20, + txscript.OP_DATA_20, 0x2a, 0x9b, 0xc5, 0x44, 0x7d, 0x66, 0x4c, 0x1d, 0x01, 0x41, 0x39, 0x2a, 0x84, 0x2d, 0x23, 0xdb, 0xa4, 0x5c, 0x4f, 0x13, - btcscript.OP_NOP2, btcscript.OP_DROP, + txscript.OP_NOP2, txscript.OP_DROP, }, idx: 1, bip16: false, nSigOps: 0, // multisig is in the pkScript! - scriptInfoErr: btcscript.ErrStackNonPushOnly, + scriptInfoErr: txscript.ErrStackNonPushOnly, }, // same as previous but with one byte changed to make signature fail { @@ -1130,7 +1130,7 @@ var txTests = []txTest{ Index: 0, }, SignatureScript: []byte{ - btcscript.OP_DATA_71, + txscript.OP_DATA_71, 0x30, 0x44, 0x02, 0x20, 0x02, 0xdb, 0xe4, 0xb5, 0xa2, 0xfb, 0xb5, 0x21, 0xe4, 0xdc, 0x5f, @@ -1168,8 +1168,8 @@ var txTests = []txTest{ Index: 1, }, SignatureScript: []uint8{ - btcscript.OP_FALSE, - btcscript.OP_DATA_72, + txscript.OP_FALSE, + txscript.OP_DATA_72, 0x30, 0x45, 0x02, 0x20, 0x10, 0x6a, 0x3e, 0x4e, 0xf0, 0xb5, 0x1b, 0x76, 0x4a, 0x28, 0x87, @@ -1185,9 +1185,9 @@ var txTests = []txTest{ 0x1f, 0xe0, 0x72, 0x82, 0xe3, 0xb6, 0xec, 0xb5, 0xf3, 0xbb, 0x28, 0x01, - btcscript.OP_CODESEPARATOR, - btcscript.OP_TRUE, - btcscript.OP_DATA_33, + txscript.OP_CODESEPARATOR, + txscript.OP_TRUE, + txscript.OP_DATA_33, 0x02, 0x32, 0xab, 0xdc, 0x89, 0x3e, 0x7f, 0x06, 0x31, 0x36, 0x4d, 0x7f, 0xd0, 0x1c, 0xb3, @@ -1195,8 +1195,8 @@ var txTests = []txTest{ 0x9a, 0x00, 0x35, 0x7b, 0x3a, 0x78, 0x86, 0x21, 0x1a, 0xb4, 0x14, 0xd5, 0x5a, - btcscript.OP_TRUE, - btcscript.OP_CHECKMULTISIG, + txscript.OP_TRUE, + txscript.OP_CHECKMULTISIG, }, Sequence: 4294967295, }, @@ -1205,15 +1205,15 @@ var txTests = []txTest{ { Value: 5800000, PkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x0d, 0x77, 0x13, 0x64, 0x9f, 0x9a, 0x06, 0x78, 0xf4, 0xe8, 0x80, 0xb4, 0x0f, 0x86, 0xb9, 0x32, 0x89, 0xd1, 0xbb, 0x27, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, }, }, @@ -1221,17 +1221,17 @@ var txTests = []txTest{ }, // This is a very weird script... pkScript: []byte{ - btcscript.OP_DATA_20, + txscript.OP_DATA_20, 0x2a, 0x9b, 0xc5, 0x44, 0x7d, 0x66, 0x4c, 0x1d, 0x01, 0x41, 0x39, 0x2a, 0x84, 0x2d, 0x23, 0xdb, 0xa4, 0x5c, 0x4f, 0x13, - btcscript.OP_NOP2, btcscript.OP_DROP, + txscript.OP_NOP2, txscript.OP_DROP, }, idx: 1, bip16: false, - err: btcscript.ErrStackScriptFailed, + err: txscript.ErrStackScriptFailed, nSigOps: 0, // multisig is in the pkScript! - scriptInfoErr: btcscript.ErrStackNonPushOnly, + scriptInfoErr: txscript.ErrStackNonPushOnly, }, // taken from tx b2d93dfd0b2c1a380e55e76a8d9cb3075dec9f4474e9485be008c337fd62c1f7 // on testnet @@ -1256,10 +1256,10 @@ var txTests = []txTest{ Index: 0, }, SignatureScript: []byte{ - btcscript.OP_0, - btcscript.OP_DATA_37, - btcscript.OP_0, - btcscript.OP_DATA_33, + txscript.OP_0, + txscript.OP_DATA_37, + txscript.OP_0, + txscript.OP_DATA_33, 0x02, 0x4a, 0xb3, 0x3c, 0x3a, 0x54, 0x7a, 0x37, 0x29, 0x3e, 0xb8, 0x75, 0xb4, 0xbb, 0xdb, @@ -1267,8 +1267,8 @@ var txTests = []txTest{ 0xfd, 0xf3, 0x56, 0x87, 0xe7, 0x97, 0x44, 0xdc, 0xd7, 0x0f, 0x6e, 0x4d, 0xe2, - btcscript.OP_1, - btcscript.OP_CHECKMULTISIG, + txscript.OP_1, + txscript.OP_CHECKMULTISIG, }, Sequence: 4294967295, }, @@ -1277,18 +1277,18 @@ var txTests = []txTest{ LockTime: 0, }, pkScript: []byte{ - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x2c, 0x6b, 0x10, 0x7f, 0xdf, 0x10, 0x6f, 0x22, 0x6f, 0x3f, 0xa3, 0x27, 0xba, 0x36, 0xd6, 0xe3, 0xca, 0xc7, 0x3d, 0xf0, - btcscript.OP_EQUAL, + txscript.OP_EQUAL, }, idx: 0, bip16: true, nSigOps: 1, - scriptInfo: btcscript.ScriptInfo{ - PkScriptClass: btcscript.ScriptHashTy, + scriptInfo: txscript.ScriptInfo{ + PkScriptClass: txscript.ScriptHashTy, NumInputs: 2, ExpectedInputs: 2, SigOps: 1, @@ -1316,7 +1316,7 @@ var txTests = []txTest{ Index: 0, }, SignatureScript: []byte{ - btcscript.OP_DATA_2, + txscript.OP_DATA_2, // OP_3 OP_7 0x53, 0x57, }, @@ -1327,33 +1327,33 @@ var txTests = []txTest{ { Value: 1000000, PkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x5b, 0x69, 0xd8, 0xb9, 0xdf, 0xa6, 0xe4, 0x12, 0x26, 0x47, 0xe1, 0x79, 0x4e, 0xaa, 0x3b, 0xfc, 0x11, 0x1f, 0x70, 0xef, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, }, }, LockTime: 0, }, pkScript: []byte{ - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x43, 0x3e, 0xc2, 0xac, 0x1f, 0xfa, 0x1b, 0x7b, 0x7d, 0x02, 0x7f, 0x56, 0x45, 0x29, 0xc5, 0x71, 0x97, 0xf9, 0xae, 0x88, - btcscript.OP_EQUAL, + txscript.OP_EQUAL, }, idx: 0, bip16: true, nSigOps: 0, // no signature ops in the pushed script. - scriptInfo: btcscript.ScriptInfo{ - PkScriptClass: btcscript.ScriptHashTy, + scriptInfo: txscript.ScriptInfo{ + PkScriptClass: txscript.ScriptHashTy, NumInputs: 1, ExpectedInputs: -1, // p2sh script is non standard SigOps: 0, @@ -1382,7 +1382,7 @@ var txTests = []txTest{ Index: 0, }, SignatureScript: []byte{ - btcscript.OP_DATA_2, + txscript.OP_DATA_2, // OP_3 OP_8 0x53, 0x58, }, @@ -1393,34 +1393,34 @@ var txTests = []txTest{ { Value: 1000000, PkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x5b, 0x69, 0xd8, 0xb9, 0xdf, 0xa6, 0xe4, 0x12, 0x26, 0x47, 0xe1, 0x79, 0x4e, 0xaa, 0x3b, 0xfc, 0x11, 0x1f, 0x70, 0xef, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, }, }, LockTime: 0, }, pkScript: []byte{ - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x43, 0x3e, 0xc2, 0xac, 0x1f, 0xfa, 0x1b, 0x7b, 0x7d, 0x02, 0x7f, 0x56, 0x45, 0x29, 0xc5, 0x71, 0x97, 0xf9, 0xae, 0x88, - btcscript.OP_EQUAL, + txscript.OP_EQUAL, }, idx: 0, - err: btcscript.ErrStackScriptFailed, + err: txscript.ErrStackScriptFailed, bip16: true, nSigOps: 0, // no signature ops in the pushed script. - scriptInfo: btcscript.ScriptInfo{ - PkScriptClass: btcscript.ScriptHashTy, + scriptInfo: txscript.ScriptInfo{ + PkScriptClass: txscript.ScriptHashTy, NumInputs: 1, ExpectedInputs: -1, // p2sh script is non standard SigOps: 0, @@ -1447,9 +1447,9 @@ var txTests = []txTest{ Index: 0, }, SignatureScript: []byte{ - btcscript.OP_DATA_2, + txscript.OP_DATA_2, // pushed script. - btcscript.OP_DATA_2, 0x1, + txscript.OP_DATA_2, 0x1, }, Sequence: 4294967295, }, @@ -1458,32 +1458,32 @@ var txTests = []txTest{ { Value: 1000000, PkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x5b, 0x69, 0xd8, 0xb9, 0xdf, 0xa6, 0xe4, 0x12, 0x26, 0x47, 0xe1, 0x79, 0x4e, 0xaa, 0x3b, 0xfc, 0x11, 0x1f, 0x70, 0xef, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, }, }, LockTime: 0, }, pkScript: []byte{ - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0xd4, 0x8c, 0xe8, 0x6c, 0x69, 0x8f, 0x24, 0x68, 0x29, 0x92, 0x1b, 0xa9, 0xfb, 0x2a, 0x84, 0x4a, 0xe2, 0xad, 0xba, 0x67, - btcscript.OP_EQUAL, + txscript.OP_EQUAL, }, idx: 0, - err: btcscript.ErrStackShortScript, + err: txscript.ErrStackShortScript, bip16: true, - scriptInfoErr: btcscript.ErrStackShortScript, + scriptInfoErr: txscript.ErrStackShortScript, }, { // sigscript changed so to be non pushonly. @@ -1509,10 +1509,10 @@ var txTests = []txTest{ // will never run. SignatureScript: []byte{ - btcscript.OP_DATA_2, + txscript.OP_DATA_2, // pushed script. - btcscript.OP_DATA_1, 0x1, - btcscript.OP_DUP, + txscript.OP_DATA_1, 0x1, + txscript.OP_DUP, }, Sequence: 4294967295, }, @@ -1521,33 +1521,33 @@ var txTests = []txTest{ { Value: 1000000, PkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x5b, 0x69, 0xd8, 0xb9, 0xdf, 0xa6, 0xe4, 0x12, 0x26, 0x47, 0xe1, 0x79, 0x4e, 0xaa, 0x3b, 0xfc, 0x11, 0x1f, 0x70, 0xef, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, }, }, LockTime: 0, }, pkScript: []byte{ - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x43, 0x3e, 0xc2, 0xac, 0x1f, 0xfa, 0x1b, 0x7b, 0x7d, 0x02, 0x7f, 0x56, 0x45, 0x29, 0xc5, 0x71, 0x97, 0xf9, 0xae, 0x88, - btcscript.OP_EQUAL, + txscript.OP_EQUAL, }, idx: 0, - parseErr: btcscript.ErrStackP2SHNonPushOnly, + parseErr: txscript.ErrStackP2SHNonPushOnly, bip16: true, nSigOps: 0, // no signature ops in the pushed script. - scriptInfoErr: btcscript.ErrStackNonPushOnly, + scriptInfoErr: txscript.ErrStackNonPushOnly, }, { // sigscript changed so to be non pushonly. @@ -1572,7 +1572,7 @@ var txTests = []txTest{ // doesn't have to match signature. // will never run. SignatureScript: []byte{ - btcscript.OP_TRUE, + txscript.OP_TRUE, }, Sequence: 4294967295, }, @@ -1581,15 +1581,15 @@ var txTests = []txTest{ { Value: 1000000, PkScript: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x5b, 0x69, 0xd8, 0xb9, 0xdf, 0xa6, 0xe4, 0x12, 0x26, 0x47, 0xe1, 0x79, 0x4e, 0xaa, 0x3b, 0xfc, 0x11, 0x1f, 0x70, 0xef, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, }, }, @@ -1599,8 +1599,8 @@ var txTests = []txTest{ idx: 0, bip16: true, nSigOps: 0, // no signature ops in the pushed script. - scriptInfo: btcscript.ScriptInfo{ - PkScriptClass: btcscript.NonStandardTy, + scriptInfo: txscript.ScriptInfo{ + PkScriptClass: txscript.NonStandardTy, NumInputs: 1, ExpectedInputs: -1, SigOps: 0, @@ -1615,14 +1615,14 @@ var txTests = []txTest{ // nothing in the blockchain that we have yet seen uses them, making it hard // to confirm we implemented the spec correctly. func testTx(t *testing.T, test txTest) { - var flags btcscript.ScriptFlags + var flags txscript.ScriptFlags if test.bip16 { - flags |= btcscript.ScriptBip16 + flags |= txscript.ScriptBip16 } if test.canonicalSigs { - flags |= btcscript.ScriptCanonicalSignatures + flags |= txscript.ScriptCanonicalSignatures } - engine, err := btcscript.NewScript( + engine, err := txscript.NewScript( test.tx.TxIn[test.idx].SignatureScript, test.pkScript, test.idx, test.tx, flags) if err != nil { @@ -1669,7 +1669,7 @@ func TestGetPreciseSignOps(t *testing.T) { // First we go over the range of tests in testTx and count the sigops in // them. for _, test := range txTests { - count := btcscript.GetPreciseSigOpCount( + count := txscript.GetPreciseSigOpCount( test.tx.TxIn[test.idx].SignatureScript, test.pkScript, test.bip16) if count != test.nSigOps { @@ -1691,12 +1691,12 @@ func TestGetPreciseSignOps(t *testing.T) { psocTests := []psocTest{ { name: "scriptSig doesn't parse", - scriptSig: []byte{btcscript.OP_PUSHDATA1, 2}, - err: btcscript.ErrStackShortScript, + scriptSig: []byte{txscript.OP_PUSHDATA1, 2}, + err: txscript.ErrStackShortScript, }, { name: "scriptSig isn't push only", - scriptSig: []byte{btcscript.OP_1, btcscript.OP_DUP}, + scriptSig: []byte{txscript.OP_1, txscript.OP_DUP}, nSigOps: 0, }, { @@ -1707,30 +1707,30 @@ func TestGetPreciseSignOps(t *testing.T) { { name: "No script at the end", // No script at end but still push only. - scriptSig: []byte{btcscript.OP_1, btcscript.OP_1}, + scriptSig: []byte{txscript.OP_1, txscript.OP_1}, nSigOps: 0, }, // pushed script doesn't parse. { name: "pushed script doesn't parse", - scriptSig: []byte{btcscript.OP_DATA_2, - btcscript.OP_PUSHDATA1, 2}, - err: btcscript.ErrStackShortScript, + scriptSig: []byte{txscript.OP_DATA_2, + txscript.OP_PUSHDATA1, 2}, + err: txscript.ErrStackShortScript, }, } // The signature in the p2sh script is nonsensical for the tests since // this script will never be executed. What matters is that it matches // the right pattern. pkScript := []byte{ - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x43, 0x3e, 0xc2, 0xac, 0x1f, 0xfa, 0x1b, 0x7b, 0x7d, 0x02, 0x7f, 0x56, 0x45, 0x29, 0xc5, 0x71, 0x97, 0xf9, 0xae, 0x88, - btcscript.OP_EQUAL, + txscript.OP_EQUAL, } for _, test := range psocTests { - count := btcscript.GetPreciseSigOpCount( + count := txscript.GetPreciseSigOpCount( test.scriptSig, pkScript, true) if count != test.nSigOps { t.Errorf("%s: expected count of %d, got %d", test.name, @@ -1745,7 +1745,7 @@ type scriptInfoTest struct { sigScript []byte pkScript []byte bip16 bool - scriptInfo btcscript.ScriptInfo + scriptInfo txscript.ScriptInfo scriptInfoErr error } @@ -1753,7 +1753,7 @@ func TestScriptInfo(t *testing.T) { t.Parallel() for _, test := range txTests { - si, err := btcscript.CalcScriptInfo( + si, err := txscript.CalcScriptInfo( test.tx.TxIn[test.idx].SignatureScript, test.pkScript, test.bip16) if err != nil { @@ -1781,65 +1781,65 @@ func TestScriptInfo(t *testing.T) { { // Invented scripts, the hashes do not match name: "pkscript doesn't parse", - sigScript: []byte{btcscript.OP_TRUE, - btcscript.OP_DATA_1, 81, - btcscript.OP_DATA_8, - btcscript.OP_2DUP, btcscript.OP_EQUAL, - btcscript.OP_NOT, btcscript.OP_VERIFY, - btcscript.OP_ABS, btcscript.OP_SWAP, - btcscript.OP_ABS, btcscript.OP_EQUAL, + sigScript: []byte{txscript.OP_TRUE, + txscript.OP_DATA_1, 81, + txscript.OP_DATA_8, + txscript.OP_2DUP, txscript.OP_EQUAL, + txscript.OP_NOT, txscript.OP_VERIFY, + txscript.OP_ABS, txscript.OP_SWAP, + txscript.OP_ABS, txscript.OP_EQUAL, }, // truncated version of test below: - pkScript: []byte{btcscript.OP_HASH160, - btcscript.OP_DATA_20, + pkScript: []byte{txscript.OP_HASH160, + txscript.OP_DATA_20, 0xfe, 0x44, 0x10, 0x65, 0xb6, 0x53, 0x22, 0x31, 0xde, 0x2f, 0xac, 0x56, 0x31, 0x52, 0x20, 0x5e, 0xc4, 0xf5, 0x9c, }, bip16: true, - scriptInfoErr: btcscript.ErrStackShortScript, + scriptInfoErr: txscript.ErrStackShortScript, }, { name: "sigScript doesn't parse", // Truncated version of p2sh script below. - sigScript: []byte{btcscript.OP_TRUE, - btcscript.OP_DATA_1, 81, - btcscript.OP_DATA_8, - btcscript.OP_2DUP, btcscript.OP_EQUAL, - btcscript.OP_NOT, btcscript.OP_VERIFY, - btcscript.OP_ABS, btcscript.OP_SWAP, - btcscript.OP_ABS, + sigScript: []byte{txscript.OP_TRUE, + txscript.OP_DATA_1, 81, + txscript.OP_DATA_8, + txscript.OP_2DUP, txscript.OP_EQUAL, + txscript.OP_NOT, txscript.OP_VERIFY, + txscript.OP_ABS, txscript.OP_SWAP, + txscript.OP_ABS, }, - pkScript: []byte{btcscript.OP_HASH160, - btcscript.OP_DATA_20, + pkScript: []byte{txscript.OP_HASH160, + txscript.OP_DATA_20, 0xfe, 0x44, 0x10, 0x65, 0xb6, 0x53, 0x22, 0x31, 0xde, 0x2f, 0xac, 0x56, 0x31, 0x52, 0x20, 0x5e, - 0xc4, 0xf5, 0x9c, 0x74, btcscript.OP_EQUAL, + 0xc4, 0xf5, 0x9c, 0x74, txscript.OP_EQUAL, }, bip16: true, - scriptInfoErr: btcscript.ErrStackShortScript, + scriptInfoErr: txscript.ErrStackShortScript, }, { // Invented scripts, the hashes do not match name: "p2sh standard script", - sigScript: []byte{btcscript.OP_TRUE, - btcscript.OP_DATA_1, 81, - btcscript.OP_DATA_25, - btcscript.OP_DUP, btcscript.OP_HASH160, - btcscript.OP_DATA_20, 0x1, 0x2, 0x3, 0x4, 0x5, + sigScript: []byte{txscript.OP_TRUE, + txscript.OP_DATA_1, 81, + txscript.OP_DATA_25, + txscript.OP_DUP, txscript.OP_HASH160, + txscript.OP_DATA_20, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, - btcscript.OP_EQUALVERIFY, btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, txscript.OP_CHECKSIG, }, - pkScript: []byte{btcscript.OP_HASH160, - btcscript.OP_DATA_20, + pkScript: []byte{txscript.OP_HASH160, + txscript.OP_DATA_20, 0xfe, 0x44, 0x10, 0x65, 0xb6, 0x53, 0x22, 0x31, 0xde, 0x2f, 0xac, 0x56, 0x31, 0x52, 0x20, 0x5e, - 0xc4, 0xf5, 0x9c, 0x74, btcscript.OP_EQUAL, + 0xc4, 0xf5, 0x9c, 0x74, txscript.OP_EQUAL, }, bip16: true, - scriptInfo: btcscript.ScriptInfo{ - PkScriptClass: btcscript.ScriptHashTy, + scriptInfo: txscript.ScriptInfo{ + PkScriptClass: txscript.ScriptHashTy, NumInputs: 3, ExpectedInputs: 3, // nonstandard p2sh. SigOps: 1, @@ -1849,23 +1849,23 @@ func TestScriptInfo(t *testing.T) { // from 567a53d1ce19ce3d07711885168484439965501536d0d0294c5d46d46c10e53b // from the blockchain. name: "p2sh nonstandard script", - sigScript: []byte{btcscript.OP_TRUE, - btcscript.OP_DATA_1, 81, - btcscript.OP_DATA_8, - btcscript.OP_2DUP, btcscript.OP_EQUAL, - btcscript.OP_NOT, btcscript.OP_VERIFY, - btcscript.OP_ABS, btcscript.OP_SWAP, - btcscript.OP_ABS, btcscript.OP_EQUAL, + sigScript: []byte{txscript.OP_TRUE, + txscript.OP_DATA_1, 81, + txscript.OP_DATA_8, + txscript.OP_2DUP, txscript.OP_EQUAL, + txscript.OP_NOT, txscript.OP_VERIFY, + txscript.OP_ABS, txscript.OP_SWAP, + txscript.OP_ABS, txscript.OP_EQUAL, }, - pkScript: []byte{btcscript.OP_HASH160, - btcscript.OP_DATA_20, + pkScript: []byte{txscript.OP_HASH160, + txscript.OP_DATA_20, 0xfe, 0x44, 0x10, 0x65, 0xb6, 0x53, 0x22, 0x31, 0xde, 0x2f, 0xac, 0x56, 0x31, 0x52, 0x20, 0x5e, - 0xc4, 0xf5, 0x9c, 0x74, btcscript.OP_EQUAL, + 0xc4, 0xf5, 0x9c, 0x74, txscript.OP_EQUAL, }, bip16: true, - scriptInfo: btcscript.ScriptInfo{ - PkScriptClass: btcscript.ScriptHashTy, + scriptInfo: txscript.ScriptInfo{ + PkScriptClass: txscript.ScriptHashTy, NumInputs: 3, ExpectedInputs: -1, // nonstandard p2sh. SigOps: 0, @@ -1874,31 +1874,31 @@ func TestScriptInfo(t *testing.T) { { // Script is invented, numbers all fake. name: "multisig script", - sigScript: []byte{btcscript.OP_TRUE, - btcscript.OP_TRUE, btcscript.OP_TRUE, - btcscript.OP_0, // Extra arg for OP_CHECKMULTISIG bug + sigScript: []byte{txscript.OP_TRUE, + txscript.OP_TRUE, txscript.OP_TRUE, + txscript.OP_0, // Extra arg for OP_CHECKMULTISIG bug }, pkScript: []byte{ - btcscript.OP_3, btcscript.OP_DATA_33, + txscript.OP_3, txscript.OP_DATA_33, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, - btcscript.OP_DATA_33, + txscript.OP_DATA_33, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, - btcscript.OP_DATA_33, + txscript.OP_DATA_33, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, - btcscript.OP_3, btcscript.OP_CHECKMULTISIG, + txscript.OP_3, txscript.OP_CHECKMULTISIG, }, bip16: true, - scriptInfo: btcscript.ScriptInfo{ - PkScriptClass: btcscript.MultiSigTy, + scriptInfo: txscript.ScriptInfo{ + PkScriptClass: txscript.MultiSigTy, NumInputs: 4, ExpectedInputs: 4, SigOps: 3, @@ -1907,7 +1907,7 @@ func TestScriptInfo(t *testing.T) { } for _, test := range extraTests { - si, err := btcscript.CalcScriptInfo(test.sigScript, + si, err := txscript.CalcScriptInfo(test.sigScript, test.pkScript, test.bip16) if err != nil { if err != test.scriptInfoErr { @@ -1944,50 +1944,50 @@ var removeOpcodeTests = []removeOpcodeTest{ // Nothing to remove. { name: "nothing to remove", - before: []byte{btcscript.OP_NOP}, - remove: btcscript.OP_CODESEPARATOR, - after: []byte{btcscript.OP_NOP}, + before: []byte{txscript.OP_NOP}, + remove: txscript.OP_CODESEPARATOR, + after: []byte{txscript.OP_NOP}, }, // Test basic opcode removal { name: "codeseparator 1", - before: []byte{btcscript.OP_NOP, btcscript.OP_CODESEPARATOR, - btcscript.OP_TRUE}, - remove: btcscript.OP_CODESEPARATOR, - after: []byte{btcscript.OP_NOP, btcscript.OP_TRUE}, + before: []byte{txscript.OP_NOP, txscript.OP_CODESEPARATOR, + txscript.OP_TRUE}, + remove: txscript.OP_CODESEPARATOR, + after: []byte{txscript.OP_NOP, txscript.OP_TRUE}, }, // The opcode in question is actually part of the data in a previous // opcode { name: "codeseparator by coincidence", - before: []byte{btcscript.OP_NOP, btcscript.OP_DATA_1, btcscript.OP_CODESEPARATOR, - btcscript.OP_TRUE}, - remove: btcscript.OP_CODESEPARATOR, - after: []byte{btcscript.OP_NOP, btcscript.OP_DATA_1, btcscript.OP_CODESEPARATOR, - btcscript.OP_TRUE}, + before: []byte{txscript.OP_NOP, txscript.OP_DATA_1, txscript.OP_CODESEPARATOR, + txscript.OP_TRUE}, + remove: txscript.OP_CODESEPARATOR, + after: []byte{txscript.OP_NOP, txscript.OP_DATA_1, txscript.OP_CODESEPARATOR, + txscript.OP_TRUE}, }, { name: "invalid opcode", - before: []byte{btcscript.OP_UNKNOWN186}, - remove: btcscript.OP_CODESEPARATOR, - after: []byte{btcscript.OP_UNKNOWN186}, + before: []byte{txscript.OP_UNKNOWN186}, + remove: txscript.OP_CODESEPARATOR, + after: []byte{txscript.OP_UNKNOWN186}, }, { name: "invalid length (insruction)", - before: []byte{btcscript.OP_PUSHDATA1}, - remove: btcscript.OP_CODESEPARATOR, - err: btcscript.ErrStackShortScript, + before: []byte{txscript.OP_PUSHDATA1}, + remove: txscript.OP_CODESEPARATOR, + err: txscript.ErrStackShortScript, }, { name: "invalid length (data)", - before: []byte{btcscript.OP_PUSHDATA1, 255, 254}, - remove: btcscript.OP_CODESEPARATOR, - err: btcscript.ErrStackShortScript, + before: []byte{txscript.OP_PUSHDATA1, 255, 254}, + remove: txscript.OP_CODESEPARATOR, + err: txscript.ErrStackShortScript, }, } func testRemoveOpcode(t *testing.T, test *removeOpcodeTest) { - result, err := btcscript.TstRemoveOpcode(test.before, test.remove) + result, err := txscript.TstRemoveOpcode(test.before, test.remove) if test.err != nil { if err != test.err { t.Errorf("%s: got unexpected error. exp: \"%v\" "+ @@ -2024,110 +2024,110 @@ type removeOpcodeByDataTest struct { var removeOpcodeByDataTests = []removeOpcodeByDataTest{ { name: "nothing to do", - before: []byte{btcscript.OP_NOP}, + before: []byte{txscript.OP_NOP}, remove: []byte{1, 2, 3, 4}, - after: []byte{btcscript.OP_NOP}, + after: []byte{txscript.OP_NOP}, }, { name: "simple case", - before: []byte{btcscript.OP_DATA_4, 1, 2, 3, 4}, + before: []byte{txscript.OP_DATA_4, 1, 2, 3, 4}, remove: []byte{1, 2, 3, 4}, after: []byte{}, }, { name: "simple case (miss)", - before: []byte{btcscript.OP_DATA_4, 1, 2, 3, 4}, + before: []byte{txscript.OP_DATA_4, 1, 2, 3, 4}, remove: []byte{1, 2, 3, 5}, - after: []byte{btcscript.OP_DATA_4, 1, 2, 3, 4}, + after: []byte{txscript.OP_DATA_4, 1, 2, 3, 4}, }, { // padded to keep it canonical. name: "simple case (pushdata1)", - before: append(append([]byte{btcscript.OP_PUSHDATA1, 76}, + before: append(append([]byte{txscript.OP_PUSHDATA1, 76}, bytes.Repeat([]byte{0}, 72)...), []byte{1, 2, 3, 4}...), remove: []byte{1, 2, 3, 4}, after: []byte{}, }, { name: "simple case (pushdata1 miss)", - before: append(append([]byte{btcscript.OP_PUSHDATA1, 76}, + before: append(append([]byte{txscript.OP_PUSHDATA1, 76}, bytes.Repeat([]byte{0}, 72)...), []byte{1, 2, 3, 4}...), remove: []byte{1, 2, 3, 5}, - after: append(append([]byte{btcscript.OP_PUSHDATA1, 76}, + after: append(append([]byte{txscript.OP_PUSHDATA1, 76}, bytes.Repeat([]byte{0}, 72)...), []byte{1, 2, 3, 4}...), }, { name: "simple case (pushdata1 miss noncanonical)", - before: []byte{btcscript.OP_PUSHDATA1, 4, 1, 2, 3, 4}, + before: []byte{txscript.OP_PUSHDATA1, 4, 1, 2, 3, 4}, remove: []byte{1, 2, 3, 4}, - after: []byte{btcscript.OP_PUSHDATA1, 4, 1, 2, 3, 4}, + after: []byte{txscript.OP_PUSHDATA1, 4, 1, 2, 3, 4}, }, { name: "simple case (pushdata2)", - before: append(append([]byte{btcscript.OP_PUSHDATA2, 0, 1}, + before: append(append([]byte{txscript.OP_PUSHDATA2, 0, 1}, bytes.Repeat([]byte{0}, 252)...), []byte{1, 2, 3, 4}...), remove: []byte{1, 2, 3, 4}, after: []byte{}, }, { name: "simple case (pushdata2 miss)", - before: append(append([]byte{btcscript.OP_PUSHDATA2, 0, 1}, + before: append(append([]byte{txscript.OP_PUSHDATA2, 0, 1}, bytes.Repeat([]byte{0}, 252)...), []byte{1, 2, 3, 4}...), remove: []byte{1, 2, 3, 4, 5}, - after: append(append([]byte{btcscript.OP_PUSHDATA2, 0, 1}, + after: append(append([]byte{txscript.OP_PUSHDATA2, 0, 1}, bytes.Repeat([]byte{0}, 252)...), []byte{1, 2, 3, 4}...), }, { name: "simple case (pushdata2 miss noncanonical)", - before: []byte{btcscript.OP_PUSHDATA2, 4, 0, 1, 2, 3, 4}, + before: []byte{txscript.OP_PUSHDATA2, 4, 0, 1, 2, 3, 4}, remove: []byte{1, 2, 3, 4}, - after: []byte{btcscript.OP_PUSHDATA2, 4, 0, 1, 2, 3, 4}, + after: []byte{txscript.OP_PUSHDATA2, 4, 0, 1, 2, 3, 4}, }, { // This is padded to make the push canonical. name: "simple case (pushdata4)", - before: append(append([]byte{btcscript.OP_PUSHDATA4, 0, 0, 1, 0}, + before: append(append([]byte{txscript.OP_PUSHDATA4, 0, 0, 1, 0}, bytes.Repeat([]byte{0}, 65532)...), []byte{1, 2, 3, 4}...), remove: []byte{1, 2, 3, 4}, after: []byte{}, }, { name: "simple case (pushdata4 miss noncanonical)", - before: []byte{btcscript.OP_PUSHDATA4, 4, 0, 0, 0, 1, 2, 3, 4}, + before: []byte{txscript.OP_PUSHDATA4, 4, 0, 0, 0, 1, 2, 3, 4}, remove: []byte{1, 2, 3, 4}, - after: []byte{btcscript.OP_PUSHDATA4, 4, 0, 0, 0, 1, 2, 3, 4}, + after: []byte{txscript.OP_PUSHDATA4, 4, 0, 0, 0, 1, 2, 3, 4}, }, { // This is padded to make the push canonical. name: "simple case (pushdata4 miss)", - before: append(append([]byte{btcscript.OP_PUSHDATA4, 0, 0, 1, 0}, + before: append(append([]byte{txscript.OP_PUSHDATA4, 0, 0, 1, 0}, bytes.Repeat([]byte{0}, 65532)...), []byte{1, 2, 3, 4}...), remove: []byte{1, 2, 3, 4, 5}, - after: append(append([]byte{btcscript.OP_PUSHDATA4, 0, 0, 1, 0}, + after: append(append([]byte{txscript.OP_PUSHDATA4, 0, 0, 1, 0}, bytes.Repeat([]byte{0}, 65532)...), []byte{1, 2, 3, 4}...), }, { name: "invalid opcode ", - before: []byte{btcscript.OP_UNKNOWN187}, + before: []byte{txscript.OP_UNKNOWN187}, remove: []byte{1, 2, 3, 4}, - after: []byte{btcscript.OP_UNKNOWN187}, + after: []byte{txscript.OP_UNKNOWN187}, }, { name: "invalid length (instruction)", - before: []byte{btcscript.OP_PUSHDATA1}, + before: []byte{txscript.OP_PUSHDATA1}, remove: []byte{1, 2, 3, 4}, - err: btcscript.ErrStackShortScript, + err: txscript.ErrStackShortScript, }, { name: "invalid length (data)", - before: []byte{btcscript.OP_PUSHDATA1, 255, 254}, + before: []byte{txscript.OP_PUSHDATA1, 255, 254}, remove: []byte{1, 2, 3, 4}, - err: btcscript.ErrStackShortScript, + err: txscript.ErrStackShortScript, }, } func testRemoveOpcodeByData(t *testing.T, test *removeOpcodeByDataTest) { - result, err := btcscript.TstRemoveOpcodeByData(test.before, + result, err := txscript.TstRemoveOpcodeByData(test.before, test.remove) if test.err != nil { if err != test.err { @@ -2158,7 +2158,7 @@ func TestRemoveOpcodeByDatas(t *testing.T) { type scriptTypeTest struct { name string script []byte - scripttype btcscript.ScriptClass + scripttype txscript.ScriptClass } var scriptTypeTests = []scriptTypeTest{ @@ -2166,7 +2166,7 @@ var scriptTypeTests = []scriptTypeTest{ { name: "Pay Pubkey", script: []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, 0x2e, 0x97, 0xb1, 0x48, 0x2e, 0xca, 0xd7, @@ -2175,24 +2175,24 @@ var scriptTypeTests = []scriptTypeTest{ 0x2e, 0x16, 0x0b, 0xfa, 0x9b, 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, 0x12, 0xa3, - btcscript.OP_CHECKSIG, + txscript.OP_CHECKSIG, }, - scripttype: btcscript.PubKeyTy, + scripttype: txscript.PubKeyTy, }, // tx 599e47a8114fe098103663029548811d2651991b62397e057f0c863c2bc9f9ea { name: "Pay PubkeyHash", script: []byte{ - btcscript.OP_DUP, - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_DUP, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x66, 0x0d, 0x4e, 0xf3, 0xa7, 0x43, 0xe3, 0xe6, 0x96, 0xad, 0x99, 0x03, 0x64, 0xe5, 0x55, 0xc2, 0x71, 0xad, 0x50, 0x4b, - btcscript.OP_EQUALVERIFY, - btcscript.OP_CHECKSIG, + txscript.OP_EQUALVERIFY, + txscript.OP_CHECKSIG, }, - scripttype: btcscript.PubKeyHashTy, + scripttype: txscript.PubKeyHashTy, }, // part of tx 6d36bc17e947ce00bb6f12f8e7a56a1585c5a36188ffa2b05e10b4743273a74b // codeseparator parts have been elided. (bitcoind's checks for multisig @@ -2200,55 +2200,55 @@ var scriptTypeTests = []scriptTypeTest{ { name: "multisig", script: []byte{ - btcscript.OP_TRUE, - btcscript.OP_DATA_33, + txscript.OP_TRUE, + txscript.OP_DATA_33, 0x02, 0x32, 0xab, 0xdc, 0x89, 0x3e, 0x7f, 0x06, 0x31, 0x36, 0x4d, 0x7f, 0xd0, 0x1c, 0xb3, 0x3d, 0x24, 0xda, 0x45, 0x32, 0x9a, 0x00, 0x35, 0x7b, 0x3a, 0x78, 0x86, 0x21, 0x1a, 0xb4, 0x14, 0xd5, 0x5a, - btcscript.OP_TRUE, - btcscript.OP_CHECKMULTISIG, + txscript.OP_TRUE, + txscript.OP_CHECKMULTISIG, }, - scripttype: btcscript.MultiSigTy, + scripttype: txscript.MultiSigTy, }, // tx e5779b9e78f9650debc2893fd9636d827b26b4ddfa6a8172fe8708c924f5c39d // P2SH { name: "P2SH", script: []byte{ - btcscript.OP_HASH160, - btcscript.OP_DATA_20, + txscript.OP_HASH160, + txscript.OP_DATA_20, 0x43, 0x3e, 0xc2, 0xac, 0x1f, 0xfa, 0x1b, 0x7b, 0x7d, 0x02, 0x7f, 0x56, 0x45, 0x29, 0xc5, 0x71, 0x97, 0xf9, 0xae, 0x88, - btcscript.OP_EQUAL, + txscript.OP_EQUAL, }, - scripttype: btcscript.ScriptHashTy, + scripttype: txscript.ScriptHashTy, }, // Nulldata with no data at all. { name: "nulldata", script: []byte{ - btcscript.OP_RETURN, + txscript.OP_RETURN, }, - scripttype: btcscript.NullDataTy, + scripttype: txscript.NullDataTy, }, // Nulldata with small data. { name: "nulldata2", script: []byte{ - btcscript.OP_RETURN, - btcscript.OP_DATA_8, + txscript.OP_RETURN, + txscript.OP_DATA_8, 0x04, 0x67, 0x08, 0xaf, 0xdb, 0x0f, 0xe5, 0x54, }, - scripttype: btcscript.NullDataTy, + scripttype: txscript.NullDataTy, }, // Nulldata with max allowed data. { name: "nulldata3", script: []byte{ - btcscript.OP_RETURN, - btcscript.OP_PUSHDATA1, + txscript.OP_RETURN, + txscript.OP_PUSHDATA1, 0x28, // 40 0x04, 0x67, 0x08, 0xaf, 0xdb, 0x0f, 0xe5, 0x54, 0x82, 0x71, 0x96, 0x7f, 0x1a, 0x67, 0x13, 0x0b, @@ -2256,14 +2256,14 @@ var scriptTypeTests = []scriptTypeTest{ 0x9a, 0x67, 0x96, 0x2e, 0x0e, 0xa1, 0xf6, 0x1d, 0xeb, 0x64, 0x9f, 0x6b, 0xc3, 0xf4, 0xce, 0xf3, }, - scripttype: btcscript.NullDataTy, + scripttype: txscript.NullDataTy, }, // Nulldata with more than max allowed data (so therefore nonstandard) { name: "nulldata4", script: []byte{ - btcscript.OP_RETURN, - btcscript.OP_PUSHDATA1, + txscript.OP_RETURN, + txscript.OP_PUSHDATA1, 0x29, // 41 0x04, 0x67, 0x08, 0xaf, 0xdb, 0x0f, 0xe5, 0x54, 0x82, 0x71, 0x96, 0x7f, 0x1a, 0x67, 0x13, 0x0b, @@ -2272,102 +2272,102 @@ var scriptTypeTests = []scriptTypeTest{ 0xeb, 0x64, 0x9f, 0x6b, 0xc3, 0xf4, 0xce, 0xf3, 0x08, }, - scripttype: btcscript.NonStandardTy, + scripttype: txscript.NonStandardTy, }, // Almost nulldata, but add an additional opcode after the data to make // it nonstandard. { name: "nulldata5", script: []byte{ - btcscript.OP_RETURN, - btcscript.OP_DATA_1, + txscript.OP_RETURN, + txscript.OP_DATA_1, 0x04, - btcscript.OP_TRUE, + txscript.OP_TRUE, }, - scripttype: btcscript.NonStandardTy, + scripttype: txscript.NonStandardTy, }, // The next few are almost multisig (it is the more complex script type) // but with various changes to make it fail. { // multisig but funny nsigs.. name: "strange 1", script: []byte{ - btcscript.OP_DUP, - btcscript.OP_DATA_33, + txscript.OP_DUP, + txscript.OP_DATA_33, 0x02, 0x32, 0xab, 0xdc, 0x89, 0x3e, 0x7f, 0x06, 0x31, 0x36, 0x4d, 0x7f, 0xd0, 0x1c, 0xb3, 0x3d, 0x24, 0xda, 0x45, 0x32, 0x9a, 0x00, 0x35, 0x7b, 0x3a, 0x78, 0x86, 0x21, 0x1a, 0xb4, 0x14, 0xd5, 0x5a, - btcscript.OP_TRUE, - btcscript.OP_CHECKMULTISIG, + txscript.OP_TRUE, + txscript.OP_CHECKMULTISIG, }, - scripttype: btcscript.NonStandardTy, + scripttype: txscript.NonStandardTy, }, { name: "strange 2", // multisig but funny pubkey. script: []byte{ - btcscript.OP_TRUE, - btcscript.OP_TRUE, - btcscript.OP_TRUE, - btcscript.OP_CHECKMULTISIG, + txscript.OP_TRUE, + txscript.OP_TRUE, + txscript.OP_TRUE, + txscript.OP_CHECKMULTISIG, }, - scripttype: btcscript.NonStandardTy, + scripttype: txscript.NonStandardTy, }, { name: "strange 3", // multisig but no matching npubkeys opcode. script: []byte{ - btcscript.OP_TRUE, - btcscript.OP_DATA_33, + txscript.OP_TRUE, + txscript.OP_DATA_33, 0x02, 0x32, 0xab, 0xdc, 0x89, 0x3e, 0x7f, 0x06, 0x31, 0x36, 0x4d, 0x7f, 0xd0, 0x1c, 0xb3, 0x3d, 0x24, 0xda, 0x45, 0x32, 0x9a, 0x00, 0x35, 0x7b, 0x3a, 0x78, 0x86, 0x21, 0x1a, 0xb4, 0x14, 0xd5, 0x5a, - btcscript.OP_DATA_33, + txscript.OP_DATA_33, 0x02, 0x32, 0xab, 0xdc, 0x89, 0x3e, 0x7f, 0x06, 0x31, 0x36, 0x4d, 0x7f, 0xd0, 0x1c, 0xb3, 0x3d, 0x24, 0xda, 0x45, 0x32, 0x9a, 0x00, 0x35, 0x7b, 0x3a, 0x78, 0x86, 0x21, 0x1a, 0xb4, 0x14, 0xd5, 0x5a, // No number. - btcscript.OP_CHECKMULTISIG, + txscript.OP_CHECKMULTISIG, }, - scripttype: btcscript.NonStandardTy, + scripttype: txscript.NonStandardTy, }, { name: "strange 4", // multisig but with multisigverify script: []byte{ - btcscript.OP_TRUE, - btcscript.OP_DATA_33, + txscript.OP_TRUE, + txscript.OP_DATA_33, 0x02, 0x32, 0xab, 0xdc, 0x89, 0x3e, 0x7f, 0x06, 0x31, 0x36, 0x4d, 0x7f, 0xd0, 0x1c, 0xb3, 0x3d, 0x24, 0xda, 0x45, 0x32, 0x9a, 0x00, 0x35, 0x7b, 0x3a, 0x78, 0x86, 0x21, 0x1a, 0xb4, 0x14, 0xd5, 0x5a, - btcscript.OP_TRUE, - btcscript.OP_CHECKMULTISIGVERIFY, + txscript.OP_TRUE, + txscript.OP_CHECKMULTISIGVERIFY, }, - scripttype: btcscript.NonStandardTy, + scripttype: txscript.NonStandardTy, }, { name: "strange 5", // multisig but wrong length. script: []byte{ - btcscript.OP_TRUE, - btcscript.OP_CHECKMULTISIG, + txscript.OP_TRUE, + txscript.OP_CHECKMULTISIG, }, - scripttype: btcscript.NonStandardTy, + scripttype: txscript.NonStandardTy, }, { name: "doesn't parse", script: []byte{ - btcscript.OP_DATA_5, 0x1, 0x2, 0x3, 0x4, + txscript.OP_DATA_5, 0x1, 0x2, 0x3, 0x4, }, - scripttype: btcscript.NonStandardTy, + scripttype: txscript.NonStandardTy, }, } func testScriptType(t *testing.T, test *scriptTypeTest) { - scripttype := btcscript.GetScriptClass(test.script) + scripttype := txscript.GetScriptClass(test.script) if scripttype != test.scripttype { t.Errorf("%s: expected %s got %s", test.name, test.scripttype, scripttype) @@ -2386,8 +2386,8 @@ func TestIsPayToScriptHash(t *testing.T) { t.Parallel() for _, test := range scriptTypeTests { - shouldBe := (test.scripttype == btcscript.ScriptHashTy) - p2sh := btcscript.IsPayToScriptHash(test.script) + shouldBe := (test.scripttype == txscript.ScriptHashTy) + p2sh := txscript.IsPayToScriptHash(test.script) if p2sh != shouldBe { t.Errorf("%s: epxected p2sh %v, got %v", test.name, shouldBe, p2sh) @@ -2431,7 +2431,7 @@ func TestBadPC(t *testing.T) { }), Index: 0, }, - SignatureScript: []uint8{btcscript.OP_NOP}, + SignatureScript: []uint8{txscript.OP_NOP}, Sequence: 4294967295, }, }, @@ -2443,10 +2443,10 @@ func TestBadPC(t *testing.T) { }, LockTime: 0, } - pkScript := []byte{btcscript.OP_NOP} + pkScript := []byte{txscript.OP_NOP} for _, test := range pcTests { - engine, err := btcscript.NewScript(tx.TxIn[0].SignatureScript, + engine, err := txscript.NewScript(tx.TxIn[0].SignatureScript, pkScript, 0, tx, 0) if err != nil { t.Errorf("Failed to create script: %v", err) @@ -2505,20 +2505,20 @@ func TestCheckErrorCondition(t *testing.T) { LockTime: 0, } pkScript := []byte{ - btcscript.OP_NOP, - btcscript.OP_NOP, - btcscript.OP_NOP, - btcscript.OP_NOP, - btcscript.OP_NOP, - btcscript.OP_NOP, - btcscript.OP_NOP, - btcscript.OP_NOP, - btcscript.OP_NOP, - btcscript.OP_NOP, - btcscript.OP_TRUE, + txscript.OP_NOP, + txscript.OP_NOP, + txscript.OP_NOP, + txscript.OP_NOP, + txscript.OP_NOP, + txscript.OP_NOP, + txscript.OP_NOP, + txscript.OP_NOP, + txscript.OP_NOP, + txscript.OP_NOP, + txscript.OP_TRUE, } - engine, err := btcscript.NewScript(tx.TxIn[0].SignatureScript, pkScript, + engine, err := txscript.NewScript(tx.TxIn[0].SignatureScript, pkScript, 0, tx, 0) if err != nil { t.Errorf("failed to create script: %v", err) @@ -2536,7 +2536,7 @@ func TestCheckErrorCondition(t *testing.T) { } err = engine.CheckErrorCondition() - if err != btcscript.ErrStackScriptUnfinished { + if err != txscript.ErrStackScriptUnfinished { t.Errorf("got unexepected error %v on %dth iteration", err, i) return @@ -2561,7 +2561,7 @@ func TestCheckErrorCondition(t *testing.T) { type TstSigScript struct { name string inputs []TstInput - hashType btcscript.SigHashType + hashType txscript.SigHashType compress bool scriptAtWrongIndex bool } @@ -2620,7 +2620,7 @@ var SigScriptTests = []TstSigScript{ indexOutOfRange: false, }, }, - hashType: btcscript.SigHashAll, + hashType: txscript.SigHashAll, compress: false, scriptAtWrongIndex: false, }, @@ -2640,7 +2640,7 @@ var SigScriptTests = []TstSigScript{ indexOutOfRange: false, }, }, - hashType: btcscript.SigHashAll, + hashType: txscript.SigHashAll, compress: false, scriptAtWrongIndex: false, }, @@ -2654,7 +2654,7 @@ var SigScriptTests = []TstSigScript{ indexOutOfRange: false, }, }, - hashType: btcscript.SigHashAll, + hashType: txscript.SigHashAll, compress: true, scriptAtWrongIndex: false, }, @@ -2674,7 +2674,7 @@ var SigScriptTests = []TstSigScript{ indexOutOfRange: false, }, }, - hashType: btcscript.SigHashAll, + hashType: txscript.SigHashAll, compress: true, scriptAtWrongIndex: false, }, @@ -2688,7 +2688,7 @@ var SigScriptTests = []TstSigScript{ indexOutOfRange: false, }, }, - hashType: btcscript.SigHashNone, + hashType: txscript.SigHashNone, compress: false, scriptAtWrongIndex: false, }, @@ -2702,7 +2702,7 @@ var SigScriptTests = []TstSigScript{ indexOutOfRange: false, }, }, - hashType: btcscript.SigHashSingle, + hashType: txscript.SigHashSingle, compress: false, scriptAtWrongIndex: false, }, @@ -2716,7 +2716,7 @@ var SigScriptTests = []TstSigScript{ indexOutOfRange: false, }, }, - hashType: btcscript.SigHashAnyOneCanPay, + hashType: txscript.SigHashAnyOneCanPay, compress: false, scriptAtWrongIndex: false, }, @@ -2744,7 +2744,7 @@ var SigScriptTests = []TstSigScript{ indexOutOfRange: false, }, }, - hashType: btcscript.SigHashAll, + hashType: txscript.SigHashAll, compress: true, scriptAtWrongIndex: false, }, @@ -2757,7 +2757,7 @@ var SigScriptTests = []TstSigScript{ indexOutOfRange: false, }, }, - hashType: btcscript.SigHashAll, + hashType: txscript.SigHashAll, compress: false, scriptAtWrongIndex: false, }, @@ -2777,7 +2777,7 @@ var SigScriptTests = []TstSigScript{ indexOutOfRange: false, }, }, - hashType: btcscript.SigHashAll, + hashType: txscript.SigHashAll, compress: false, scriptAtWrongIndex: true, }, @@ -2797,7 +2797,7 @@ var SigScriptTests = []TstSigScript{ indexOutOfRange: false, }, }, - hashType: btcscript.SigHashAll, + hashType: txscript.SigHashAll, compress: false, scriptAtWrongIndex: true, }, @@ -2817,7 +2817,7 @@ nexttest: for i := range SigScriptTests { tx := btcwire.NewMsgTx() - output := btcwire.NewTxOut(500, []byte{btcscript.OP_RETURN}) + output := btcwire.NewTxOut(500, []byte{txscript.OP_RETURN}) tx.AddTxOut(output) for _ = range SigScriptTests[i].inputs { @@ -2835,7 +2835,7 @@ nexttest: } else { idx = j } - script, err = btcscript.SignatureScript(tx, idx, + script, err = txscript.SignatureScript(tx, idx, SigScriptTests[i].inputs[j].txout.PkScript, SigScriptTests[i].hashType, privKey, SigScriptTests[i].compress) @@ -2867,9 +2867,9 @@ nexttest: } // Validate tx input scripts - scriptFlags := btcscript.ScriptBip16 | btcscript.ScriptCanonicalSignatures + scriptFlags := txscript.ScriptBip16 | txscript.ScriptCanonicalSignatures for j, txin := range tx.TxIn { - engine, err := btcscript.NewScript(txin.SignatureScript, + engine, err := txscript.NewScript(txin.SignatureScript, SigScriptTests[i].inputs[j].txout.PkScript, j, tx, scriptFlags) if err != nil { @@ -2897,42 +2897,42 @@ func TestStringifyClass(t *testing.T) { tests := []struct { name string - scriptclass btcscript.ScriptClass + scriptclass txscript.ScriptClass stringed string }{ { name: "nonstandardty", - scriptclass: btcscript.NonStandardTy, + scriptclass: txscript.NonStandardTy, stringed: "nonstandard", }, { name: "pubkey", - scriptclass: btcscript.PubKeyTy, + scriptclass: txscript.PubKeyTy, stringed: "pubkey", }, { name: "pubkeyhash", - scriptclass: btcscript.PubKeyHashTy, + scriptclass: txscript.PubKeyHashTy, stringed: "pubkeyhash", }, { name: "scripthash", - scriptclass: btcscript.ScriptHashTy, + scriptclass: txscript.ScriptHashTy, stringed: "scripthash", }, { name: "multisigty", - scriptclass: btcscript.MultiSigTy, + scriptclass: txscript.MultiSigTy, stringed: "multisig", }, { name: "nulldataty", - scriptclass: btcscript.NullDataTy, + scriptclass: txscript.NullDataTy, stringed: "nulldata", }, { name: "broken", - scriptclass: btcscript.ScriptClass(255), + scriptclass: txscript.ScriptClass(255), stringed: "Invalid", }, } @@ -3063,12 +3063,12 @@ func TestPayToAddrScript(t *testing.T) { { p2pkCompressedMain, []byte{ - btcscript.OP_DATA_33, + txscript.OP_DATA_33, 0x02, 0x19, 0x2d, 0x74, 0xd0, 0xcb, 0x94, 0x34, 0x4c, 0x95, 0x69, 0xc2, 0xe7, 0x79, 0x01, 0x57, 0x3d, 0x8d, 0x79, 0x03, 0xc3, 0xeb, 0xec, 0x3a, 0x95, 0x77, 0x24, 0x89, 0x5d, 0xca, 0x52, 0xc6, - 0xb4, btcscript.OP_CHECKSIG, + 0xb4, txscript.OP_CHECKSIG, }, nil, }, @@ -3076,12 +3076,12 @@ func TestPayToAddrScript(t *testing.T) { { p2pkCompressed2Main, []byte{ - btcscript.OP_DATA_33, + txscript.OP_DATA_33, 0x03, 0xb0, 0xbd, 0x63, 0x42, 0x34, 0xab, 0xbb, 0x1b, 0xa1, 0xe9, 0x86, 0xe8, 0x84, 0x18, 0x5c, 0x61, 0xcf, 0x43, 0xe0, 0x01, 0xf9, 0x13, 0x7f, 0x23, 0xc2, 0xc4, 0x09, 0x27, 0x3e, 0xb1, 0x6e, - 0x65, btcscript.OP_CHECKSIG, + 0x65, txscript.OP_CHECKSIG, }, nil, }, @@ -3089,7 +3089,7 @@ func TestPayToAddrScript(t *testing.T) { { p2pkUncompressedMain, []byte{ - btcscript.OP_DATA_65, + txscript.OP_DATA_65, 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, 0x2e, 0x97, 0xb1, 0x48, @@ -3098,23 +3098,23 @@ func TestPayToAddrScript(t *testing.T) { 0xf9, 0x74, 0x44, 0x64, 0xf8, 0x2e, 0x16, 0x0b, 0xfa, 0x9b, 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, 0x12, - 0xa3, btcscript.OP_CHECKSIG, + 0xa3, txscript.OP_CHECKSIG, }, nil, }, // Supported address types with nil pointers. - {(*btcutil.AddressPubKeyHash)(nil), []byte{}, btcscript.ErrUnsupportedAddress}, - {(*btcutil.AddressScriptHash)(nil), []byte{}, btcscript.ErrUnsupportedAddress}, - {(*btcutil.AddressPubKey)(nil), []byte{}, btcscript.ErrUnsupportedAddress}, + {(*btcutil.AddressPubKeyHash)(nil), []byte{}, txscript.ErrUnsupportedAddress}, + {(*btcutil.AddressScriptHash)(nil), []byte{}, txscript.ErrUnsupportedAddress}, + {(*btcutil.AddressPubKey)(nil), []byte{}, txscript.ErrUnsupportedAddress}, // Unsupported address type. - {&bogusAddress{}, []byte{}, btcscript.ErrUnsupportedAddress}, + {&bogusAddress{}, []byte{}, txscript.ErrUnsupportedAddress}, } t.Logf("Running %d tests", len(tests)) for i, test := range tests { - pkScript, err := btcscript.PayToAddrScript(test.in) + pkScript, err := txscript.PayToAddrScript(test.in) if err != test.err { t.Errorf("PayToAddrScript #%d unexpected error - "+ "got %v, want %v", i, err, test.err) @@ -3181,20 +3181,20 @@ func TestMultiSigScript(t *testing.T) { }, 1, []byte{ - btcscript.OP_1, - btcscript.OP_DATA_33, + txscript.OP_1, + txscript.OP_DATA_33, 0x02, 0x19, 0x2d, 0x74, 0xd0, 0xcb, 0x94, 0x34, 0x4c, 0x95, 0x69, 0xc2, 0xe7, 0x79, 0x01, 0x57, 0x3d, 0x8d, 0x79, 0x03, 0xc3, 0xeb, 0xec, 0x3a, 0x95, 0x77, 0x24, 0x89, 0x5d, 0xca, 0x52, 0xc6, 0xb4, - btcscript.OP_DATA_33, + txscript.OP_DATA_33, 0x03, 0xb0, 0xbd, 0x63, 0x42, 0x34, 0xab, 0xbb, 0x1b, 0xa1, 0xe9, 0x86, 0xe8, 0x84, 0x18, 0x5c, 0x61, 0xcf, 0x43, 0xe0, 0x01, 0xf9, 0x13, 0x7f, 0x23, 0xc2, 0xc4, 0x09, 0x27, 0x3e, 0xb1, 0x6e, 0x65, - btcscript.OP_2, btcscript.OP_CHECKMULTISIG, + txscript.OP_2, txscript.OP_CHECKMULTISIG, }, nil, }, @@ -3205,20 +3205,20 @@ func TestMultiSigScript(t *testing.T) { }, 2, []byte{ - btcscript.OP_2, - btcscript.OP_DATA_33, + txscript.OP_2, + txscript.OP_DATA_33, 0x02, 0x19, 0x2d, 0x74, 0xd0, 0xcb, 0x94, 0x34, 0x4c, 0x95, 0x69, 0xc2, 0xe7, 0x79, 0x01, 0x57, 0x3d, 0x8d, 0x79, 0x03, 0xc3, 0xeb, 0xec, 0x3a, 0x95, 0x77, 0x24, 0x89, 0x5d, 0xca, 0x52, 0xc6, 0xb4, - btcscript.OP_DATA_33, + txscript.OP_DATA_33, 0x03, 0xb0, 0xbd, 0x63, 0x42, 0x34, 0xab, 0xbb, 0x1b, 0xa1, 0xe9, 0x86, 0xe8, 0x84, 0x18, 0x5c, 0x61, 0xcf, 0x43, 0xe0, 0x01, 0xf9, 0x13, 0x7f, 0x23, 0xc2, 0xc4, 0x09, 0x27, 0x3e, 0xb1, 0x6e, 0x65, - btcscript.OP_2, btcscript.OP_CHECKMULTISIG, + txscript.OP_2, txscript.OP_CHECKMULTISIG, }, nil, }, @@ -3229,7 +3229,7 @@ func TestMultiSigScript(t *testing.T) { }, 3, []byte{}, - btcscript.ErrBadNumRequired, + txscript.ErrBadNumRequired, }, { []*btcutil.AddressPubKey{ @@ -3237,7 +3237,7 @@ func TestMultiSigScript(t *testing.T) { }, 1, []byte{ - btcscript.OP_1, btcscript.OP_DATA_65, + txscript.OP_1, txscript.OP_DATA_65, 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, 0x2e, 0x97, 0xb1, 0x48, @@ -3247,7 +3247,7 @@ func TestMultiSigScript(t *testing.T) { 0xfa, 0x9b, 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, 0x12, 0xa3, - btcscript.OP_1, btcscript.OP_CHECKMULTISIG, + txscript.OP_1, txscript.OP_CHECKMULTISIG, }, nil, }, @@ -3257,13 +3257,13 @@ func TestMultiSigScript(t *testing.T) { }, 2, []byte{}, - btcscript.ErrBadNumRequired, + txscript.ErrBadNumRequired, }, } t.Logf("Running %d tests", len(tests)) for i, test := range tests { - script, err := btcscript.MultiSigScript(test.keys, + script, err := txscript.MultiSigScript(test.keys, test.nrequired) if err != test.err { t.Errorf("MultiSigScript #%d unexpected error - "+ @@ -3280,10 +3280,10 @@ func TestMultiSigScript(t *testing.T) { } func signAndCheck(msg string, tx *btcwire.MsgTx, idx int, pkScript []byte, - hashType btcscript.SigHashType, kdb btcscript.KeyDB, sdb btcscript.ScriptDB, + hashType txscript.SigHashType, kdb txscript.KeyDB, sdb txscript.ScriptDB, previousScript []byte) error { - sigScript, err := btcscript.SignTxOutput( + sigScript, err := txscript.SignTxOutput( &btcnet.TestNet3Params, tx, idx, pkScript, hashType, kdb, sdb, []byte{}) if err != nil { @@ -3295,9 +3295,9 @@ func signAndCheck(msg string, tx *btcwire.MsgTx, idx int, pkScript []byte, func checkScripts(msg string, tx *btcwire.MsgTx, idx int, sigScript, pkScript []byte) error { - engine, err := btcscript.NewScript(sigScript, pkScript, idx, tx, - btcscript.ScriptBip16| - btcscript.ScriptCanonicalSignatures) + engine, err := txscript.NewScript(sigScript, pkScript, idx, tx, + txscript.ScriptBip16| + txscript.ScriptCanonicalSignatures) if err != nil { return fmt.Errorf("failed to make script engine for %s: %v", msg, err) @@ -3317,14 +3317,14 @@ type addressToKey struct { compressed bool } -func mkGetKey(keys map[string]addressToKey) btcscript.KeyDB { +func mkGetKey(keys map[string]addressToKey) txscript.KeyDB { if keys == nil { - return btcscript.KeyClosure(func(addr btcutil.Address) (*btcec.PrivateKey, + return txscript.KeyClosure(func(addr btcutil.Address) (*btcec.PrivateKey, bool, error) { return nil, false, errors.New("nope") }) } - return btcscript.KeyClosure(func(addr btcutil.Address) (*btcec.PrivateKey, + return txscript.KeyClosure(func(addr btcutil.Address) (*btcec.PrivateKey, bool, error) { a2k, ok := keys[addr.EncodeAddress()] if !ok { @@ -3334,14 +3334,14 @@ func mkGetKey(keys map[string]addressToKey) btcscript.KeyDB { }) } -func mkGetScript(scripts map[string][]byte) btcscript.ScriptDB { +func mkGetScript(scripts map[string][]byte) txscript.ScriptDB { if scripts == nil { - return btcscript.ScriptClosure(func(addr btcutil.Address) ( + return txscript.ScriptClosure(func(addr btcutil.Address) ( []byte, error) { return nil, errors.New("nope") }) } - return btcscript.ScriptClosure(func(addr btcutil.Address) ([]byte, + return txscript.ScriptClosure(func(addr btcutil.Address) ([]byte, error) { script, ok := scripts[addr.EncodeAddress()] if !ok { @@ -3357,14 +3357,14 @@ func TestSignTxOutput(t *testing.T) { // make key // make script based on key. // sign with magic pixie dust. - hashTypes := []btcscript.SigHashType{ - btcscript.SigHashOld, // no longer used but should act like all - btcscript.SigHashAll, - btcscript.SigHashNone, - btcscript.SigHashSingle, - btcscript.SigHashAll | btcscript.SigHashAnyOneCanPay, - btcscript.SigHashNone | btcscript.SigHashAnyOneCanPay, - btcscript.SigHashSingle | btcscript.SigHashAnyOneCanPay, + hashTypes := []txscript.SigHashType{ + txscript.SigHashOld, // no longer used but should act like all + txscript.SigHashAll, + txscript.SigHashNone, + txscript.SigHashSingle, + txscript.SigHashAll | txscript.SigHashAnyOneCanPay, + txscript.SigHashNone | txscript.SigHashAnyOneCanPay, + txscript.SigHashSingle | txscript.SigHashAnyOneCanPay, } tx := &btcwire.MsgTx{ Version: 1, @@ -3426,7 +3426,7 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) @@ -3463,13 +3463,13 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) } - sigScript, err := btcscript.SignTxOutput( + sigScript, err := txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, pkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, false}, @@ -3482,7 +3482,7 @@ func TestSignTxOutput(t *testing.T) { // by the above loop, this should be valid, now sign // again and merge. - sigScript, err = btcscript.SignTxOutput( + sigScript, err = txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, pkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, false}, @@ -3524,7 +3524,7 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) @@ -3562,13 +3562,13 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) } - sigScript, err := btcscript.SignTxOutput( + sigScript, err := txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, pkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, true}, @@ -3581,7 +3581,7 @@ func TestSignTxOutput(t *testing.T) { // by the above loop, this should be valid, now sign // again and merge. - sigScript, err = btcscript.SignTxOutput( + sigScript, err = txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, pkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, true}, @@ -3623,7 +3623,7 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) @@ -3661,13 +3661,13 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) } - sigScript, err := btcscript.SignTxOutput( + sigScript, err := txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, pkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, false}, @@ -3680,7 +3680,7 @@ func TestSignTxOutput(t *testing.T) { // by the above loop, this should be valid, now sign // again and merge. - sigScript, err = btcscript.SignTxOutput( + sigScript, err = txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, pkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, false}, @@ -3722,7 +3722,7 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) @@ -3760,13 +3760,13 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) } - sigScript, err := btcscript.SignTxOutput( + sigScript, err := txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, pkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, true}, @@ -3779,7 +3779,7 @@ func TestSignTxOutput(t *testing.T) { // by the above loop, this should be valid, now sign // again and merge. - sigScript, err = btcscript.SignTxOutput( + sigScript, err = txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, pkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, true}, @@ -3821,7 +3821,7 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) @@ -3836,7 +3836,7 @@ func TestSignTxOutput(t *testing.T) { break } - scriptPkScript, err := btcscript.PayToAddrScript( + scriptPkScript, err := txscript.PayToAddrScript( scriptAddr) if err != nil { t.Errorf("failed to make script pkscript for "+ @@ -3878,7 +3878,7 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) @@ -3893,7 +3893,7 @@ func TestSignTxOutput(t *testing.T) { break } - scriptPkScript, err := btcscript.PayToAddrScript( + scriptPkScript, err := txscript.PayToAddrScript( scriptAddr) if err != nil { t.Errorf("failed to make script pkscript for "+ @@ -3901,7 +3901,7 @@ func TestSignTxOutput(t *testing.T) { break } - sigScript, err := btcscript.SignTxOutput( + sigScript, err := txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, scriptPkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, false}, @@ -3916,7 +3916,7 @@ func TestSignTxOutput(t *testing.T) { // by the above loop, this should be valid, now sign // again and merge. - sigScript, err = btcscript.SignTxOutput( + sigScript, err = txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, scriptPkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, false}, @@ -3960,7 +3960,7 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) @@ -3974,7 +3974,7 @@ func TestSignTxOutput(t *testing.T) { break } - scriptPkScript, err := btcscript.PayToAddrScript( + scriptPkScript, err := txscript.PayToAddrScript( scriptAddr) if err != nil { t.Errorf("failed to make script pkscript for "+ @@ -4017,7 +4017,7 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) @@ -4031,7 +4031,7 @@ func TestSignTxOutput(t *testing.T) { break } - scriptPkScript, err := btcscript.PayToAddrScript( + scriptPkScript, err := txscript.PayToAddrScript( scriptAddr) if err != nil { t.Errorf("failed to make script pkscript for "+ @@ -4039,7 +4039,7 @@ func TestSignTxOutput(t *testing.T) { break } - sigScript, err := btcscript.SignTxOutput( + sigScript, err := txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, scriptPkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, true}, @@ -4054,7 +4054,7 @@ func TestSignTxOutput(t *testing.T) { // by the above loop, this should be valid, now sign // again and merge. - sigScript, err = btcscript.SignTxOutput( + sigScript, err = txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, scriptPkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, true}, @@ -4098,7 +4098,7 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) @@ -4112,7 +4112,7 @@ func TestSignTxOutput(t *testing.T) { break } - scriptPkScript, err := btcscript.PayToAddrScript( + scriptPkScript, err := txscript.PayToAddrScript( scriptAddr) if err != nil { t.Errorf("failed to make script pkscript for "+ @@ -4155,7 +4155,7 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) @@ -4169,7 +4169,7 @@ func TestSignTxOutput(t *testing.T) { break } - scriptPkScript, err := btcscript.PayToAddrScript( + scriptPkScript, err := txscript.PayToAddrScript( scriptAddr) if err != nil { t.Errorf("failed to make script pkscript for "+ @@ -4177,7 +4177,7 @@ func TestSignTxOutput(t *testing.T) { break } - sigScript, err := btcscript.SignTxOutput( + sigScript, err := txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, scriptPkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, false}, @@ -4192,7 +4192,7 @@ func TestSignTxOutput(t *testing.T) { // by the above loop, this should be valid, now sign // again and merge. - sigScript, err = btcscript.SignTxOutput( + sigScript, err = txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, scriptPkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, false}, @@ -4236,7 +4236,7 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) @@ -4250,7 +4250,7 @@ func TestSignTxOutput(t *testing.T) { break } - scriptPkScript, err := btcscript.PayToAddrScript( + scriptPkScript, err := txscript.PayToAddrScript( scriptAddr) if err != nil { t.Errorf("failed to make script pkscript for "+ @@ -4293,7 +4293,7 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.PayToAddrScript(address) + pkScript, err := txscript.PayToAddrScript(address) if err != nil { t.Errorf("failed to make pkscript "+ "for %s: %v", msg, err) @@ -4307,7 +4307,7 @@ func TestSignTxOutput(t *testing.T) { break } - scriptPkScript, err := btcscript.PayToAddrScript( + scriptPkScript, err := txscript.PayToAddrScript( scriptAddr) if err != nil { t.Errorf("failed to make script pkscript for "+ @@ -4315,7 +4315,7 @@ func TestSignTxOutput(t *testing.T) { break } - sigScript, err := btcscript.SignTxOutput( + sigScript, err := txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, scriptPkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, true}, @@ -4330,7 +4330,7 @@ func TestSignTxOutput(t *testing.T) { // by the above loop, this should be valid, now sign // again and merge. - sigScript, err = btcscript.SignTxOutput( + sigScript, err = txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, scriptPkScript, hashType, mkGetKey(map[string]addressToKey{ address.EncodeAddress(): {key, true}, @@ -4391,7 +4391,7 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.MultiSigScript( + pkScript, err := txscript.MultiSigScript( []*btcutil.AddressPubKey{address1, address2}, 2) if err != nil { @@ -4407,7 +4407,7 @@ func TestSignTxOutput(t *testing.T) { break } - scriptPkScript, err := btcscript.PayToAddrScript( + scriptPkScript, err := txscript.PayToAddrScript( scriptAddr) if err != nil { t.Errorf("failed to make script pkscript for "+ @@ -4468,7 +4468,7 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.MultiSigScript( + pkScript, err := txscript.MultiSigScript( []*btcutil.AddressPubKey{address1, address2}, 2) if err != nil { @@ -4484,7 +4484,7 @@ func TestSignTxOutput(t *testing.T) { break } - scriptPkScript, err := btcscript.PayToAddrScript( + scriptPkScript, err := txscript.PayToAddrScript( scriptAddr) if err != nil { t.Errorf("failed to make script pkscript for "+ @@ -4492,7 +4492,7 @@ func TestSignTxOutput(t *testing.T) { break } - sigScript, err := btcscript.SignTxOutput( + sigScript, err := txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, scriptPkScript, hashType, mkGetKey(map[string]addressToKey{ address1.EncodeAddress(): {key1, true}, @@ -4513,7 +4513,7 @@ func TestSignTxOutput(t *testing.T) { } // Sign with the other key and merge - sigScript, err = btcscript.SignTxOutput( + sigScript, err = txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, scriptPkScript, hashType, mkGetKey(map[string]addressToKey{ address2.EncodeAddress(): {key2, true}, @@ -4575,7 +4575,7 @@ func TestSignTxOutput(t *testing.T) { break } - pkScript, err := btcscript.MultiSigScript( + pkScript, err := txscript.MultiSigScript( []*btcutil.AddressPubKey{address1, address2}, 2) if err != nil { @@ -4591,7 +4591,7 @@ func TestSignTxOutput(t *testing.T) { break } - scriptPkScript, err := btcscript.PayToAddrScript( + scriptPkScript, err := txscript.PayToAddrScript( scriptAddr) if err != nil { t.Errorf("failed to make script pkscript for "+ @@ -4599,7 +4599,7 @@ func TestSignTxOutput(t *testing.T) { break } - sigScript, err := btcscript.SignTxOutput( + sigScript, err := txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, scriptPkScript, hashType, mkGetKey(map[string]addressToKey{ address1.EncodeAddress(): {key1, true}, @@ -4620,7 +4620,7 @@ func TestSignTxOutput(t *testing.T) { } // Sign with the other key and merge - sigScript, err = btcscript.SignTxOutput( + sigScript, err = txscript.SignTxOutput( &btcnet.TestNet3Params, tx, i, scriptPkScript, hashType, mkGetKey(map[string]addressToKey{ address1.EncodeAddress(): {key1, true}, @@ -4661,13 +4661,13 @@ func TestCalcMultiSigStats(t *testing.T) { 0x71, 0x05, 0xcd, 0x6a, 0x82, 0x8e, 0x03, 0x90, 0x9a, 0x67, 0x96, 0x2e, 0x0e, 0xa1, 0xf6, 0x1d, }, - expected: btcscript.ErrStackShortScript, + expected: txscript.ErrStackShortScript, }, { name: "stack underflow", script: []byte{ - btcscript.OP_RETURN, - btcscript.OP_PUSHDATA1, + txscript.OP_RETURN, + txscript.OP_PUSHDATA1, 0x29, 0x04, 0x67, 0x08, 0xaf, 0xdb, 0x0f, 0xe5, 0x54, 0x82, 0x71, 0x96, 0x7f, 0x1a, 0x67, 0x13, 0x0b, @@ -4676,13 +4676,13 @@ func TestCalcMultiSigStats(t *testing.T) { 0xeb, 0x64, 0x9f, 0x6b, 0xc3, 0xf4, 0xce, 0xf3, 0x08, }, - expected: btcscript.ErrStackUnderflow, + expected: txscript.ErrStackUnderflow, }, { name: "multisig script", script: []uint8{ - btcscript.OP_FALSE, - btcscript.OP_DATA_72, + txscript.OP_FALSE, + txscript.OP_DATA_72, 0x30, 0x45, 0x02, 0x20, 0x10, 0x6a, 0x3e, 0x4e, 0xf0, 0xb5, 0x1b, 0x76, 0x4a, 0x28, 0x87, @@ -4698,9 +4698,9 @@ func TestCalcMultiSigStats(t *testing.T) { 0x1f, 0xe0, 0x72, 0x82, 0xe3, 0xb6, 0xec, 0xb5, 0xf3, 0xbb, 0x28, 0x01, - btcscript.OP_CODESEPARATOR, - btcscript.OP_TRUE, - btcscript.OP_DATA_33, + txscript.OP_CODESEPARATOR, + txscript.OP_TRUE, + txscript.OP_DATA_33, 0x02, 0x32, 0xab, 0xdc, 0x89, 0x3e, 0x7f, 0x06, 0x31, 0x36, 0x4d, 0x7f, 0xd0, 0x1c, 0xb3, @@ -4708,15 +4708,15 @@ func TestCalcMultiSigStats(t *testing.T) { 0x9a, 0x00, 0x35, 0x7b, 0x3a, 0x78, 0x86, 0x21, 0x1a, 0xb4, 0x14, 0xd5, 0x5a, - btcscript.OP_TRUE, - btcscript.OP_CHECKMULTISIG, + txscript.OP_TRUE, + txscript.OP_CHECKMULTISIG, }, expected: nil, }, } for i, test := range tests { - if _, _, err := btcscript.CalcMultiSigStats(test.script); err != test.expected { + if _, _, err := txscript.CalcMultiSigStats(test.script); err != test.expected { t.Errorf("CalcMultiSigStats #%d (%s) wrong result\n"+ "got: %x\nwant: %x", i, test.name, err, test.expected) @@ -4744,13 +4744,13 @@ func TestHasCanonicalPushes(t *testing.T) { }, { name: "non-canonical push", - script: []byte{btcscript.OP_PUSHDATA1, 4, 1, 2, 3, 4}, + script: []byte{txscript.OP_PUSHDATA1, 4, 1, 2, 3, 4}, expected: false, }, } for i, test := range tests { - if btcscript.HasCanonicalPushes(test.script) != test.expected { + if txscript.HasCanonicalPushes(test.script) != test.expected { t.Errorf("HasCanonicalPushes #%d (%s) wrong result\n"+ "got: %v\nwant: %v", i, test.name, true, test.expected) @@ -4776,7 +4776,7 @@ func TestIsPushOnlyScript(t *testing.T) { expected: false, } - if btcscript.IsPushOnlyScript(test.script) != test.expected { + if txscript.IsPushOnlyScript(test.script) != test.expected { t.Errorf("IsPushOnlyScript (%s) wrong result\n"+ "got: %v\nwant: %v", test.name, true, test.expected) diff --git a/scriptbuilder.go b/txscript/scriptbuilder.go similarity index 97% rename from scriptbuilder.go rename to txscript/scriptbuilder.go index 566189df..3149b8d7 100644 --- a/scriptbuilder.go +++ b/txscript/scriptbuilder.go @@ -1,8 +1,8 @@ -// Copyright (c) 2013-2014 Conformal Systems LLC. +// Copyright (c) 2013-2015 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcscript +package txscript import ( "encoding/binary" @@ -38,10 +38,10 @@ func (e ErrScriptNotCanonical) Error() string { // For example, the following would build a 2-of-3 multisig script for usage in // a pay-to-script-hash (although in this situation MultiSigScript() would be a // better choice to generate the script): -// builder := btcscript.NewScriptBuilder() -// builder.AddOp(btcscript.OP_2).AddData(pubKey1).AddData(pubKey2) -// builder.AddData(pubKey3).AddOp(btcscript.OP_3) -// builder.AddOp(btcscript.OP_CHECKMULTISIG) +// builder := txscript.NewScriptBuilder() +// builder.AddOp(txscript.OP_2).AddData(pubKey1).AddData(pubKey2) +// builder.AddData(pubKey3).AddOp(txscript.OP_3) +// builder.AddOp(txscript.OP_CHECKMULTISIG) // script, err := builder.Script() // if err != nil { // // Handle the error. diff --git a/scriptbuilder_test.go b/txscript/scriptbuilder_test.go similarity index 61% rename from scriptbuilder_test.go rename to txscript/scriptbuilder_test.go index 198dfda2..296a1342 100644 --- a/scriptbuilder_test.go +++ b/txscript/scriptbuilder_test.go @@ -1,14 +1,14 @@ -// Copyright (c) 2013-2014 Conformal Systems LLC. +// Copyright (c) 2013-2015 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcscript_test +package txscript_test import ( "bytes" "testing" - "github.com/btcsuite/btcscript" + "github.com/btcsuite/btcd/txscript" ) // TestScriptBuilderAddOp tests that pushing opcodes to a script via the @@ -23,22 +23,22 @@ func TestScriptBuilderAddOp(t *testing.T) { }{ { name: "push OP_0", - opcodes: []byte{btcscript.OP_0}, - expected: []byte{btcscript.OP_0}, + opcodes: []byte{txscript.OP_0}, + expected: []byte{txscript.OP_0}, }, { name: "push OP_1 OP_2", - opcodes: []byte{btcscript.OP_1, btcscript.OP_2}, - expected: []byte{btcscript.OP_1, btcscript.OP_2}, + opcodes: []byte{txscript.OP_1, txscript.OP_2}, + expected: []byte{txscript.OP_1, txscript.OP_2}, }, { name: "push OP_HASH160 OP_EQUAL", - opcodes: []byte{btcscript.OP_HASH160, btcscript.OP_EQUAL}, - expected: []byte{btcscript.OP_HASH160, btcscript.OP_EQUAL}, + opcodes: []byte{txscript.OP_HASH160, txscript.OP_EQUAL}, + expected: []byte{txscript.OP_HASH160, txscript.OP_EQUAL}, }, } - builder := btcscript.NewScriptBuilder() + builder := txscript.NewScriptBuilder() t.Logf("Running %d tests", len(tests)) for i, test := range tests { builder.Reset() @@ -70,47 +70,47 @@ func TestScriptBuilderAddInt64(t *testing.T) { val int64 expected []byte }{ - {name: "push -1", val: -1, expected: []byte{btcscript.OP_1NEGATE}}, - {name: "push small int 0", val: 0, expected: []byte{btcscript.OP_0}}, - {name: "push small int 1", val: 1, expected: []byte{btcscript.OP_1}}, - {name: "push small int 2", val: 2, expected: []byte{btcscript.OP_2}}, - {name: "push small int 3", val: 3, expected: []byte{btcscript.OP_3}}, - {name: "push small int 4", val: 4, expected: []byte{btcscript.OP_4}}, - {name: "push small int 5", val: 5, expected: []byte{btcscript.OP_5}}, - {name: "push small int 6", val: 6, expected: []byte{btcscript.OP_6}}, - {name: "push small int 7", val: 7, expected: []byte{btcscript.OP_7}}, - {name: "push small int 8", val: 8, expected: []byte{btcscript.OP_8}}, - {name: "push small int 9", val: 9, expected: []byte{btcscript.OP_9}}, - {name: "push small int 10", val: 10, expected: []byte{btcscript.OP_10}}, - {name: "push small int 11", val: 11, expected: []byte{btcscript.OP_11}}, - {name: "push small int 12", val: 12, expected: []byte{btcscript.OP_12}}, - {name: "push small int 13", val: 13, expected: []byte{btcscript.OP_13}}, - {name: "push small int 14", val: 14, expected: []byte{btcscript.OP_14}}, - {name: "push small int 15", val: 15, expected: []byte{btcscript.OP_15}}, - {name: "push small int 16", val: 16, expected: []byte{btcscript.OP_16}}, - {name: "push 17", val: 17, expected: []byte{btcscript.OP_DATA_1, 0x11}}, - {name: "push 65", val: 65, expected: []byte{btcscript.OP_DATA_1, 0x41}}, - {name: "push 127", val: 127, expected: []byte{btcscript.OP_DATA_1, 0x7f}}, - {name: "push 128", val: 128, expected: []byte{btcscript.OP_DATA_2, 0x80, 0}}, - {name: "push 255", val: 255, expected: []byte{btcscript.OP_DATA_2, 0xff, 0}}, - {name: "push 256", val: 256, expected: []byte{btcscript.OP_DATA_2, 0, 0x01}}, - {name: "push 32767", val: 32767, expected: []byte{btcscript.OP_DATA_2, 0xff, 0x7f}}, - {name: "push 32768", val: 32768, expected: []byte{btcscript.OP_DATA_3, 0, 0x80, 0}}, - {name: "push -2", val: -2, expected: []byte{btcscript.OP_DATA_1, 0x82}}, - {name: "push -3", val: -3, expected: []byte{btcscript.OP_DATA_1, 0x83}}, - {name: "push -4", val: -4, expected: []byte{btcscript.OP_DATA_1, 0x84}}, - {name: "push -5", val: -5, expected: []byte{btcscript.OP_DATA_1, 0x85}}, - {name: "push -17", val: -17, expected: []byte{btcscript.OP_DATA_1, 0x91}}, - {name: "push -65", val: -65, expected: []byte{btcscript.OP_DATA_1, 0xc1}}, - {name: "push -127", val: -127, expected: []byte{btcscript.OP_DATA_1, 0xff}}, - {name: "push -128", val: -128, expected: []byte{btcscript.OP_DATA_2, 0x80, 0x80}}, - {name: "push -255", val: -255, expected: []byte{btcscript.OP_DATA_2, 0xff, 0x80}}, - {name: "push -256", val: -256, expected: []byte{btcscript.OP_DATA_2, 0x00, 0x81}}, - {name: "push -32767", val: -32767, expected: []byte{btcscript.OP_DATA_2, 0xff, 0xff}}, - {name: "push -32768", val: -32768, expected: []byte{btcscript.OP_DATA_3, 0x00, 0x80, 0x80}}, + {name: "push -1", val: -1, expected: []byte{txscript.OP_1NEGATE}}, + {name: "push small int 0", val: 0, expected: []byte{txscript.OP_0}}, + {name: "push small int 1", val: 1, expected: []byte{txscript.OP_1}}, + {name: "push small int 2", val: 2, expected: []byte{txscript.OP_2}}, + {name: "push small int 3", val: 3, expected: []byte{txscript.OP_3}}, + {name: "push small int 4", val: 4, expected: []byte{txscript.OP_4}}, + {name: "push small int 5", val: 5, expected: []byte{txscript.OP_5}}, + {name: "push small int 6", val: 6, expected: []byte{txscript.OP_6}}, + {name: "push small int 7", val: 7, expected: []byte{txscript.OP_7}}, + {name: "push small int 8", val: 8, expected: []byte{txscript.OP_8}}, + {name: "push small int 9", val: 9, expected: []byte{txscript.OP_9}}, + {name: "push small int 10", val: 10, expected: []byte{txscript.OP_10}}, + {name: "push small int 11", val: 11, expected: []byte{txscript.OP_11}}, + {name: "push small int 12", val: 12, expected: []byte{txscript.OP_12}}, + {name: "push small int 13", val: 13, expected: []byte{txscript.OP_13}}, + {name: "push small int 14", val: 14, expected: []byte{txscript.OP_14}}, + {name: "push small int 15", val: 15, expected: []byte{txscript.OP_15}}, + {name: "push small int 16", val: 16, expected: []byte{txscript.OP_16}}, + {name: "push 17", val: 17, expected: []byte{txscript.OP_DATA_1, 0x11}}, + {name: "push 65", val: 65, expected: []byte{txscript.OP_DATA_1, 0x41}}, + {name: "push 127", val: 127, expected: []byte{txscript.OP_DATA_1, 0x7f}}, + {name: "push 128", val: 128, expected: []byte{txscript.OP_DATA_2, 0x80, 0}}, + {name: "push 255", val: 255, expected: []byte{txscript.OP_DATA_2, 0xff, 0}}, + {name: "push 256", val: 256, expected: []byte{txscript.OP_DATA_2, 0, 0x01}}, + {name: "push 32767", val: 32767, expected: []byte{txscript.OP_DATA_2, 0xff, 0x7f}}, + {name: "push 32768", val: 32768, expected: []byte{txscript.OP_DATA_3, 0, 0x80, 0}}, + {name: "push -2", val: -2, expected: []byte{txscript.OP_DATA_1, 0x82}}, + {name: "push -3", val: -3, expected: []byte{txscript.OP_DATA_1, 0x83}}, + {name: "push -4", val: -4, expected: []byte{txscript.OP_DATA_1, 0x84}}, + {name: "push -5", val: -5, expected: []byte{txscript.OP_DATA_1, 0x85}}, + {name: "push -17", val: -17, expected: []byte{txscript.OP_DATA_1, 0x91}}, + {name: "push -65", val: -65, expected: []byte{txscript.OP_DATA_1, 0xc1}}, + {name: "push -127", val: -127, expected: []byte{txscript.OP_DATA_1, 0xff}}, + {name: "push -128", val: -128, expected: []byte{txscript.OP_DATA_2, 0x80, 0x80}}, + {name: "push -255", val: -255, expected: []byte{txscript.OP_DATA_2, 0xff, 0x80}}, + {name: "push -256", val: -256, expected: []byte{txscript.OP_DATA_2, 0x00, 0x81}}, + {name: "push -32767", val: -32767, expected: []byte{txscript.OP_DATA_2, 0xff, 0xff}}, + {name: "push -32768", val: -32768, expected: []byte{txscript.OP_DATA_3, 0x00, 0x80, 0x80}}, } - builder := btcscript.NewScriptBuilder() + builder := txscript.NewScriptBuilder() t.Logf("Running %d tests", len(tests)) for i, test := range tests { builder.Reset().AddInt64(test.val) @@ -139,34 +139,34 @@ func TestScriptBuilderAddUint64(t *testing.T) { val uint64 expected []byte }{ - {name: "push small int 0", val: 0, expected: []byte{btcscript.OP_0}}, - {name: "push small int 1", val: 1, expected: []byte{btcscript.OP_1}}, - {name: "push small int 2", val: 2, expected: []byte{btcscript.OP_2}}, - {name: "push small int 3", val: 3, expected: []byte{btcscript.OP_3}}, - {name: "push small int 4", val: 4, expected: []byte{btcscript.OP_4}}, - {name: "push small int 5", val: 5, expected: []byte{btcscript.OP_5}}, - {name: "push small int 6", val: 6, expected: []byte{btcscript.OP_6}}, - {name: "push small int 7", val: 7, expected: []byte{btcscript.OP_7}}, - {name: "push small int 8", val: 8, expected: []byte{btcscript.OP_8}}, - {name: "push small int 9", val: 9, expected: []byte{btcscript.OP_9}}, - {name: "push small int 10", val: 10, expected: []byte{btcscript.OP_10}}, - {name: "push small int 11", val: 11, expected: []byte{btcscript.OP_11}}, - {name: "push small int 12", val: 12, expected: []byte{btcscript.OP_12}}, - {name: "push small int 13", val: 13, expected: []byte{btcscript.OP_13}}, - {name: "push small int 14", val: 14, expected: []byte{btcscript.OP_14}}, - {name: "push small int 15", val: 15, expected: []byte{btcscript.OP_15}}, - {name: "push small int 16", val: 16, expected: []byte{btcscript.OP_16}}, - {name: "push 17", val: 17, expected: []byte{btcscript.OP_DATA_1, 0x11}}, - {name: "push 65", val: 65, expected: []byte{btcscript.OP_DATA_1, 0x41}}, - {name: "push 127", val: 127, expected: []byte{btcscript.OP_DATA_1, 0x7f}}, - {name: "push 128", val: 128, expected: []byte{btcscript.OP_DATA_2, 0x80, 0}}, - {name: "push 255", val: 255, expected: []byte{btcscript.OP_DATA_2, 0xff, 0}}, - {name: "push 256", val: 256, expected: []byte{btcscript.OP_DATA_2, 0, 0x01}}, - {name: "push 32767", val: 32767, expected: []byte{btcscript.OP_DATA_2, 0xff, 0x7f}}, - {name: "push 32768", val: 32768, expected: []byte{btcscript.OP_DATA_3, 0, 0x80, 0}}, + {name: "push small int 0", val: 0, expected: []byte{txscript.OP_0}}, + {name: "push small int 1", val: 1, expected: []byte{txscript.OP_1}}, + {name: "push small int 2", val: 2, expected: []byte{txscript.OP_2}}, + {name: "push small int 3", val: 3, expected: []byte{txscript.OP_3}}, + {name: "push small int 4", val: 4, expected: []byte{txscript.OP_4}}, + {name: "push small int 5", val: 5, expected: []byte{txscript.OP_5}}, + {name: "push small int 6", val: 6, expected: []byte{txscript.OP_6}}, + {name: "push small int 7", val: 7, expected: []byte{txscript.OP_7}}, + {name: "push small int 8", val: 8, expected: []byte{txscript.OP_8}}, + {name: "push small int 9", val: 9, expected: []byte{txscript.OP_9}}, + {name: "push small int 10", val: 10, expected: []byte{txscript.OP_10}}, + {name: "push small int 11", val: 11, expected: []byte{txscript.OP_11}}, + {name: "push small int 12", val: 12, expected: []byte{txscript.OP_12}}, + {name: "push small int 13", val: 13, expected: []byte{txscript.OP_13}}, + {name: "push small int 14", val: 14, expected: []byte{txscript.OP_14}}, + {name: "push small int 15", val: 15, expected: []byte{txscript.OP_15}}, + {name: "push small int 16", val: 16, expected: []byte{txscript.OP_16}}, + {name: "push 17", val: 17, expected: []byte{txscript.OP_DATA_1, 0x11}}, + {name: "push 65", val: 65, expected: []byte{txscript.OP_DATA_1, 0x41}}, + {name: "push 127", val: 127, expected: []byte{txscript.OP_DATA_1, 0x7f}}, + {name: "push 128", val: 128, expected: []byte{txscript.OP_DATA_2, 0x80, 0}}, + {name: "push 255", val: 255, expected: []byte{txscript.OP_DATA_2, 0xff, 0}}, + {name: "push 256", val: 256, expected: []byte{txscript.OP_DATA_2, 0, 0x01}}, + {name: "push 32767", val: 32767, expected: []byte{txscript.OP_DATA_2, 0xff, 0x7f}}, + {name: "push 32768", val: 32768, expected: []byte{txscript.OP_DATA_3, 0, 0x80, 0}}, } - builder := btcscript.NewScriptBuilder() + builder := txscript.NewScriptBuilder() t.Logf("Running %d tests", len(tests)) for i, test := range tests { builder.Reset().AddUint64(test.val) @@ -197,70 +197,70 @@ func TestScriptBuilderAddData(t *testing.T) { useFull bool // use AddFullData instead of AddData. }{ // BIP0062: Pushing an empty byte sequence must use OP_0. - {name: "push empty byte sequence", data: []byte{}, expected: []byte{btcscript.OP_0}}, - {name: "push 1 byte 0x00", data: []byte{0x00}, expected: []byte{btcscript.OP_0}}, + {name: "push empty byte sequence", data: []byte{}, expected: []byte{txscript.OP_0}}, + {name: "push 1 byte 0x00", data: []byte{0x00}, expected: []byte{txscript.OP_0}}, // BIP0062: Pushing a 1-byte sequence of byte 0x01 through 0x10 must use OP_n. - {name: "push 1 byte 0x01", data: []byte{0x01}, expected: []byte{btcscript.OP_1}}, - {name: "push 1 byte 0x02", data: []byte{0x02}, expected: []byte{btcscript.OP_2}}, - {name: "push 1 byte 0x03", data: []byte{0x03}, expected: []byte{btcscript.OP_3}}, - {name: "push 1 byte 0x04", data: []byte{0x04}, expected: []byte{btcscript.OP_4}}, - {name: "push 1 byte 0x05", data: []byte{0x05}, expected: []byte{btcscript.OP_5}}, - {name: "push 1 byte 0x06", data: []byte{0x06}, expected: []byte{btcscript.OP_6}}, - {name: "push 1 byte 0x07", data: []byte{0x07}, expected: []byte{btcscript.OP_7}}, - {name: "push 1 byte 0x08", data: []byte{0x08}, expected: []byte{btcscript.OP_8}}, - {name: "push 1 byte 0x09", data: []byte{0x09}, expected: []byte{btcscript.OP_9}}, - {name: "push 1 byte 0x0a", data: []byte{0x0a}, expected: []byte{btcscript.OP_10}}, - {name: "push 1 byte 0x0b", data: []byte{0x0b}, expected: []byte{btcscript.OP_11}}, - {name: "push 1 byte 0x0c", data: []byte{0x0c}, expected: []byte{btcscript.OP_12}}, - {name: "push 1 byte 0x0d", data: []byte{0x0d}, expected: []byte{btcscript.OP_13}}, - {name: "push 1 byte 0x0e", data: []byte{0x0e}, expected: []byte{btcscript.OP_14}}, - {name: "push 1 byte 0x0f", data: []byte{0x0f}, expected: []byte{btcscript.OP_15}}, - {name: "push 1 byte 0x10", data: []byte{0x10}, expected: []byte{btcscript.OP_16}}, + {name: "push 1 byte 0x01", data: []byte{0x01}, expected: []byte{txscript.OP_1}}, + {name: "push 1 byte 0x02", data: []byte{0x02}, expected: []byte{txscript.OP_2}}, + {name: "push 1 byte 0x03", data: []byte{0x03}, expected: []byte{txscript.OP_3}}, + {name: "push 1 byte 0x04", data: []byte{0x04}, expected: []byte{txscript.OP_4}}, + {name: "push 1 byte 0x05", data: []byte{0x05}, expected: []byte{txscript.OP_5}}, + {name: "push 1 byte 0x06", data: []byte{0x06}, expected: []byte{txscript.OP_6}}, + {name: "push 1 byte 0x07", data: []byte{0x07}, expected: []byte{txscript.OP_7}}, + {name: "push 1 byte 0x08", data: []byte{0x08}, expected: []byte{txscript.OP_8}}, + {name: "push 1 byte 0x09", data: []byte{0x09}, expected: []byte{txscript.OP_9}}, + {name: "push 1 byte 0x0a", data: []byte{0x0a}, expected: []byte{txscript.OP_10}}, + {name: "push 1 byte 0x0b", data: []byte{0x0b}, expected: []byte{txscript.OP_11}}, + {name: "push 1 byte 0x0c", data: []byte{0x0c}, expected: []byte{txscript.OP_12}}, + {name: "push 1 byte 0x0d", data: []byte{0x0d}, expected: []byte{txscript.OP_13}}, + {name: "push 1 byte 0x0e", data: []byte{0x0e}, expected: []byte{txscript.OP_14}}, + {name: "push 1 byte 0x0f", data: []byte{0x0f}, expected: []byte{txscript.OP_15}}, + {name: "push 1 byte 0x10", data: []byte{0x10}, expected: []byte{txscript.OP_16}}, // BIP0062: Pushing the byte 0x81 must use OP_1NEGATE. - {name: "push 1 byte 0x81", data: []byte{0x81}, expected: []byte{btcscript.OP_1NEGATE}}, + {name: "push 1 byte 0x81", data: []byte{0x81}, expected: []byte{txscript.OP_1NEGATE}}, // BIP0062: Pushing any other byte sequence up to 75 bytes must // use the normal data push (opcode byte n, with n the number of // bytes, followed n bytes of data being pushed). - {name: "push 1 byte 0x11", data: []byte{0x11}, expected: []byte{btcscript.OP_DATA_1, 0x11}}, - {name: "push 1 byte 0x80", data: []byte{0x80}, expected: []byte{btcscript.OP_DATA_1, 0x80}}, - {name: "push 1 byte 0x82", data: []byte{0x82}, expected: []byte{btcscript.OP_DATA_1, 0x82}}, - {name: "push 1 byte 0xff", data: []byte{0xff}, expected: []byte{btcscript.OP_DATA_1, 0xff}}, + {name: "push 1 byte 0x11", data: []byte{0x11}, expected: []byte{txscript.OP_DATA_1, 0x11}}, + {name: "push 1 byte 0x80", data: []byte{0x80}, expected: []byte{txscript.OP_DATA_1, 0x80}}, + {name: "push 1 byte 0x82", data: []byte{0x82}, expected: []byte{txscript.OP_DATA_1, 0x82}}, + {name: "push 1 byte 0xff", data: []byte{0xff}, expected: []byte{txscript.OP_DATA_1, 0xff}}, { name: "push data len 17", data: bytes.Repeat([]byte{0x49}, 17), - expected: append([]byte{btcscript.OP_DATA_17}, bytes.Repeat([]byte{0x49}, 17)...), + expected: append([]byte{txscript.OP_DATA_17}, bytes.Repeat([]byte{0x49}, 17)...), }, { name: "push data len 75", data: bytes.Repeat([]byte{0x49}, 75), - expected: append([]byte{btcscript.OP_DATA_75}, bytes.Repeat([]byte{0x49}, 75)...), + expected: append([]byte{txscript.OP_DATA_75}, bytes.Repeat([]byte{0x49}, 75)...), }, // BIP0062: Pushing 76 to 255 bytes must use OP_PUSHDATA1. { name: "push data len 76", data: bytes.Repeat([]byte{0x49}, 76), - expected: append([]byte{btcscript.OP_PUSHDATA1, 76}, bytes.Repeat([]byte{0x49}, 76)...), + expected: append([]byte{txscript.OP_PUSHDATA1, 76}, bytes.Repeat([]byte{0x49}, 76)...), }, { name: "push data len 255", data: bytes.Repeat([]byte{0x49}, 255), - expected: append([]byte{btcscript.OP_PUSHDATA1, 255}, bytes.Repeat([]byte{0x49}, 255)...), + expected: append([]byte{txscript.OP_PUSHDATA1, 255}, bytes.Repeat([]byte{0x49}, 255)...), }, // BIP0062: Pushing 256 to 520 bytes must use OP_PUSHDATA2. { name: "push data len 256", data: bytes.Repeat([]byte{0x49}, 256), - expected: append([]byte{btcscript.OP_PUSHDATA2, 0, 1}, bytes.Repeat([]byte{0x49}, 256)...), + expected: append([]byte{txscript.OP_PUSHDATA2, 0, 1}, bytes.Repeat([]byte{0x49}, 256)...), }, { name: "push data len 520", data: bytes.Repeat([]byte{0x49}, 520), - expected: append([]byte{btcscript.OP_PUSHDATA2, 0x08, 0x02}, bytes.Repeat([]byte{0x49}, 520)...), + expected: append([]byte{txscript.OP_PUSHDATA2, 0x08, 0x02}, bytes.Repeat([]byte{0x49}, 520)...), }, // BIP0062: OP_PUSHDATA4 can never be used, as pushes over 520 @@ -290,7 +290,7 @@ func TestScriptBuilderAddData(t *testing.T) { { name: "push data len 32767 (non-canonical)", data: bytes.Repeat([]byte{0x49}, 32767), - expected: append([]byte{btcscript.OP_PUSHDATA2, 255, 127}, bytes.Repeat([]byte{0x49}, 32767)...), + expected: append([]byte{txscript.OP_PUSHDATA2, 255, 127}, bytes.Repeat([]byte{0x49}, 32767)...), useFull: true, }, @@ -298,12 +298,12 @@ func TestScriptBuilderAddData(t *testing.T) { { name: "push data len 65536 (non-canonical)", data: bytes.Repeat([]byte{0x49}, 65536), - expected: append([]byte{btcscript.OP_PUSHDATA4, 0, 0, 1, 0}, bytes.Repeat([]byte{0x49}, 65536)...), + expected: append([]byte{txscript.OP_PUSHDATA4, 0, 0, 1, 0}, bytes.Repeat([]byte{0x49}, 65536)...), useFull: true, }, } - builder := btcscript.NewScriptBuilder() + builder := txscript.NewScriptBuilder() t.Logf("Running %d tests", len(tests)) for i, test := range tests { if !test.useFull { @@ -328,8 +328,8 @@ func TestExceedMaxScriptSize(t *testing.T) { t.Parallel() // Start off by constructing a max size script. - maxScriptSize := btcscript.TstMaxScriptSize - builder := btcscript.NewScriptBuilder() + maxScriptSize := txscript.TstMaxScriptSize + builder := txscript.NewScriptBuilder() builder.Reset().AddFullData(make([]byte, maxScriptSize-3)) origScript, err := builder.Script() if err != nil { @@ -339,7 +339,7 @@ func TestExceedMaxScriptSize(t *testing.T) { // Ensure adding data that would exceed the maximum size of the script // does not add the data. script, err := builder.AddData([]byte{0x00}).Script() - if _, ok := err.(btcscript.ErrScriptNotCanonical); !ok || err == nil { + if _, ok := err.(txscript.ErrScriptNotCanonical); !ok || err == nil { t.Fatalf("ScriptBuilder.AddData allowed exceeding max script "+ "size: %v", len(script)) } @@ -351,8 +351,8 @@ func TestExceedMaxScriptSize(t *testing.T) { // Ensure adding an opcode that would exceed the maximum size of the // script does not add the data. builder.Reset().AddFullData(make([]byte, maxScriptSize-3)) - script, err = builder.AddOp(btcscript.OP_0).Script() - if _, ok := err.(btcscript.ErrScriptNotCanonical); !ok || err == nil { + script, err = builder.AddOp(txscript.OP_0).Script() + if _, ok := err.(txscript.ErrScriptNotCanonical); !ok || err == nil { t.Fatalf("ScriptBuilder.AddOp unexpected modified script - "+ "got len %d, want len %d", len(script), len(origScript)) } @@ -365,7 +365,7 @@ func TestExceedMaxScriptSize(t *testing.T) { // script does not add the data. builder.Reset().AddFullData(make([]byte, maxScriptSize-3)) script, err = builder.AddInt64(0).Script() - if _, ok := err.(btcscript.ErrScriptNotCanonical); !ok || err == nil { + if _, ok := err.(txscript.ErrScriptNotCanonical); !ok || err == nil { t.Fatalf("ScriptBuilder.AddInt64 unexpected modified script - "+ "got len %d, want len %d", len(script), len(origScript)) } @@ -378,7 +378,7 @@ func TestExceedMaxScriptSize(t *testing.T) { // of the script does not add the data. builder.Reset().AddFullData(make([]byte, maxScriptSize-3)) script, err = builder.AddUint64(0).Script() - if _, ok := err.(btcscript.ErrScriptNotCanonical); !ok || err == nil { + if _, ok := err.(txscript.ErrScriptNotCanonical); !ok || err == nil { t.Fatalf("ScriptBuilder.AddUint64 unexpected modified script - "+ "got len %d, want len %d", len(script), len(origScript)) } @@ -396,15 +396,15 @@ func TestErroredScript(t *testing.T) { // Start off by constructing a near max size script that has enough // space left to add each data type without an error and force an // initial error condition. - maxScriptSize := btcscript.TstMaxScriptSize - builder := btcscript.NewScriptBuilder() + maxScriptSize := txscript.TstMaxScriptSize + builder := txscript.NewScriptBuilder() builder.Reset().AddFullData(make([]byte, maxScriptSize-8)) origScript, err := builder.Script() if err != nil { t.Fatalf("ScriptBuilder.AddFullData unexpected error: %v", err) } script, err := builder.AddData([]byte{0x00, 0x00, 0x00, 0x00, 0x00}).Script() - if _, ok := err.(btcscript.ErrScriptNotCanonical); !ok || err == nil { + if _, ok := err.(txscript.ErrScriptNotCanonical); !ok || err == nil { t.Fatalf("ScriptBuilder.AddData allowed exceeding max script "+ "size: %v", len(script)) } @@ -416,7 +416,7 @@ func TestErroredScript(t *testing.T) { // Ensure adding data, even using the non-canonical path, to a script // that has errored doesn't succeed. script, err = builder.AddFullData([]byte{0x00}).Script() - if _, ok := err.(btcscript.ErrScriptNotCanonical); !ok || err == nil { + if _, ok := err.(txscript.ErrScriptNotCanonical); !ok || err == nil { t.Fatal("ScriptBuilder.AddFullData succeeded on errored script") } if !bytes.Equal(script, origScript) { @@ -427,7 +427,7 @@ func TestErroredScript(t *testing.T) { // Ensure adding data to a script that has errored doesn't succeed. script, err = builder.AddData([]byte{0x00}).Script() - if _, ok := err.(btcscript.ErrScriptNotCanonical); !ok || err == nil { + if _, ok := err.(txscript.ErrScriptNotCanonical); !ok || err == nil { t.Fatal("ScriptBuilder.AddData succeeded on errored script") } if !bytes.Equal(script, origScript) { @@ -437,8 +437,8 @@ func TestErroredScript(t *testing.T) { } // Ensure adding an opcode to a script that has errored doesn't succeed. - script, err = builder.AddOp(btcscript.OP_0).Script() - if _, ok := err.(btcscript.ErrScriptNotCanonical); !ok || err == nil { + script, err = builder.AddOp(txscript.OP_0).Script() + if _, ok := err.(txscript.ErrScriptNotCanonical); !ok || err == nil { t.Fatal("ScriptBuilder.AddOp succeeded on errored script") } if !bytes.Equal(script, origScript) { @@ -449,7 +449,7 @@ func TestErroredScript(t *testing.T) { // Ensure adding an integer to a script that has errored doesn't // succeed. script, err = builder.AddInt64(0).Script() - if _, ok := err.(btcscript.ErrScriptNotCanonical); !ok || err == nil { + if _, ok := err.(txscript.ErrScriptNotCanonical); !ok || err == nil { t.Fatal("ScriptBuilder.AddInt64 succeeded on errored script") } if !bytes.Equal(script, origScript) { @@ -460,7 +460,7 @@ func TestErroredScript(t *testing.T) { // Ensure adding an unsigned integer to a script that has errored // doesn't succeed. script, err = builder.AddUint64(0).Script() - if _, ok := err.(btcscript.ErrScriptNotCanonical); !ok || err == nil { + if _, ok := err.(txscript.ErrScriptNotCanonical); !ok || err == nil { t.Fatal("ScriptBuilder.AddUint64 succeeded on errored script") } if !bytes.Equal(script, origScript) { diff --git a/stack.go b/txscript/stack.go similarity index 99% rename from stack.go rename to txscript/stack.go index 19aadf9f..c2fdba4a 100644 --- a/stack.go +++ b/txscript/stack.go @@ -1,8 +1,8 @@ -// Copyright (c) 2013-2014 Conformal Systems LLC. +// Copyright (c) 2013-2015 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcscript +package txscript import ( "encoding/hex" diff --git a/stack_test.go b/txscript/stack_test.go similarity index 78% rename from stack_test.go rename to txscript/stack_test.go index 0da1f1d6..63dab488 100644 --- a/stack_test.go +++ b/txscript/stack_test.go @@ -1,8 +1,8 @@ -// Copyright (c) 2013-2014 Conformal Systems LLC. +// Copyright (c) 2013-2015 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcscript_test +package txscript_test import ( "bytes" @@ -11,7 +11,7 @@ import ( "math/big" "testing" - "github.com/btcsuite/btcscript" + "github.com/btcsuite/btcd/txscript" ) // TestStack tests that all of the stack operations work as expected. @@ -21,14 +21,14 @@ func TestStack(t *testing.T) { tests := []struct { name string before [][]byte - operation func(*btcscript.Stack) error + operation func(*txscript.Stack) error expectedReturn error after [][]byte }{ { "noop", [][]byte{{1}, {2}, {3}, {4}, {5}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return nil }, nil, @@ -37,37 +37,37 @@ func TestStack(t *testing.T) { { "peek underflow (byte)", [][]byte{{1}, {2}, {3}, {4}, {5}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { _, err := stack.PeekByteArray(5) return err }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{}, }, { "peek underflow (int)", [][]byte{{1}, {2}, {3}, {4}, {5}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { _, err := stack.PeekInt(5) return err }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{}, }, { "peek underflow (bool)", [][]byte{{1}, {2}, {3}, {4}, {5}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { _, err := stack.PeekBool(5) return err }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{}, }, { "pop", [][]byte{{1}, {2}, {3}, {4}, {5}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { val, err := stack.PopByteArray() if err != nil { return err @@ -83,7 +83,7 @@ func TestStack(t *testing.T) { { "pop", [][]byte{{1}, {2}, {3}, {4}, {5}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { val, err := stack.PopByteArray() if err != nil { return err @@ -99,7 +99,7 @@ func TestStack(t *testing.T) { { "pop everything", [][]byte{{1}, {2}, {3}, {4}, {5}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { for i := 0; i < 5; i++ { _, err := stack.PopByteArray() if err != nil { @@ -114,7 +114,7 @@ func TestStack(t *testing.T) { { "pop underflow", [][]byte{{1}, {2}, {3}, {4}, {5}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { for i := 0; i < 6; i++ { _, err := stack.PopByteArray() if err != nil { @@ -123,13 +123,13 @@ func TestStack(t *testing.T) { } return nil }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{}, }, { "pop bool", [][]byte{{0}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { val, err := stack.PopBool() if err != nil { return err @@ -146,7 +146,7 @@ func TestStack(t *testing.T) { { "pop bool", [][]byte{{1}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { val, err := stack.PopBool() if err != nil { return err @@ -163,7 +163,7 @@ func TestStack(t *testing.T) { { "pop bool", [][]byte{}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { _, err := stack.PopBool() if err != nil { return err @@ -171,13 +171,13 @@ func TestStack(t *testing.T) { return nil }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{}, }, { "popInt 0", [][]byte{{0x0}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { v, err := stack.PopInt() if err != nil { return err @@ -193,7 +193,7 @@ func TestStack(t *testing.T) { { "popInt -0", [][]byte{{0x80}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { v, err := stack.PopInt() if err != nil { return err @@ -209,7 +209,7 @@ func TestStack(t *testing.T) { { "popInt 1", [][]byte{{0x01}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { v, err := stack.PopInt() if err != nil { return err @@ -225,7 +225,7 @@ func TestStack(t *testing.T) { { "popInt 1 leading 0", [][]byte{{0x01, 0x00, 0x00, 0x00}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { v, err := stack.PopInt() if err != nil { return err @@ -242,7 +242,7 @@ func TestStack(t *testing.T) { { "popInt -1", [][]byte{{0x81}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { v, err := stack.PopInt() if err != nil { return err @@ -258,7 +258,7 @@ func TestStack(t *testing.T) { { "popInt -1 leading 0", [][]byte{{0x01, 0x00, 0x00, 0x80}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { v, err := stack.PopInt() if err != nil { return err @@ -276,7 +276,7 @@ func TestStack(t *testing.T) { { "popInt -513", [][]byte{{0x1, 0x82}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { v, err := stack.PopInt() if err != nil { return err @@ -294,7 +294,7 @@ func TestStack(t *testing.T) { { "peekint nomodify -1", [][]byte{{0x01, 0x00, 0x00, 0x80}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { v, err := stack.PeekInt(0) if err != nil { return err @@ -311,7 +311,7 @@ func TestStack(t *testing.T) { { "PushInt 0", [][]byte{}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { stack.PushInt(big.NewInt(0)) return nil }, @@ -321,7 +321,7 @@ func TestStack(t *testing.T) { { "PushInt 1", [][]byte{}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { stack.PushInt(big.NewInt(1)) return nil }, @@ -331,7 +331,7 @@ func TestStack(t *testing.T) { { "PushInt -1", [][]byte{}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { stack.PushInt(big.NewInt(-1)) return nil }, @@ -341,7 +341,7 @@ func TestStack(t *testing.T) { { "PushInt two bytes", [][]byte{}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { stack.PushInt(big.NewInt(256)) return nil }, @@ -352,7 +352,7 @@ func TestStack(t *testing.T) { { "PushInt leading zeros", [][]byte{}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { // this will have the highbit set stack.PushInt(big.NewInt(128)) return nil @@ -363,7 +363,7 @@ func TestStack(t *testing.T) { { "dup", [][]byte{{1}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { err := stack.DupN(1) if err != nil { return err @@ -377,7 +377,7 @@ func TestStack(t *testing.T) { { "dup2", [][]byte{{1}, {2}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { err := stack.DupN(2) if err != nil { return err @@ -391,7 +391,7 @@ func TestStack(t *testing.T) { { "dup3", [][]byte{{1}, {2}, {3}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { err := stack.DupN(3) if err != nil { return err @@ -405,7 +405,7 @@ func TestStack(t *testing.T) { { "dup0", [][]byte{{1}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { err := stack.DupN(0) if err != nil { return err @@ -413,13 +413,13 @@ func TestStack(t *testing.T) { return nil }, - btcscript.ErrStackInvalidArgs, + txscript.ErrStackInvalidArgs, [][]byte{}, }, { "dup-1", [][]byte{{1}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { err := stack.DupN(-1) if err != nil { return err @@ -427,13 +427,13 @@ func TestStack(t *testing.T) { return nil }, - btcscript.ErrStackInvalidArgs, + txscript.ErrStackInvalidArgs, [][]byte{}, }, { "dup too much", [][]byte{{1}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { err := stack.DupN(2) if err != nil { return err @@ -441,13 +441,13 @@ func TestStack(t *testing.T) { return nil }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{}, }, { "dup-1", [][]byte{{1}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { err := stack.DupN(-1) if err != nil { return err @@ -455,13 +455,13 @@ func TestStack(t *testing.T) { return nil }, - btcscript.ErrStackInvalidArgs, + txscript.ErrStackInvalidArgs, [][]byte{}, }, { "PushBool true", [][]byte{}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { stack.PushBool(true) return nil @@ -472,7 +472,7 @@ func TestStack(t *testing.T) { { "PushBool false", [][]byte{}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { stack.PushBool(false) return nil @@ -483,7 +483,7 @@ func TestStack(t *testing.T) { { "PushBool PopBool", [][]byte{}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { stack.PushBool(true) val, err := stack.PopBool() if err != nil { @@ -501,7 +501,7 @@ func TestStack(t *testing.T) { { "PushBool PopBool 2", [][]byte{}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { stack.PushBool(false) val, err := stack.PopBool() if err != nil { @@ -519,7 +519,7 @@ func TestStack(t *testing.T) { { "PushInt PopBool", [][]byte{}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { stack.PushInt(big.NewInt(1)) val, err := stack.PopBool() if err != nil { @@ -537,7 +537,7 @@ func TestStack(t *testing.T) { { "PushInt PopBool 2", [][]byte{}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { stack.PushInt(big.NewInt(0)) val, err := stack.PopBool() if err != nil { @@ -555,7 +555,7 @@ func TestStack(t *testing.T) { { "PushInt PopBool 2", [][]byte{}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { stack.PushInt(big.NewInt(0)) val, err := stack.PopBool() if err != nil { @@ -573,7 +573,7 @@ func TestStack(t *testing.T) { { "Nip top", [][]byte{{1}, {2}, {3}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.NipN(0) }, nil, @@ -582,7 +582,7 @@ func TestStack(t *testing.T) { { "Nip middle", [][]byte{{1}, {2}, {3}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.NipN(1) }, nil, @@ -591,7 +591,7 @@ func TestStack(t *testing.T) { { "Nip low", [][]byte{{1}, {2}, {3}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.NipN(2) }, nil, @@ -600,27 +600,27 @@ func TestStack(t *testing.T) { { "Nip too much", [][]byte{{1}, {2}, {3}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { // bite off more than we can chew return stack.NipN(3) }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{{2}, {3}}, }, { "Nip too much", [][]byte{{1}, {2}, {3}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { // bite off more than we can chew return stack.NipN(3) }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{{2}, {3}}, }, { "keep on tucking", [][]byte{{1}, {2}, {3}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.Tuck() }, nil, @@ -629,25 +629,25 @@ func TestStack(t *testing.T) { { "a little tucked up", [][]byte{{1}}, // too few arguments for tuck - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.Tuck() }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{}, }, { "all tucked up", [][]byte{}, // too few arguments for tuck - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.Tuck() }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{}, }, { "drop 1", [][]byte{{1}, {2}, {3}, {4}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.DropN(1) }, nil, @@ -656,7 +656,7 @@ func TestStack(t *testing.T) { { "drop 2", [][]byte{{1}, {2}, {3}, {4}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.DropN(2) }, nil, @@ -665,7 +665,7 @@ func TestStack(t *testing.T) { { "drop 3", [][]byte{{1}, {2}, {3}, {4}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.DropN(3) }, nil, @@ -674,7 +674,7 @@ func TestStack(t *testing.T) { { "drop 4", [][]byte{{1}, {2}, {3}, {4}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.DropN(4) }, nil, @@ -683,25 +683,25 @@ func TestStack(t *testing.T) { { "drop 4/5", [][]byte{{1}, {2}, {3}, {4}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.DropN(5) }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{}, }, { "drop invalid", [][]byte{{1}, {2}, {3}, {4}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.DropN(0) }, - btcscript.ErrStackInvalidArgs, + txscript.ErrStackInvalidArgs, [][]byte{}, }, { "Rot1", [][]byte{{1}, {2}, {3}, {4}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.RotN(1) }, nil, @@ -710,7 +710,7 @@ func TestStack(t *testing.T) { { "Rot2", [][]byte{{1}, {2}, {3}, {4}, {5}, {6}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.RotN(2) }, nil, @@ -719,25 +719,25 @@ func TestStack(t *testing.T) { { "Rot too little", [][]byte{{1}, {2}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.RotN(1) }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{}, }, { "Rot0", [][]byte{{1}, {2}, {3}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.RotN(0) }, - btcscript.ErrStackInvalidArgs, + txscript.ErrStackInvalidArgs, [][]byte{}, }, { "Swap1", [][]byte{{1}, {2}, {3}, {4}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.SwapN(1) }, nil, @@ -746,7 +746,7 @@ func TestStack(t *testing.T) { { "Swap2", [][]byte{{1}, {2}, {3}, {4}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.SwapN(2) }, nil, @@ -755,25 +755,25 @@ func TestStack(t *testing.T) { { "Swap too little", [][]byte{{1}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.SwapN(1) }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{}, }, { "Swap0", [][]byte{{1}, {2}, {3}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.SwapN(0) }, - btcscript.ErrStackInvalidArgs, + txscript.ErrStackInvalidArgs, [][]byte{}, }, { "Over1", [][]byte{{1}, {2}, {3}, {4}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.OverN(1) }, nil, @@ -782,7 +782,7 @@ func TestStack(t *testing.T) { { "Over2", [][]byte{{1}, {2}, {3}, {4}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.OverN(2) }, nil, @@ -791,25 +791,25 @@ func TestStack(t *testing.T) { { "Over too little", [][]byte{{1}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.OverN(1) }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{}, }, { "Over0", [][]byte{{1}, {2}, {3}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.OverN(0) }, - btcscript.ErrStackInvalidArgs, + txscript.ErrStackInvalidArgs, [][]byte{}, }, { "Pick1", [][]byte{{1}, {2}, {3}, {4}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.PickN(1) }, nil, @@ -818,7 +818,7 @@ func TestStack(t *testing.T) { { "Pick2", [][]byte{{1}, {2}, {3}, {4}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.PickN(2) }, nil, @@ -827,16 +827,16 @@ func TestStack(t *testing.T) { { "Pick too little", [][]byte{{1}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.PickN(1) }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{}, }, { "Roll1", [][]byte{{1}, {2}, {3}, {4}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.RollN(1) }, nil, @@ -845,7 +845,7 @@ func TestStack(t *testing.T) { { "Roll2", [][]byte{{1}, {2}, {3}, {4}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.RollN(2) }, nil, @@ -854,16 +854,16 @@ func TestStack(t *testing.T) { { "Roll too little", [][]byte{{1}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { return stack.RollN(1) }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{}, }, { "Peek bool", [][]byte{{1}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { // Peek bool is otherwise pretty well tested, // just check it works. val, err := stack.PeekBool(0) @@ -881,7 +881,7 @@ func TestStack(t *testing.T) { { "Peek bool 2", [][]byte{{0}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { // Peek bool is otherwise pretty well tested, // just check it works. val, err := stack.PeekBool(0) @@ -899,7 +899,7 @@ func TestStack(t *testing.T) { { "Peek int", [][]byte{{1}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { // Peek int is otherwise pretty well tested, // just check it works. val, err := stack.PeekInt(0) @@ -917,7 +917,7 @@ func TestStack(t *testing.T) { { "Peek int 2", [][]byte{{0}}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { // Peek int is otherwise pretty well tested, // just check it works. val, err := stack.PeekInt(0) @@ -935,7 +935,7 @@ func TestStack(t *testing.T) { { "pop int", [][]byte{}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { stack.PushInt(big.NewInt(1)) // Peek int is otherwise pretty well tested, // just check it works. @@ -954,19 +954,19 @@ func TestStack(t *testing.T) { { "pop empty", [][]byte{}, - func(stack *btcscript.Stack) error { + func(stack *txscript.Stack) error { // Peek int is otherwise pretty well tested, // just check it works. _, err := stack.PopInt() return err }, - btcscript.ErrStackUnderflow, + txscript.ErrStackUnderflow, [][]byte{}, }, } for _, test := range tests { - stack := btcscript.Stack{} + stack := txscript.Stack{} for i := range test.before { stack.PushByteArray(test.before[i])