From c0c3d860d693c9d477c9d7c2ef8784c4b7b4c041 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sun, 12 Oct 2014 16:40:09 -0500 Subject: [PATCH] Convert all StackErrX to ErrStackX. This commit changes all stack errors from the form of StackErrX to ErrStackX which is the expected form for standard Go code. --- doc.go | 2 +- internal_test.go | 526 +++++++++++++++++++++++------------------------ opcode.go | 32 +-- opcode_test.go | 336 +++++++++++++++--------------- script.go | 130 ++++++------ script_test.go | 40 ++-- stack.go | 16 +- stack_test.go | 48 ++--- 8 files changed, 565 insertions(+), 565 deletions(-) diff --git a/doc.go b/doc.go index dccc6a88..64d9e095 100644 --- a/doc.go +++ b/doc.go @@ -32,7 +32,7 @@ what conditions must be met in order to spend bitcoins. Errors -Errors returned by this package are of the form btcscript.StackErrX where X +Errors returned by this package are of the form btcscript.ErrStackX where X indicates the specific error. See Variables in the package documentation for a full list. */ diff --git a/internal_test.go b/internal_test.go index 2bddf601..8193dc59 100644 --- a/internal_test.go +++ b/internal_test.go @@ -99,7 +99,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_FALSE], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_1 short", @@ -107,7 +107,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_1], data: nil, }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_1", @@ -123,7 +123,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_1], data: make([]byte, 2), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_2 short", @@ -131,7 +131,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_2], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_2", @@ -147,7 +147,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_2], data: make([]byte, 3), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_3 short", @@ -155,7 +155,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_3], data: make([]byte, 2), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_3", @@ -171,7 +171,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_3], data: make([]byte, 4), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_4 short", @@ -179,7 +179,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_4], data: make([]byte, 3), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_4", @@ -195,7 +195,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_4], data: make([]byte, 5), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_5 short", @@ -203,7 +203,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_5], data: make([]byte, 4), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_5", @@ -219,7 +219,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_5], data: make([]byte, 6), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_6 short", @@ -227,7 +227,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_6], data: make([]byte, 5), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_6", @@ -243,7 +243,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_6], data: make([]byte, 7), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_7 short", @@ -251,7 +251,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_7], data: make([]byte, 6), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_7", @@ -267,7 +267,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_7], data: make([]byte, 8), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_8 short", @@ -275,7 +275,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_8], data: make([]byte, 7), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_8", @@ -291,7 +291,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_8], data: make([]byte, 9), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_9 short", @@ -299,7 +299,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_9], data: make([]byte, 8), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_9", @@ -315,7 +315,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_9], data: make([]byte, 10), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_10 short", @@ -323,7 +323,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_10], data: make([]byte, 9), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_10", @@ -339,7 +339,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_10], data: make([]byte, 11), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_11 short", @@ -347,7 +347,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_11], data: make([]byte, 10), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_11", @@ -363,7 +363,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_11], data: make([]byte, 12), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_12 short", @@ -371,7 +371,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_12], data: make([]byte, 11), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_12", @@ -387,7 +387,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_12], data: make([]byte, 13), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_13 short", @@ -395,7 +395,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_13], data: make([]byte, 12), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_13", @@ -411,7 +411,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_13], data: make([]byte, 14), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_14 short", @@ -419,7 +419,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_14], data: make([]byte, 13), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_14", @@ -435,7 +435,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_14], data: make([]byte, 15), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_15 short", @@ -443,7 +443,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_15], data: make([]byte, 14), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_15", @@ -459,7 +459,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_15], data: make([]byte, 16), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_16 short", @@ -467,7 +467,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_16], data: make([]byte, 15), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_16", @@ -483,7 +483,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_16], data: make([]byte, 17), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_17 short", @@ -491,7 +491,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_17], data: make([]byte, 16), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_17", @@ -507,7 +507,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_17], data: make([]byte, 18), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_18 short", @@ -515,7 +515,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_18], data: make([]byte, 17), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_18", @@ -531,7 +531,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_18], data: make([]byte, 19), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_19 short", @@ -539,7 +539,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_19], data: make([]byte, 18), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_19", @@ -555,7 +555,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_19], data: make([]byte, 20), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_20 short", @@ -563,7 +563,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_20], data: make([]byte, 19), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_20", @@ -579,7 +579,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_20], data: make([]byte, 21), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_21 short", @@ -587,7 +587,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_21], data: make([]byte, 20), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_21", @@ -603,7 +603,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_21], data: make([]byte, 22), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_22 short", @@ -611,7 +611,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_22], data: make([]byte, 21), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_22", @@ -627,7 +627,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_22], data: make([]byte, 23), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_23 short", @@ -635,7 +635,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_23], data: make([]byte, 22), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_23", @@ -651,7 +651,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_23], data: make([]byte, 24), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_24 short", @@ -659,7 +659,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_24], data: make([]byte, 23), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_24", @@ -675,7 +675,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_24], data: make([]byte, 25), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_25 short", @@ -683,7 +683,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_25], data: make([]byte, 24), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_25", @@ -699,7 +699,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_25], data: make([]byte, 26), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_26 short", @@ -707,7 +707,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_26], data: make([]byte, 25), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_26", @@ -723,7 +723,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_26], data: make([]byte, 27), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_27 short", @@ -731,7 +731,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_27], data: make([]byte, 26), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_27", @@ -747,7 +747,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_27], data: make([]byte, 28), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_28 short", @@ -755,7 +755,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_28], data: make([]byte, 27), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_28", @@ -771,7 +771,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_28], data: make([]byte, 29), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_29 short", @@ -779,7 +779,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_29], data: make([]byte, 28), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_29", @@ -795,7 +795,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_29], data: make([]byte, 30), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_30 short", @@ -803,7 +803,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_30], data: make([]byte, 29), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_30", @@ -819,7 +819,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_30], data: make([]byte, 31), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_31 short", @@ -827,7 +827,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_31], data: make([]byte, 30), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_31", @@ -843,7 +843,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_31], data: make([]byte, 32), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_32 short", @@ -851,7 +851,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_32], data: make([]byte, 31), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_32", @@ -867,7 +867,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_32], data: make([]byte, 33), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_33 short", @@ -875,7 +875,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_33], data: make([]byte, 32), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_33", @@ -891,7 +891,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_33], data: make([]byte, 34), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_34 short", @@ -899,7 +899,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_34], data: make([]byte, 33), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_34", @@ -915,7 +915,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_34], data: make([]byte, 35), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_35 short", @@ -923,7 +923,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_35], data: make([]byte, 34), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_35", @@ -939,7 +939,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_35], data: make([]byte, 36), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_36 short", @@ -947,7 +947,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_36], data: make([]byte, 35), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_36", @@ -963,7 +963,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_36], data: make([]byte, 37), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_37 short", @@ -971,7 +971,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_37], data: make([]byte, 36), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_37", @@ -987,7 +987,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_37], data: make([]byte, 38), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_38 short", @@ -995,7 +995,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_38], data: make([]byte, 37), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_38", @@ -1011,7 +1011,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_38], data: make([]byte, 39), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_39 short", @@ -1019,7 +1019,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_39], data: make([]byte, 38), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_39", @@ -1035,7 +1035,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_39], data: make([]byte, 40), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_40 short", @@ -1043,7 +1043,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_40], data: make([]byte, 39), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_40", @@ -1059,7 +1059,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_40], data: make([]byte, 41), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_41 short", @@ -1067,7 +1067,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_41], data: make([]byte, 40), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_41", @@ -1083,7 +1083,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_41], data: make([]byte, 42), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_42 short", @@ -1091,7 +1091,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_42], data: make([]byte, 41), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_42", @@ -1107,7 +1107,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_42], data: make([]byte, 43), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_43 short", @@ -1115,7 +1115,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_43], data: make([]byte, 42), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_43", @@ -1131,7 +1131,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_43], data: make([]byte, 44), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_44 short", @@ -1139,7 +1139,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_44], data: make([]byte, 43), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_44", @@ -1155,7 +1155,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_44], data: make([]byte, 45), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_45 short", @@ -1163,7 +1163,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_45], data: make([]byte, 44), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_45", @@ -1179,7 +1179,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_45], data: make([]byte, 46), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_46 short", @@ -1187,7 +1187,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_46], data: make([]byte, 45), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_46", @@ -1203,7 +1203,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_46], data: make([]byte, 47), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_47 short", @@ -1211,7 +1211,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_47], data: make([]byte, 46), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_47", @@ -1227,7 +1227,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_47], data: make([]byte, 48), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_48 short", @@ -1235,7 +1235,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_48], data: make([]byte, 47), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_48", @@ -1251,7 +1251,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_48], data: make([]byte, 49), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_49 short", @@ -1259,7 +1259,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_49], data: make([]byte, 48), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_49", @@ -1275,7 +1275,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_49], data: make([]byte, 50), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_50 short", @@ -1283,7 +1283,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_50], data: make([]byte, 49), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_50", @@ -1299,7 +1299,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_50], data: make([]byte, 51), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_51 short", @@ -1307,7 +1307,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_51], data: make([]byte, 50), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_51", @@ -1323,7 +1323,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_51], data: make([]byte, 52), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_52 short", @@ -1331,7 +1331,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_52], data: make([]byte, 51), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_52", @@ -1347,7 +1347,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_52], data: make([]byte, 53), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_53 short", @@ -1355,7 +1355,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_53], data: make([]byte, 52), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_53", @@ -1371,7 +1371,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_53], data: make([]byte, 54), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_54 short", @@ -1379,7 +1379,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_54], data: make([]byte, 53), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_54", @@ -1395,7 +1395,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_54], data: make([]byte, 55), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_55 short", @@ -1403,7 +1403,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_55], data: make([]byte, 54), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_55", @@ -1419,7 +1419,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_55], data: make([]byte, 56), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_56 short", @@ -1427,7 +1427,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_56], data: make([]byte, 55), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_56", @@ -1443,7 +1443,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_56], data: make([]byte, 57), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_57 short", @@ -1451,7 +1451,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_57], data: make([]byte, 56), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_57", @@ -1467,7 +1467,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_57], data: make([]byte, 58), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_58 short", @@ -1475,7 +1475,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_58], data: make([]byte, 57), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_58", @@ -1491,7 +1491,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_58], data: make([]byte, 59), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_59 short", @@ -1499,7 +1499,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_59], data: make([]byte, 58), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_59", @@ -1515,7 +1515,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_59], data: make([]byte, 60), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_60 short", @@ -1523,7 +1523,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_60], data: make([]byte, 59), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_60", @@ -1539,7 +1539,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_60], data: make([]byte, 61), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_61 short", @@ -1547,7 +1547,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_61], data: make([]byte, 60), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_61", @@ -1563,7 +1563,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_61], data: make([]byte, 62), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_62 short", @@ -1571,7 +1571,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_62], data: make([]byte, 61), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_62", @@ -1587,7 +1587,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_62], data: make([]byte, 63), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_63 short", @@ -1595,7 +1595,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_63], data: make([]byte, 62), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_63", @@ -1611,7 +1611,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_63], data: make([]byte, 64), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_64 short", @@ -1619,7 +1619,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_64], data: make([]byte, 63), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_64", @@ -1635,7 +1635,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_64], data: make([]byte, 65), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_65 short", @@ -1643,7 +1643,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_65], data: make([]byte, 64), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_65", @@ -1659,7 +1659,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_65], data: make([]byte, 66), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_66 short", @@ -1667,7 +1667,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_66], data: make([]byte, 65), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_66", @@ -1683,7 +1683,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_66], data: make([]byte, 67), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_67 short", @@ -1691,7 +1691,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_67], data: make([]byte, 66), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_67", @@ -1707,7 +1707,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_67], data: make([]byte, 68), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_68 short", @@ -1715,7 +1715,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_68], data: make([]byte, 67), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_68", @@ -1731,7 +1731,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_68], data: make([]byte, 69), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_69 short", @@ -1739,7 +1739,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_69], data: make([]byte, 68), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_69", @@ -1755,7 +1755,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_69], data: make([]byte, 70), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_70 short", @@ -1763,7 +1763,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_70], data: make([]byte, 69), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_70", @@ -1779,7 +1779,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_70], data: make([]byte, 71), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_71 short", @@ -1787,7 +1787,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_71], data: make([]byte, 70), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_71", @@ -1803,7 +1803,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_71], data: make([]byte, 72), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_72 short", @@ -1811,7 +1811,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_72], data: make([]byte, 71), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_72", @@ -1827,7 +1827,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_72], data: make([]byte, 73), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_73 short", @@ -1835,7 +1835,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_73], data: make([]byte, 72), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_73", @@ -1851,7 +1851,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_73], data: make([]byte, 74), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_74 short", @@ -1859,7 +1859,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_74], data: make([]byte, 73), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_74", @@ -1875,7 +1875,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_74], data: make([]byte, 75), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_75 short", @@ -1883,7 +1883,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_75], data: make([]byte, 74), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DATA_75", @@ -1899,7 +1899,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DATA_75], data: make([]byte, 76), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_PUSHDATA1", @@ -1939,7 +1939,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_1NEGATE], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_RESERVED", @@ -1955,7 +1955,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_RESERVED], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_TRUE", @@ -1971,7 +1971,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_TRUE], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_2", @@ -1987,7 +1987,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_2], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_2", @@ -2003,7 +2003,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_2], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_3", @@ -2019,7 +2019,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_3], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_4", @@ -2035,7 +2035,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_4], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_5", @@ -2051,7 +2051,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_5], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_6", @@ -2067,7 +2067,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_6], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_7", @@ -2083,7 +2083,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_7], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_8", @@ -2099,7 +2099,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_8], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_9", @@ -2115,7 +2115,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_9], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_10", @@ -2131,7 +2131,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_10], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_11", @@ -2147,7 +2147,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_11], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_12", @@ -2163,7 +2163,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_12], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_13", @@ -2179,7 +2179,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_13], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_14", @@ -2195,7 +2195,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_14], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_15", @@ -2211,7 +2211,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_15], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_16", @@ -2227,7 +2227,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_16], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NOP", @@ -2243,7 +2243,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NOP], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_VER", @@ -2259,7 +2259,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_VER], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_IF", @@ -2275,7 +2275,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_IF], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NOTIF", @@ -2291,7 +2291,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NOTIF], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_VERIF", @@ -2307,7 +2307,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_VERIF], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_VERNOTIF", @@ -2323,7 +2323,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_VERNOTIF], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_ELSE", @@ -2339,7 +2339,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_ELSE], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_ENDIF", @@ -2355,7 +2355,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_ENDIF], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_VERIFY", @@ -2371,7 +2371,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_VERIFY], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_RETURN", @@ -2387,7 +2387,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_RETURN], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_TOALTSTACK", @@ -2403,7 +2403,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_TOALTSTACK], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_FROMALTSTACK", @@ -2419,7 +2419,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_FROMALTSTACK], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_2DROP", @@ -2435,7 +2435,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_2DROP], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_2DUP", @@ -2451,7 +2451,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_2DUP], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_3DUP", @@ -2467,7 +2467,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_3DUP], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_2OVER", @@ -2483,7 +2483,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_2OVER], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_2ROT", @@ -2499,7 +2499,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_2ROT], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_2SWAP", @@ -2515,7 +2515,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_2SWAP], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_IFDUP", @@ -2531,7 +2531,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_IFDUP], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DEPTH", @@ -2547,7 +2547,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DEPTH], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DROP", @@ -2563,7 +2563,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DROP], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DUP", @@ -2579,7 +2579,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DUP], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NIP", @@ -2595,7 +2595,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NIP], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_OVER", @@ -2611,7 +2611,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_OVER], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_PICK", @@ -2627,7 +2627,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_PICK], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_ROLL", @@ -2643,7 +2643,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_ROLL], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_ROT", @@ -2659,7 +2659,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_ROT], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_SWAP", @@ -2675,7 +2675,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_SWAP], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_TUCK", @@ -2691,7 +2691,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_TUCK], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_CAT", @@ -2707,7 +2707,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_CAT], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_SUBSTR", @@ -2723,7 +2723,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_SUBSTR], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_LEFT", @@ -2739,7 +2739,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_LEFT], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_LEFT", @@ -2755,7 +2755,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_LEFT], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_RIGHT", @@ -2771,7 +2771,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_RIGHT], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_SIZE", @@ -2787,7 +2787,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_SIZE], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_INVERT", @@ -2803,7 +2803,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_INVERT], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_AND", @@ -2819,7 +2819,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_AND], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_OR", @@ -2835,7 +2835,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_OR], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_XOR", @@ -2851,7 +2851,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_XOR], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_EQUAL", @@ -2867,7 +2867,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_EQUAL], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_EQUALVERIFY", @@ -2883,7 +2883,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_EQUALVERIFY], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_RESERVED1", @@ -2899,7 +2899,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_RESERVED1], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_RESERVED2", @@ -2915,7 +2915,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_RESERVED2], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_1ADD", @@ -2931,7 +2931,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_1ADD], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_1SUB", @@ -2947,7 +2947,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_1SUB], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_2MUL", @@ -2963,7 +2963,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_2MUL], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_2DIV", @@ -2979,7 +2979,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_2DIV], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NEGATE", @@ -2995,7 +2995,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NEGATE], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_ABS", @@ -3011,7 +3011,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_ABS], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NOT", @@ -3027,7 +3027,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NOT], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_0NOTEQUAL", @@ -3043,7 +3043,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_0NOTEQUAL], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_ADD", @@ -3059,7 +3059,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_ADD], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_SUB", @@ -3075,7 +3075,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_SUB], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_MUL", @@ -3091,7 +3091,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_MUL], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_DIV", @@ -3107,7 +3107,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_DIV], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_MOD", @@ -3123,7 +3123,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_MOD], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_LSHIFT", @@ -3139,7 +3139,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_LSHIFT], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_RSHIFT", @@ -3155,7 +3155,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_RSHIFT], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_BOOLAND", @@ -3171,7 +3171,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_BOOLAND], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_BOOLOR", @@ -3187,7 +3187,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_BOOLOR], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NUMEQUAL", @@ -3203,7 +3203,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NUMEQUAL], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NUMEQUALVERIFY", @@ -3219,7 +3219,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NUMEQUALVERIFY], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NUMNOTEQUAL", @@ -3235,7 +3235,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NUMNOTEQUAL], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_LESSTHAN", @@ -3251,7 +3251,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_LESSTHAN], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_GREATERTHAN", @@ -3267,7 +3267,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_GREATERTHAN], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_LESSTHANOREQUAL", @@ -3283,7 +3283,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_LESSTHANOREQUAL], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_GREATERTHANOREQUAL", @@ -3299,7 +3299,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_GREATERTHANOREQUAL], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_MIN", @@ -3315,7 +3315,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_MIN], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_MAX", @@ -3331,7 +3331,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_MAX], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_WITHIN", @@ -3347,7 +3347,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_WITHIN], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_RIPEMD160", @@ -3363,7 +3363,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_RIPEMD160], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_SHA1", @@ -3379,7 +3379,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_SHA1], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_SHA256", @@ -3395,7 +3395,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_SHA256], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_HASH160", @@ -3411,7 +3411,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_HASH160], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_HASH256", @@ -3427,7 +3427,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_HASH256], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_CODESAPERATOR", @@ -3443,7 +3443,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_CODESEPARATOR], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_CHECKSIG", @@ -3459,7 +3459,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_CHECKSIG], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_CHECKSIGVERIFY", @@ -3475,7 +3475,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_CHECKSIGVERIFY], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_CHECKMULTISIG", @@ -3491,7 +3491,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_CHECKMULTISIG], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_CHECKMULTISIGVERIFY", @@ -3507,7 +3507,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_CHECKMULTISIGVERIFY], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NOP1", @@ -3523,7 +3523,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NOP1], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NOP2", @@ -3539,7 +3539,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NOP2], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NOP3", @@ -3555,7 +3555,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NOP3], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NOP4", @@ -3571,7 +3571,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NOP4], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NOP5", @@ -3587,7 +3587,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NOP5], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NOP6", @@ -3603,7 +3603,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NOP6], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NOP7", @@ -3619,7 +3619,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NOP7], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NOP8", @@ -3635,7 +3635,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NOP8], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NOP9", @@ -3651,7 +3651,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NOP9], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_NOP10", @@ -3667,7 +3667,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_NOP10], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_PUBKEYHASH", @@ -3683,7 +3683,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_PUBKEYHASH], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_PUBKEY", @@ -3699,7 +3699,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_PUBKEY], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, { name: "OP_INVALIDOPCODE", @@ -3715,7 +3715,7 @@ var popTests = []popTest{ opcode: opcodemapPreinit[OP_INVALIDOPCODE], data: make([]byte, 1), }, - expectedErr: StackErrInvalidOpcode, + expectedErr: ErrStackInvalidOpcode, }, } diff --git a/opcode.go b/opcode.go index 4fb85dd8..aa983b0a 100644 --- a/opcode.go +++ b/opcode.go @@ -939,23 +939,23 @@ func (pop *parsedOpcode) conditional() bool { func (pop *parsedOpcode) exec(s *Script) error { // Disabled opcodes are ``fail on program counter''. if pop.disabled() { - return StackErrOpDisabled + return ErrStackOpDisabled } // Always-illegal opcodes are ``fail on program counter''. if pop.alwaysIllegal() { - return StackErrReservedOpcode + return ErrStackReservedOpcode } // Note that this includes OP_RESERVED which counts as a push operation. if pop.opcode.value > OP_16 { s.numOps++ if s.numOps > MaxOpsPerScript { - return StackErrTooManyOperations + return ErrStackTooManyOperations } } else if len(pop.data) > MaxScriptElementSize { - return StackErrElementTooBig + return ErrStackElementTooBig } // If we are not a conditional opcode and we aren't executing, then @@ -1012,7 +1012,7 @@ func (pop *parsedOpcode) bytes() ([]byte, error) { retbytes[0] = pop.opcode.value if pop.opcode.length == 1 { if len(pop.data) != 0 { - return nil, StackErrInvalidOpcode + return nil, ErrStackInvalidOpcode } return retbytes, nil } @@ -1041,7 +1041,7 @@ func (pop *parsedOpcode) bytes() ([]byte, error) { retbytes = append(retbytes, pop.data...) if len(retbytes) != nbytes { - return nil, StackErrInvalidOpcode + return nil, ErrStackInvalidOpcode } return retbytes, nil @@ -1050,16 +1050,16 @@ func (pop *parsedOpcode) bytes() ([]byte, error) { // opcode implementation functions from here func opcodeDisabled(op *parsedOpcode, s *Script) error { - return StackErrOpDisabled + return ErrStackOpDisabled } func opcodeReserved(op *parsedOpcode, s *Script) error { - return StackErrReservedOpcode + return ErrStackReservedOpcode } // Recognised opcode, but for bitcoind internal use only. func opcodeInvalid(op *parsedOpcode, s *Script) error { - return StackErrInvalidOpcode + return ErrStackInvalidOpcode } func opcodeFalse(op *parsedOpcode, s *Script) error { @@ -1141,7 +1141,7 @@ func opcodeNotIf(op *parsedOpcode, s *Script) error { func opcodeElse(op *parsedOpcode, s *Script) error { if len(s.condStack) < 2 { // intial true cannot be toggled, only pushed conditionals - return StackErrNoIf + return ErrStackNoIf } switch s.condStack[0] { @@ -1160,7 +1160,7 @@ func opcodeElse(op *parsedOpcode, s *Script) error { func opcodeEndif(op *parsedOpcode, s *Script) error { if len(s.condStack) < 2 { // intial true cannot be popped, only pushed conditionals - return StackErrNoIf + return ErrStackNoIf } stk := make([]int, len(s.condStack)-1, len(s.condStack)-1) @@ -1176,13 +1176,13 @@ func opcodeVerify(op *parsedOpcode, s *Script) error { } if verified != true { - return StackErrVerifyFailed + return ErrStackVerifyFailed } return nil } func opcodeReturn(op *parsedOpcode, s *Script) error { - return StackErrEarlyReturn + return ErrStackEarlyReturn } func opcodeToAltStack(op *parsedOpcode, s *Script) error { @@ -1839,16 +1839,16 @@ func opcodeCheckMultiSig(op *parsedOpcode, s *Script) error { } // XXX arbitrary limits - // nore more than 20 pubkeyhs, or 201 operations + // nore more than 20 pubkeys, or 201 operations // PopInt promises that the int returned is 32 bit. npk := int(numPubkeys.Int64()) if npk < 0 || npk > MaxPubKeysPerMultiSig { - return StackErrTooManyPubkeys + return ErrStackTooManyPubkeys } s.numOps += npk if s.numOps > MaxOpsPerScript { - return StackErrTooManyOperations + return ErrStackTooManyOperations } pubKeyStrings := make([][]byte, npk) pubKeys := make([]*btcec.PublicKey, npk) diff --git a/opcode_test.go b/opcode_test.go index 0d95e571..6bed4c31 100644 --- a/opcode_test.go +++ b/opcode_test.go @@ -363,15 +363,15 @@ var opcodeTests = []opcodeTest{ {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.StackErrMissingEndif}, - {script: []byte{btcscript.OP_1, btcscript.OP_NOTIF, btcscript.OP_0, btcscript.OP_ELSE, btcscript.OP_2}, shouldFail: btcscript.StackErrMissingEndif}, + {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.StackErrUnderflow}, + {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.StackErrUnderflow}, - {script: []byte{btcscript.OP_ELSE, btcscript.OP_0, btcscript.OP_ENDIF}, shouldFail: btcscript.StackErrNoIf}, - {script: []byte{btcscript.OP_ENDIF}, shouldFail: btcscript.StackErrNoIf}, + {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}, /* up here because error from sig parsing is undefined. */ {script: []byte{btcscript.OP_1, btcscript.OP_1, btcscript.OP_DATA_65, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, @@ -586,7 +586,7 @@ var detailedTests = []detailedTest{ name: "dup too much", before: [][]byte{}, script: []byte{btcscript.OP_DUP}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, after: [][]byte{}, disassembly: "OP_DUP", }, @@ -594,7 +594,7 @@ var detailedTests = []detailedTest{ name: "2dup too much", before: [][]byte{{1}}, script: []byte{btcscript.OP_2DUP}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, after: [][]byte{}, disassembly: "OP_2DUP", }, @@ -602,7 +602,7 @@ var detailedTests = []detailedTest{ name: "2dup way too much", before: [][]byte{}, script: []byte{btcscript.OP_2DUP}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, after: [][]byte{}, disassembly: "OP_2DUP", }, @@ -610,7 +610,7 @@ var detailedTests = []detailedTest{ name: "3dup too much", before: [][]byte{{1}, {2}}, script: []byte{btcscript.OP_3DUP}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, after: [][]byte{}, disassembly: "OP_3DUP", }, @@ -618,7 +618,7 @@ var detailedTests = []detailedTest{ name: "3dup kinda too much", before: [][]byte{{1}}, script: []byte{btcscript.OP_3DUP}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, after: [][]byte{}, disassembly: "OP_3DUP", }, @@ -626,7 +626,7 @@ var detailedTests = []detailedTest{ name: "3dup way too much", before: [][]byte{}, script: []byte{btcscript.OP_3DUP}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, after: [][]byte{}, disassembly: "OP_3DUP", }, @@ -641,7 +641,7 @@ var detailedTests = []detailedTest{ name: "Nip too much", before: [][]byte{{1}}, script: []byte{btcscript.OP_NIP}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, after: [][]byte{{2}, {3}}, disassembly: "OP_NIP", }, @@ -656,7 +656,7 @@ var detailedTests = []detailedTest{ name: "a little tucked up", before: [][]byte{{1}}, // too few arguments for tuck script: []byte{btcscript.OP_TUCK}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, after: [][]byte{}, disassembly: "OP_TUCK", }, @@ -664,7 +664,7 @@ var detailedTests = []detailedTest{ name: "all tucked up", before: [][]byte{}, // too few arguments for tuck script: []byte{btcscript.OP_TUCK}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_TUCK", }, { @@ -685,21 +685,21 @@ var detailedTests = []detailedTest{ name: "drop too much", before: [][]byte{}, script: []byte{btcscript.OP_DROP}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_DROP", }, { name: "2drop too much", before: [][]byte{{1}}, script: []byte{btcscript.OP_2DROP}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_2DROP", }, { name: "2drop far too much", before: [][]byte{}, script: []byte{btcscript.OP_2DROP}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_2DROP", }, { @@ -720,7 +720,7 @@ var detailedTests = []detailedTest{ name: "Rot too little", before: [][]byte{{1}, {2}}, script: []byte{btcscript.OP_ROT}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_ROT", }, { @@ -741,7 +741,7 @@ var detailedTests = []detailedTest{ name: "Swap too little", before: [][]byte{{1}}, script: []byte{btcscript.OP_SWAP}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_SWAP", }, { @@ -762,7 +762,7 @@ var detailedTests = []detailedTest{ name: "Over too little", before: [][]byte{{1}}, script: []byte{btcscript.OP_OVER}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_OVER", }, { @@ -783,28 +783,28 @@ var detailedTests = []detailedTest{ name: "Pick too little", before: [][]byte{{1}, {1}}, script: []byte{btcscript.OP_PICK}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_PICK", }, { name: "Pick nothing", before: [][]byte{{}}, script: []byte{btcscript.OP_PICK}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_PICK", }, { name: "Pick no args", before: [][]byte{}, script: []byte{btcscript.OP_PICK}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.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.StackErrNumberTooBig, + expectedReturn: btcscript.ErrStackNumberTooBig, disassembly: "OP_PICK", }, { @@ -825,28 +825,28 @@ var detailedTests = []detailedTest{ name: "Roll too little", before: [][]byte{{1}, {1}}, script: []byte{btcscript.OP_ROLL}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_ROLL", }, { name: "Roll nothing ", before: [][]byte{{1}}, script: []byte{btcscript.OP_ROLL}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_ROLL", }, { name: "Roll no args ", before: [][]byte{}, script: []byte{btcscript.OP_ROLL}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.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.StackErrNumberTooBig, + expectedReturn: btcscript.ErrStackNumberTooBig, disassembly: "OP_ROLL", }, { @@ -867,7 +867,7 @@ var detailedTests = []detailedTest{ name: "ifdup (empty)", before: [][]byte{}, script: []byte{btcscript.OP_IFDUP}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, after: [][]byte{{0}}, disassembly: "OP_IFDUP", }, @@ -886,7 +886,7 @@ var detailedTests = []detailedTest{ before: [][]byte{}, altbefore: [][]byte{}, script: []byte{btcscript.OP_TOALTSTACK}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_TOALTSTACK", }, { @@ -903,7 +903,7 @@ var detailedTests = []detailedTest{ before: [][]byte{}, altbefore: [][]byte{}, script: []byte{btcscript.OP_FROMALTSTACK}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_FROMALTSTACK", }, { @@ -932,7 +932,7 @@ var detailedTests = []detailedTest{ name: "op_size (invalid)", before: [][]byte{}, script: []byte{btcscript.OP_SIZE}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_SIZE", }, { @@ -953,7 +953,7 @@ var detailedTests = []detailedTest{ name: "OP_EQUAL (one arg)", before: [][]byte{{1, 2, 3, 4}}, script: []byte{btcscript.OP_EQUAL}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, after: [][]byte{{0}}, disassembly: "OP_EQUAL", }, @@ -961,7 +961,7 @@ var detailedTests = []detailedTest{ name: "OP_EQUAL (no arg)", before: [][]byte{}, script: []byte{btcscript.OP_EQUAL}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, after: [][]byte{{0}}, disassembly: "OP_EQUAL", }, @@ -976,7 +976,7 @@ var detailedTests = []detailedTest{ name: "OP_EQUALVERIFY (invalid)", before: [][]byte{{1, 2, 3, 4}, {1, 2, 3, 3}}, script: []byte{btcscript.OP_EQUALVERIFY}, - expectedReturn: btcscript.StackErrVerifyFailed, + expectedReturn: btcscript.ErrStackVerifyFailed, after: [][]byte{}, disassembly: "OP_EQUALVERIFY", }, @@ -984,14 +984,14 @@ var detailedTests = []detailedTest{ name: "OP_EQUALVERIFY (one arg)", before: [][]byte{{1, 2, 3, 4}}, script: []byte{btcscript.OP_EQUALVERIFY}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_EQUALVERIFY", }, { name: "OP_EQUALVERIFY (no arg)", before: [][]byte{}, script: []byte{btcscript.OP_EQUALVERIFY}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_EQUALVERIFY", }, { @@ -1026,7 +1026,7 @@ var detailedTests = []detailedTest{ name: "OP_ABS (empty)", before: [][]byte{}, script: []byte{btcscript.OP_ABS}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_ABS", }, { @@ -1960,8 +1960,8 @@ var detailedTests = []detailedTest{ name: "op_data too short", before: [][]byte{}, script: []byte{btcscript.OP_DATA_2, 1}, - expectedReturn: btcscript.StackErrShortScript, - disassemblyerr: btcscript.StackErrShortScript, + expectedReturn: btcscript.ErrStackShortScript, + disassemblyerr: btcscript.ErrStackShortScript, }, { name: "op_pushdata_1", @@ -1973,8 +1973,8 @@ var detailedTests = []detailedTest{ { name: "op_pushdata_1 too short", script: []byte{btcscript.OP_PUSHDATA1, 1}, - expectedReturn: btcscript.StackErrShortScript, - disassemblyerr: btcscript.StackErrShortScript, + expectedReturn: btcscript.ErrStackShortScript, + disassemblyerr: btcscript.ErrStackShortScript, }, { name: "op_pushdata_2", @@ -1986,8 +1986,8 @@ var detailedTests = []detailedTest{ { name: "op_pushdata_2 too short", script: []byte{btcscript.OP_PUSHDATA2, 2, 0}, - expectedReturn: btcscript.StackErrShortScript, - disassemblyerr: btcscript.StackErrShortScript, + expectedReturn: btcscript.ErrStackShortScript, + disassemblyerr: btcscript.ErrStackShortScript, }, { name: "op_pushdata_4", @@ -1999,8 +1999,8 @@ var detailedTests = []detailedTest{ { name: "op_pushdata_4 too short", script: []byte{btcscript.OP_PUSHDATA4, 4, 0, 0, 0}, - expectedReturn: btcscript.StackErrShortScript, - disassemblyerr: btcscript.StackErrShortScript, + expectedReturn: btcscript.ErrStackShortScript, + disassemblyerr: btcscript.ErrStackShortScript, }, // XXX also pushdata cases where the pushed data isn't long enough, // no real error type defined for that as of yet. @@ -2009,7 +2009,7 @@ var detailedTests = []detailedTest{ name: "OP_SHA1 no args", before: [][]byte{}, script: []byte{btcscript.OP_SHA1}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_SHA1", }, { @@ -2025,14 +2025,14 @@ var detailedTests = []detailedTest{ name: "OP_SHA256 no args", before: [][]byte{}, script: []byte{btcscript.OP_SHA256}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_SHA256", }, { name: "OP_RIPEMD160 no args", before: [][]byte{}, script: []byte{btcscript.OP_RIPEMD160}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_RIPEMD160", }, // data taken from transaction @@ -2097,7 +2097,7 @@ var detailedTests = []detailedTest{ { name: "op_hash160 no args", script: []byte{btcscript.OP_HASH160}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_HASH160", }, // hash256 test taken from spend of: @@ -2123,7 +2123,7 @@ var detailedTests = []detailedTest{ { name: "OP_HASH256 no args", script: []byte{btcscript.OP_HASH256}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_HASH256", }, // We need a more involved setup to test OP_CHECKSIG and @@ -2132,7 +2132,7 @@ var detailedTests = []detailedTest{ { name: "OP_CHECKSIG one arg", script: []byte{btcscript.OP_1, btcscript.OP_CHECKSIG}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "1 OP_CHECKSIG", nSigOps: 1, nPreciseSigOps: 1, @@ -2140,7 +2140,7 @@ var detailedTests = []detailedTest{ { name: "OP_CHECKSIG no arg", script: []byte{btcscript.OP_CHECKSIG}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_CHECKSIG", nSigOps: 1, nPreciseSigOps: 1, @@ -2149,7 +2149,7 @@ var detailedTests = []detailedTest{ name: "OP_CHECKSIGVERIFY one arg", script: []byte{btcscript.OP_1, btcscript.OP_CHECKSIGVERIFY}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "1 OP_CHECKSIGVERIFY", nSigOps: 1, nPreciseSigOps: 1, @@ -2157,7 +2157,7 @@ var detailedTests = []detailedTest{ { name: "OP_CHECKSIGVERIFY no arg", script: []byte{btcscript.OP_CHECKSIGVERIFY}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_CHECKSIGVERIFY", nSigOps: 1, nPreciseSigOps: 1, @@ -2165,7 +2165,7 @@ var detailedTests = []detailedTest{ { name: "OP_CHECKMULTISIG no args", script: []byte{btcscript.OP_CHECKMULTISIG}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_CHECKMULTISIG", nSigOps: 20, nPreciseSigOps: 20, @@ -2175,7 +2175,7 @@ var detailedTests = []detailedTest{ script: []byte{btcscript.OP_PUSHDATA1, 0x9, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, btcscript.OP_CHECKMULTISIG}, - expectedReturn: btcscript.StackErrNumberTooBig, + expectedReturn: btcscript.ErrStackNumberTooBig, disassembly: "010203040506070809 OP_CHECKMULTISIG", nSigOps: 20, nPreciseSigOps: 20, @@ -2184,7 +2184,7 @@ var detailedTests = []detailedTest{ name: "OP_CHECKMULTISIG too many keys", script: []byte{btcscript.OP_DATA_1, 21, btcscript.OP_CHECKMULTISIG}, - expectedReturn: btcscript.StackErrTooManyPubkeys, + expectedReturn: btcscript.ErrStackTooManyPubkeys, disassembly: "15 OP_CHECKMULTISIG", nSigOps: 20, nPreciseSigOps: 20, @@ -2193,7 +2193,7 @@ var detailedTests = []detailedTest{ name: "OP_CHECKMULTISIG lying about pubkeys", script: []byte{btcscript.OP_1, btcscript.OP_CHECKMULTISIG}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "1 OP_CHECKMULTISIG", nSigOps: 20, nPreciseSigOps: 1, @@ -2213,7 +2213,7 @@ var detailedTests = []detailedTest{ 0xd8, 0x4c, btcscript.OP_1, btcscript.OP_CHECKMULTISIG}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c 1 OP_CHECKMULTISIG", nSigOps: 20, nPreciseSigOps: 1, @@ -2235,7 +2235,7 @@ var detailedTests = []detailedTest{ 0xd8, 0x4c, btcscript.OP_1, btcscript.OP_CHECKMULTISIG}, - expectedReturn: btcscript.StackErrNumberTooBig, + expectedReturn: btcscript.ErrStackNumberTooBig, disassembly: "010203040506070809 04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c 1 OP_CHECKMULTISIG", nSigOps: 20, nPreciseSigOps: 1, @@ -2254,7 +2254,7 @@ var detailedTests = []detailedTest{ 0xd8, 0x4c, btcscript.OP_1, btcscript.OP_CHECKMULTISIG}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "1 04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c 1 OP_CHECKMULTISIG", nSigOps: 20, nPreciseSigOps: 1, @@ -2317,7 +2317,7 @@ var detailedTests = []detailedTest{ { name: "OP_CHECKMULTISIGVERIFY no args", script: []byte{btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 20, @@ -2327,7 +2327,7 @@ var detailedTests = []detailedTest{ script: []byte{btcscript.OP_PUSHDATA1, 0x9, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.StackErrNumberTooBig, + expectedReturn: btcscript.ErrStackNumberTooBig, disassembly: "010203040506070809 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 20, @@ -2336,7 +2336,7 @@ var detailedTests = []detailedTest{ name: "OP_CHECKMULTISIGVERIFY too many keys", script: []byte{btcscript.OP_DATA_1, 21, btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.StackErrTooManyPubkeys, + expectedReturn: btcscript.ErrStackTooManyPubkeys, disassembly: "15 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 20, @@ -2345,7 +2345,7 @@ var detailedTests = []detailedTest{ name: "OP_CHECKMULTISIGVERIFY lying about pubkeys", script: []byte{btcscript.OP_1, btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "1 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 1, @@ -2365,7 +2365,7 @@ var detailedTests = []detailedTest{ 0xd8, 0x4c, btcscript.OP_1, btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c 1 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 1, @@ -2386,7 +2386,7 @@ var detailedTests = []detailedTest{ 0xd8, 0x4c, btcscript.OP_1, btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.StackErrNumberTooBig, + expectedReturn: btcscript.ErrStackNumberTooBig, disassembly: "010203040506070809 04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c 1 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 1, @@ -2405,7 +2405,7 @@ var detailedTests = []detailedTest{ 0xd8, 0x4c, btcscript.OP_1, btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.StackErrUnderflow, + expectedReturn: btcscript.ErrStackUnderflow, disassembly: "1 04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c 1 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 1, @@ -2435,7 +2435,7 @@ var detailedTests = []detailedTest{ 0xd8, 0x4c, btcscript.OP_1, btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.StackErrVerifyFailed, + expectedReturn: btcscript.ErrStackVerifyFailed, disassembly: "1 304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901 1 04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c 1 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 1, @@ -2458,7 +2458,7 @@ var detailedTests = []detailedTest{ btcscript.OP_1, btcscript.OP_1, btcscript.OP_1, btcscript.OP_CHECKMULTISIGVERIFY}, - expectedReturn: btcscript.StackErrVerifyFailed, + expectedReturn: btcscript.ErrStackVerifyFailed, disassembly: "1 304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901 1 1 1 OP_CHECKMULTISIGVERIFY", nSigOps: 20, nPreciseSigOps: 1, @@ -2879,7 +2879,7 @@ var detailedTests = []detailedTest{ btcscript.OP_DUP, btcscript.OP_DROP, }, - expectedReturn: btcscript.StackErrTooManyOperations, + expectedReturn: btcscript.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", }, { @@ -3093,7 +3093,7 @@ var detailedTests = []detailedTest{ btcscript.OP_2, btcscript.OP_CHECKMULTISIG, }, - expectedReturn: btcscript.StackErrTooManyOperations, + expectedReturn: btcscript.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, @@ -3284,544 +3284,544 @@ 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.StackErrElementTooBig, + expectedReturn: btcscript.ErrStackElementTooBig, // element too big is a parse error. disassembly: "0102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708090102030405060708", }, { name: "OP_CAT disabled", script: []byte{btcscript.OP_CAT}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_CAT", }, { name: "OP_SUBSTR disabled", script: []byte{btcscript.OP_SUBSTR}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_SUBSTR", }, { name: "OP_LEFT disabled", script: []byte{btcscript.OP_LEFT}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_LEFT", }, { name: "OP_RIGHT disabled", script: []byte{btcscript.OP_RIGHT}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_RIGHT", }, { name: "OP_INVERT disabled", script: []byte{btcscript.OP_INVERT}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_INVERT", }, { name: "OP_AND disabled", script: []byte{btcscript.OP_AND}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_AND", }, { name: "OP_OR disabled", script: []byte{btcscript.OP_OR}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_OR", }, { name: "OP_XOR disabled", script: []byte{btcscript.OP_XOR}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_XOR", }, { name: "OP_2MUL disabled", script: []byte{btcscript.OP_2MUL}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_2MUL", }, { name: "OP_2DIV disabled", script: []byte{btcscript.OP_2DIV}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_2DIV", }, { name: "OP_2DIV disabled", script: []byte{btcscript.OP_2DIV}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_2DIV", }, { name: "OP_MUL disabled", script: []byte{btcscript.OP_MUL}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_MUL", }, { name: "OP_DIV disabled", script: []byte{btcscript.OP_DIV}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_DIV", }, { name: "OP_MOD disabled", script: []byte{btcscript.OP_MOD}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_MOD", }, { name: "OP_LSHIFT disabled", script: []byte{btcscript.OP_LSHIFT}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_LSHIFT", }, { name: "OP_RSHIFT disabled", script: []byte{btcscript.OP_RSHIFT}, - expectedReturn: btcscript.StackErrOpDisabled, + expectedReturn: btcscript.ErrStackOpDisabled, disassembly: "OP_RSHIFT", }, // Reserved opcodes { name: "OP_RESERVED reserved", script: []byte{btcscript.OP_RESERVED}, - expectedReturn: btcscript.StackErrReservedOpcode, + expectedReturn: btcscript.ErrStackReservedOpcode, disassembly: "OP_RESERVED", }, { name: "OP_VER reserved", script: []byte{btcscript.OP_VER}, - expectedReturn: btcscript.StackErrReservedOpcode, + expectedReturn: btcscript.ErrStackReservedOpcode, disassembly: "OP_VER", }, { name: "OP_VERIF reserved", script: []byte{btcscript.OP_VERIF}, - expectedReturn: btcscript.StackErrReservedOpcode, + expectedReturn: btcscript.ErrStackReservedOpcode, disassembly: "OP_VERIF", }, { name: "OP_VERNOTIF reserved", script: []byte{btcscript.OP_VERNOTIF}, - expectedReturn: btcscript.StackErrReservedOpcode, + expectedReturn: btcscript.ErrStackReservedOpcode, disassembly: "OP_VERNOTIF", }, { name: "OP_RESERVED1 reserved", script: []byte{btcscript.OP_RESERVED1}, - expectedReturn: btcscript.StackErrReservedOpcode, + expectedReturn: btcscript.ErrStackReservedOpcode, disassembly: "OP_RESERVED1", }, { name: "OP_RESERVED2 reserved", script: []byte{btcscript.OP_RESERVED2}, - expectedReturn: btcscript.StackErrReservedOpcode, + expectedReturn: btcscript.ErrStackReservedOpcode, disassembly: "OP_RESERVED2", }, // Invalid Opcodes { name: "invalid opcode 186", script: []byte{btcscript.OP_UNKNOWN186}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN186", }, { name: "invalid opcode 187", script: []byte{btcscript.OP_UNKNOWN187}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN187", }, { name: "invalid opcode 188", script: []byte{btcscript.OP_UNKNOWN188}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN188", }, { name: "invalid opcode 189", script: []byte{btcscript.OP_UNKNOWN189}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN189", }, { name: "invalid opcode 190", script: []byte{btcscript.OP_UNKNOWN190}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN190", }, { name: "invalid opcode 191", script: []byte{btcscript.OP_UNKNOWN191}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN191", }, { name: "invalid opcode 192", script: []byte{btcscript.OP_UNKNOWN192}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN192", }, { name: "invalid opcode 193", script: []byte{btcscript.OP_UNKNOWN193}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN193", }, { name: "invalid opcode 194", script: []byte{btcscript.OP_UNKNOWN194}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN194", }, { name: "invalid opcode 195", script: []byte{btcscript.OP_UNKNOWN195}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN195", }, { name: "invalid opcode 196", script: []byte{btcscript.OP_UNKNOWN196}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN196", }, { name: "invalid opcode 197", script: []byte{btcscript.OP_UNKNOWN197}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN197", }, { name: "invalid opcode 198", script: []byte{btcscript.OP_UNKNOWN198}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN198", }, { name: "invalid opcode 199", script: []byte{btcscript.OP_UNKNOWN199}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN199", }, { name: "invalid opcode 200", script: []byte{btcscript.OP_UNKNOWN200}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN200", }, { name: "invalid opcode 201", script: []byte{btcscript.OP_UNKNOWN201}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN201", }, { name: "invalid opcode 202", script: []byte{btcscript.OP_UNKNOWN202}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN202", }, { name: "invalid opcode 203", script: []byte{btcscript.OP_UNKNOWN203}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN203", }, { name: "invalid opcode 204", script: []byte{btcscript.OP_UNKNOWN204}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN204", }, { name: "invalid opcode 205", script: []byte{btcscript.OP_UNKNOWN205}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN205", }, { name: "invalid opcode 206", script: []byte{btcscript.OP_UNKNOWN206}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN206", }, { name: "invalid opcode 207", script: []byte{btcscript.OP_UNKNOWN207}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN207", }, { name: "invalid opcode 208", script: []byte{btcscript.OP_UNKNOWN208}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN208", }, { name: "invalid opcode 209", script: []byte{btcscript.OP_UNKNOWN209}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN209", }, { name: "invalid opcode 210", script: []byte{btcscript.OP_UNKNOWN210}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN210", }, { name: "invalid opcode 211", script: []byte{btcscript.OP_UNKNOWN211}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN211", }, { name: "invalid opcode 212", script: []byte{btcscript.OP_UNKNOWN212}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN212", }, { name: "invalid opcode 213", script: []byte{btcscript.OP_UNKNOWN213}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN213", }, { name: "invalid opcode 214", script: []byte{btcscript.OP_UNKNOWN214}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN214", }, { name: "invalid opcode 215", script: []byte{btcscript.OP_UNKNOWN215}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN215", }, { name: "invalid opcode 216", script: []byte{btcscript.OP_UNKNOWN216}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN216", }, { name: "invalid opcode 217", script: []byte{btcscript.OP_UNKNOWN217}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN217", }, { name: "invalid opcode 218", script: []byte{btcscript.OP_UNKNOWN218}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN218", }, { name: "invalid opcode 219", script: []byte{btcscript.OP_UNKNOWN219}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN219", }, { name: "invalid opcode 220", script: []byte{btcscript.OP_UNKNOWN220}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN220", }, { name: "invalid opcode 221", script: []byte{btcscript.OP_UNKNOWN221}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN221", }, { name: "invalid opcode 222", script: []byte{btcscript.OP_UNKNOWN222}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN222", }, { name: "invalid opcode 223", script: []byte{btcscript.OP_UNKNOWN223}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN223", }, { name: "invalid opcode 224", script: []byte{btcscript.OP_UNKNOWN224}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN224", }, { name: "invalid opcode 225", script: []byte{btcscript.OP_UNKNOWN225}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN225", }, { name: "invalid opcode 226", script: []byte{btcscript.OP_UNKNOWN226}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN226", }, { name: "invalid opcode 227", script: []byte{btcscript.OP_UNKNOWN227}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN227", }, { name: "invalid opcode 228", script: []byte{btcscript.OP_UNKNOWN228}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN228", }, { name: "invalid opcode 229", script: []byte{btcscript.OP_UNKNOWN229}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN229", }, { name: "invalid opcode 230", script: []byte{btcscript.OP_UNKNOWN230}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN230", }, { name: "invalid opcode 231", script: []byte{btcscript.OP_UNKNOWN231}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN231", }, { name: "invalid opcode 232", script: []byte{btcscript.OP_UNKNOWN232}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN232", }, { name: "invalid opcode 233", script: []byte{btcscript.OP_UNKNOWN233}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN233", }, { name: "invalid opcode 234", script: []byte{btcscript.OP_UNKNOWN234}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN234", }, { name: "invalid opcode 235", script: []byte{btcscript.OP_UNKNOWN235}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN235", }, { name: "invalid opcode 236", script: []byte{btcscript.OP_UNKNOWN236}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN236", }, { name: "invalid opcode 237", script: []byte{btcscript.OP_UNKNOWN237}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN237", }, { name: "invalid opcode 238", script: []byte{btcscript.OP_UNKNOWN238}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN238", }, { name: "invalid opcode 239", script: []byte{btcscript.OP_UNKNOWN239}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN239", }, { name: "invalid opcode 240", script: []byte{btcscript.OP_UNKNOWN240}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN240", }, { name: "invalid opcode 241", script: []byte{btcscript.OP_UNKNOWN241}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN241", }, { name: "invalid opcode 242", script: []byte{btcscript.OP_UNKNOWN242}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN242", }, { name: "invalid opcode 243", script: []byte{btcscript.OP_UNKNOWN243}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN243", }, { name: "invalid opcode 244", script: []byte{btcscript.OP_UNKNOWN244}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN244", }, { name: "invalid opcode 245", script: []byte{btcscript.OP_UNKNOWN245}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN245", }, { name: "invalid opcode 246", script: []byte{btcscript.OP_UNKNOWN246}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN246", }, { name: "invalid opcode 247", script: []byte{btcscript.OP_UNKNOWN247}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN247", }, { name: "invalid opcode 248", script: []byte{btcscript.OP_UNKNOWN248}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN248", }, { name: "invalid opcode 249", script: []byte{btcscript.OP_UNKNOWN249}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN249", }, { name: "invalid opcode 250", script: []byte{btcscript.OP_UNKNOWN250}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN250", }, { name: "invalid opcode 251", script: []byte{btcscript.OP_UNKNOWN251}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN251", }, { name: "invalid opcode 252", script: []byte{btcscript.OP_UNKNOWN252}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_UNKNOWN252", }, @@ -4231,19 +4231,19 @@ var detailedTests = []detailedTest{ { name: "invalid opcode OP_PUBKEY", script: []byte{btcscript.OP_PUBKEY}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_PUBKEY", }, { name: "invalid opcode OP_PUBKEYHASH", script: []byte{btcscript.OP_PUBKEYHASH}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_PUBKEYHASH", }, { name: "invalid opcode OP_INVALIDOPCODE", script: []byte{btcscript.OP_INVALIDOPCODE}, - expectedReturn: btcscript.StackErrInvalidOpcode, + expectedReturn: btcscript.ErrStackInvalidOpcode, disassembly: "OP_INVALIDOPCODE", }, } @@ -4321,7 +4321,7 @@ func testOpcode(t *testing.T, test *detailedTest) { test.name, err) } _, err = engine.DisasmScript(2) - if err != btcscript.StackErrInvalidIndex { + if err != btcscript.ErrStackInvalidIndex { t.Errorf("%s: got unexpected error for invalid "+ "disassembly index: \"%v\"", test.name, err) } diff --git a/script.go b/script.go index f2939fa2..148e8c7b 100644 --- a/script.go +++ b/script.go @@ -21,110 +21,110 @@ import ( ) var ( - // StackErrShortScript is returned if the script has an opcode that is + // ErrStackShortScript is returned if the script has an opcode that is // too long for the length of the script. - StackErrShortScript = errors.New("execute past end of script") + ErrStackShortScript = errors.New("execute past end of script") - // StackErrLongScript is returned if the script has an opcode that is + // ErrStackLongScript is returned if the script has an opcode that is // too long for the length of the script. - StackErrLongScript = errors.New("script is longer than maximum allowed") + ErrStackLongScript = errors.New("script is longer than maximum allowed") - // StackErrUnderflow is returned if an opcode requires more items on the - // stack than is present. - StackErrUnderflow = errors.New("stack underflow") + // ErrStackUnderflow is returned if an opcode requires more items on the + // stack than is present.f + ErrStackUnderflow = errors.New("stack underflow") - // StackErrInvalidArgs is returned if the argument for an opcode is out + // ErrStackInvalidArgs is returned if the argument for an opcode is out // of acceptable range. - StackErrInvalidArgs = errors.New("invalid argument") + ErrStackInvalidArgs = errors.New("invalid argument") - // StackErrOpDisabled is returned when a disabled opcode is encountered + // ErrStackOpDisabled is returned when a disabled opcode is encountered // in the script. - StackErrOpDisabled = errors.New("Disabled Opcode") + ErrStackOpDisabled = errors.New("Disabled Opcode") - // StackErrVerifyFailed is returned when one of the OP_VERIFY or + // ErrStackVerifyFailed is returned when one of the OP_VERIFY or // OP_*VERIFY instructions is executed and the conditions fails. - StackErrVerifyFailed = errors.New("Verify failed") + ErrStackVerifyFailed = errors.New("Verify failed") - // StackErrNumberTooBig is returned when the argument for an opcode that + // ErrStackNumberTooBig is returned when the argument for an opcode that // should be an offset is obviously far too large. - StackErrNumberTooBig = errors.New("number too big") + ErrStackNumberTooBig = errors.New("number too big") - // StackErrInvalidOpcode is returned when an opcode marked as invalid or + // ErrStackInvalidOpcode is returned when an opcode marked as invalid or // a completely undefined opcode is encountered. - StackErrInvalidOpcode = errors.New("Invalid Opcode") + ErrStackInvalidOpcode = errors.New("Invalid Opcode") - // StackErrReservedOpcode is returned when an opcode marked as reserved + // ErrStackReservedOpcode is returned when an opcode marked as reserved // is encountered. - StackErrReservedOpcode = errors.New("Reserved Opcode") + ErrStackReservedOpcode = errors.New("Reserved Opcode") - // StackErrEarlyReturn is returned when OP_RETURN is executed in the + // ErrStackEarlyReturn is returned when OP_RETURN is executed in the // script. - StackErrEarlyReturn = errors.New("Script returned early") + ErrStackEarlyReturn = errors.New("Script returned early") - // StackErrNoIf is returned if an OP_ELSE or OP_ENDIF is encountered + // ErrStackNoIf is returned if an OP_ELSE or OP_ENDIF is encountered // without first having an OP_IF or OP_NOTIF in the script. - StackErrNoIf = errors.New("OP_ELSE or OP_ENDIF with no matching OP_IF") + ErrStackNoIf = errors.New("OP_ELSE or OP_ENDIF with no matching OP_IF") - // StackErrMissingEndif is returned if the end of a script is reached + // ErrStackMissingEndif is returned if the end of a script is reached // without and OP_ENDIF to correspond to a conditional expression. - StackErrMissingEndif = fmt.Errorf("execute fail, in conditional execution") + ErrStackMissingEndif = fmt.Errorf("execute fail, in conditional execution") - // StackErrTooManyPubkeys is returned if an OP_CHECKMULTISIG is + // ErrStackTooManyPubkeys is returned if an OP_CHECKMULTISIG is // encountered with more than MaxPubKeysPerMultiSig pubkeys present. - StackErrTooManyPubkeys = errors.New("Invalid pubkey count in OP_CHECKMULTISIG") + ErrStackTooManyPubkeys = errors.New("Invalid pubkey count in OP_CHECKMULTISIG") - // StackErrTooManyOperations is returned if a script has more than + // ErrStackTooManyOperations is returned if a script has more than // MaxOpsPerScript opcodes that do not push data. - StackErrTooManyOperations = errors.New("Too many operations in script") + ErrStackTooManyOperations = errors.New("Too many operations in script") - // StackErrElementTooBig is returned if the size of an element to be + // ErrStackElementTooBig is returned if the size of an element to be // pushed to the stack is over MaxScriptElementSize. - StackErrElementTooBig = errors.New("Element in script too large") + ErrStackElementTooBig = errors.New("Element in script too large") - // StackErrUnknownAddress is returned when ScriptToAddrHash does not + // ErrStackUnknownAddress is returned when ScriptToAddrHash does not // recognise the pattern of the script and thus can not find the address // for payment. - StackErrUnknownAddress = errors.New("non-recognised address") + ErrStackUnknownAddress = errors.New("non-recognised address") - // StackErrScriptFailed is returned when at the end of a script the + // ErrStackScriptFailed is returned when at the end of a script the // boolean on top of the stack is false signifying that the script has // failed. - StackErrScriptFailed = errors.New("execute fail, fail on stack") + ErrStackScriptFailed = errors.New("execute fail, fail on stack") - // StackErrScriptUnfinished is returned when CheckErrorCondition is + // ErrStackScriptUnfinished is returned when CheckErrorCondition is // called on a script that has not finished executing. - StackErrScriptUnfinished = errors.New("Error check when script unfinished") + ErrStackScriptUnfinished = errors.New("Error check when script unfinished") - // StackErrEmpyStack is returned when the stack is empty at the end of + // ErrStackEmptyStack is returned when the stack is empty at the end of // execution. Normal operation requires that a boolean is on top of the // stack when the scripts have finished executing. - StackErrEmptyStack = errors.New("Stack empty at end of execution") + ErrStackEmptyStack = errors.New("Stack empty at end of execution") - // StackErrP2SHNonPushOnly is returned when a Pay-to-Script-Hash + // ErrStackP2SHNonPushOnly is returned when a Pay-to-Script-Hash // transaction is encountered and the ScriptSig does operations other // than push data (in violation of bip16). - StackErrP2SHNonPushOnly = errors.New("pay to script hash with non " + + ErrStackP2SHNonPushOnly = errors.New("pay to script hash with non " + "pushonly input") - // StackErrInvalidParseType is an internal error returned from + // ErrStackInvalidParseType is an internal error returned from // ScriptToAddrHash ony if the internal data tables are wrong. - StackErrInvalidParseType = errors.New("internal error: invalid parsetype found") + ErrStackInvalidParseType = errors.New("internal error: invalid parsetype found") - // StackErrInvalidAddrOffset is an internal error returned from + // ErrStackInvalidAddrOffset is an internal error returned from // ScriptToAddrHash ony if the internal data tables are wrong. - StackErrInvalidAddrOffset = errors.New("internal error: invalid offset found") + ErrStackInvalidAddrOffset = errors.New("internal error: invalid offset found") - // StackErrInvalidIndex is returned when an out-of-bounds index was + // ErrStackInvalidIndex is returned when an out-of-bounds index was // passed to a function. - StackErrInvalidIndex = errors.New("Invalid script index") + ErrStackInvalidIndex = errors.New("Invalid script index") - // StackErrNonPushOnly is returned when ScriptInfo is called with a + // ErrStackNonPushOnly is returned when ScriptInfo is called with a // pkScript that peforms operations other that pushing data to the stack. - StackErrNonPushOnly = errors.New("SigScript is non pushonly") + ErrStackNonPushOnly = errors.New("SigScript is non pushonly") - // StackErrOverflow is returned when stack and altstack combined depth + // ErrStackOverflow is returned when stack and altstack combined depth // is over the limit. - StackErrOverflow = errors.New("Stacks overflowed") + ErrStackOverflow = errors.New("Stacks overflowed") ) const ( @@ -421,7 +421,7 @@ func parseScriptTemplate(script []byte, opcodemap map[byte]*opcode) ([]parsedOpc instr := script[i] op, ok := opcodemap[instr] if !ok { - return retScript, StackErrInvalidOpcode + return retScript, ErrStackInvalidOpcode } pop := parsedOpcode{opcode: op} // parse data out of instruction. @@ -431,7 +431,7 @@ func parseScriptTemplate(script []byte, opcodemap map[byte]*opcode) ([]parsedOpc i++ case op.length > 1: if len(script[i:]) < op.length { - return retScript, StackErrShortScript + return retScript, ErrStackShortScript } // slice out the data. pop.data = script[i+1 : i+op.length] @@ -441,7 +441,7 @@ func parseScriptTemplate(script []byte, opcodemap map[byte]*opcode) ([]parsedOpc off := i + 1 if len(script[off:]) < -op.length { - return retScript, StackErrShortScript + return retScript, ErrStackShortScript } // Next -length bytes are little endian length of data. @@ -466,7 +466,7 @@ func parseScriptTemplate(script []byte, opcodemap map[byte]*opcode) ([]parsedOpc // Disallow entries that do not fit script or were // sign extended. if int(l) > len(script[off:]) || int(l) < 0 { - return retScript, StackErrShortScript + return retScript, ErrStackShortScript } pop.data = script[off : off+int(l)] i += 1 - op.length + int(l) @@ -528,7 +528,7 @@ func NewScript(scriptSig []byte, scriptPubKey []byte, txidx int, tx *btcwire.Msg m.scripts = make([][]parsedOpcode, len(scripts)) for i, scr := range scripts { if len(scr) > maxScriptSize { - return nil, StackErrLongScript + return nil, ErrStackLongScript } var err error m.scripts[i], err = parseScript(scr) @@ -551,7 +551,7 @@ func NewScript(scriptSig []byte, scriptPubKey []byte, txidx int, tx *btcwire.Msg // if we are pay to scripthash then we only accept input // scripts that push data if !isPushOnly(m.scripts[0]) { - return nil, StackErrP2SHNonPushOnly + return nil, ErrStackP2SHNonPushOnly } m.bip16 = true } @@ -611,10 +611,10 @@ func (s *Script) CheckErrorCondition() (err error) { // Check we are actually done. if pc is past the end of script array // then we have run out of scripts to run. if s.scriptidx < len(s.scripts) { - return StackErrScriptUnfinished + return ErrStackScriptUnfinished } if s.dstack.Depth() < 1 { - return StackErrEmptyStack + return ErrStackEmptyStack } v, err := s.dstack.PopBool() if err == nil && v == false { @@ -625,7 +625,7 @@ func (s *Script) CheckErrorCondition() (err error) { return fmt.Sprintf("scripts failed: script0: %s\n"+ "script1: %s", dis0, dis1) })) - err = StackErrScriptFailed + err = ErrStackScriptFailed } return err } @@ -649,7 +649,7 @@ func (m *Script) Step() (done bool, err error) { } if m.dstack.Depth()+m.astack.Depth() > maxStackSize { - return false, StackErrOverflow + return false, ErrStackOverflow } // prepare for next instruction @@ -657,7 +657,7 @@ func (m *Script) Step() (done bool, err error) { if m.scriptoff >= len(m.scripts[m.scriptidx]) { // Illegal to have an `if' that straddles two scripts. if err == nil && len(m.condStack) != 1 { - return false, StackErrMissingEndif + return false, ErrStackMissingEndif } // alt stack doesn't persist. @@ -728,7 +728,7 @@ func (m *Script) validPC() error { // ``idx''. Where 0 is the scriptSig and 1 is the scriptPubKey. func (m *Script) DisasmScript(idx int) (disstr string, err error) { if idx >= len(m.scripts) { - return "", StackErrInvalidIndex + return "", ErrStackInvalidIndex } for i := range m.scripts[idx] { disstr = disstr + m.disasm(idx, i) + "\n" @@ -1561,7 +1561,7 @@ func CalcScriptInfo(sigscript, pkscript []byte, bip16 bool) (*ScriptInfo, error) // Can't have a pkScript that doesn't just push data. if !isPushOnly(sigPops) { - return nil, StackErrNonPushOnly + return nil, ErrStackNonPushOnly } si.ExpectedInputs = expectedInputs(pkPops, si.PkScriptClass) @@ -1622,7 +1622,7 @@ func CalcMultiSigStats(script []byte) (int, int, error) { // items must be on the stack per: // OP_1 PUBKEY OP_1 OP_CHECKMULTISIG if len(pops) < 4 { - return 0, 0, StackErrUnderflow + return 0, 0, ErrStackUnderflow } numSigs := asSmallInt(pops[0].opcode) diff --git a/script_test.go b/script_test.go index 23ef4032..b859fae6 100644 --- a/script_test.go +++ b/script_test.go @@ -326,7 +326,7 @@ var txTests = []txTest{ 0x12, 0xa3, btcscript.OP_CHECKSIG, }, idx: 0, - err: btcscript.StackErrScriptFailed, + err: btcscript.ErrStackScriptFailed, nSigOps: 1, scriptInfo: btcscript.ScriptInfo{ PkScriptClass: btcscript.PubKeyTy, @@ -1082,7 +1082,7 @@ var txTests = []txTest{ idx: 1, bip16: false, nSigOps: 0, // multisig is in the pkScript! - scriptInfoErr: btcscript.StackErrNonPushOnly, + scriptInfoErr: btcscript.ErrStackNonPushOnly, }, // same as previous but with one byte changed to make signature fail { @@ -1204,9 +1204,9 @@ var txTests = []txTest{ }, idx: 1, bip16: false, - err: btcscript.StackErrScriptFailed, + err: btcscript.ErrStackScriptFailed, nSigOps: 0, // multisig is in the pkScript! - scriptInfoErr: btcscript.StackErrNonPushOnly, + scriptInfoErr: btcscript.ErrStackNonPushOnly, }, // taken from tx b2d93dfd0b2c1a380e55e76a8d9cb3075dec9f4474e9485be008c337fd62c1f7 // on testnet @@ -1391,7 +1391,7 @@ var txTests = []txTest{ btcscript.OP_EQUAL, }, idx: 0, - err: btcscript.StackErrScriptFailed, + err: btcscript.ErrStackScriptFailed, bip16: true, nSigOps: 0, // no signature ops in the pushed script. scriptInfo: btcscript.ScriptInfo{ @@ -1456,9 +1456,9 @@ var txTests = []txTest{ btcscript.OP_EQUAL, }, idx: 0, - err: btcscript.StackErrShortScript, + err: btcscript.ErrStackShortScript, bip16: true, - scriptInfoErr: btcscript.StackErrShortScript, + scriptInfoErr: btcscript.ErrStackShortScript, }, { // sigscript changed so to be non pushonly. @@ -1519,10 +1519,10 @@ var txTests = []txTest{ btcscript.OP_EQUAL, }, idx: 0, - parseErr: btcscript.StackErrP2SHNonPushOnly, + parseErr: btcscript.ErrStackP2SHNonPushOnly, bip16: true, nSigOps: 0, // no signature ops in the pushed script. - scriptInfoErr: btcscript.StackErrNonPushOnly, + scriptInfoErr: btcscript.ErrStackNonPushOnly, }, { // sigscript changed so to be non pushonly. @@ -1663,7 +1663,7 @@ func TestGetPreciseSignOps(t *testing.T) { { name: "scriptSig doesn't parse", scriptSig: []byte{btcscript.OP_PUSHDATA1, 2}, - err: btcscript.StackErrShortScript, + err: btcscript.ErrStackShortScript, }, { name: "scriptSig isn't push only", @@ -1686,7 +1686,7 @@ func TestGetPreciseSignOps(t *testing.T) { name: "pushed script doesn't parse", scriptSig: []byte{btcscript.OP_DATA_2, btcscript.OP_PUSHDATA1, 2}, - err: btcscript.StackErrShortScript, + err: btcscript.ErrStackShortScript, }, } // The signature in the p2sh script is nonsensical for the tests since @@ -1766,7 +1766,7 @@ func TestScriptInfo(t *testing.T) { 0xc4, 0xf5, 0x9c, }, bip16: true, - scriptInfoErr: btcscript.StackErrShortScript, + scriptInfoErr: btcscript.ErrStackShortScript, }, { name: "sigScript doesn't parse", @@ -1786,7 +1786,7 @@ func TestScriptInfo(t *testing.T) { 0xc4, 0xf5, 0x9c, 0x74, btcscript.OP_EQUAL, }, bip16: true, - scriptInfoErr: btcscript.StackErrShortScript, + scriptInfoErr: btcscript.ErrStackShortScript, }, { // Invented scripts, the hashes do not match @@ -1945,13 +1945,13 @@ var removeOpcodeTests = []removeOpcodeTest{ name: "invalid length (insruction)", before: []byte{btcscript.OP_PUSHDATA1}, remove: btcscript.OP_CODESEPARATOR, - err: btcscript.StackErrShortScript, + err: btcscript.ErrStackShortScript, }, { name: "invalid length (data)", before: []byte{btcscript.OP_PUSHDATA1, 255, 254}, remove: btcscript.OP_CODESEPARATOR, - err: btcscript.StackErrShortScript, + err: btcscript.ErrStackShortScript, }, } @@ -2083,13 +2083,13 @@ var removeOpcodeByDataTests = []removeOpcodeByDataTest{ name: "invalid length (instruction)", before: []byte{btcscript.OP_PUSHDATA1}, remove: []byte{1, 2, 3, 4}, - err: btcscript.StackErrShortScript, + err: btcscript.ErrStackShortScript, }, { name: "invalid length (data)", before: []byte{btcscript.OP_PUSHDATA1, 255, 254}, remove: []byte{1, 2, 3, 4}, - err: btcscript.StackErrShortScript, + err: btcscript.ErrStackShortScript, }, } @@ -2493,7 +2493,7 @@ func TestCheckErrorCondition(t *testing.T) { } err = engine.CheckErrorCondition() - if err != btcscript.StackErrScriptUnfinished { + if err != btcscript.ErrStackScriptUnfinished { t.Errorf("got unexepected error %v on %dth iteration", err, i) return @@ -4638,7 +4638,7 @@ func TestCalcMultiSigStats(t *testing.T) { 0x71, 0x05, 0xcd, 0x6a, 0x82, 0x8e, 0x03, 0x90, 0x9a, 0x67, 0x96, 0x2e, 0x0e, 0xa1, 0xf6, 0x1d, }, - expected: btcscript.StackErrShortScript, + expected: btcscript.ErrStackShortScript, }, { name: "stack underflow", @@ -4653,7 +4653,7 @@ func TestCalcMultiSigStats(t *testing.T) { 0xeb, 0x64, 0x9f, 0x6b, 0xc3, 0xf4, 0xce, 0xf3, 0x08, }, - expected: btcscript.StackErrUnderflow, + expected: btcscript.ErrStackUnderflow, }, { name: "multisig script", diff --git a/stack.go b/stack.go index ab82ac6a..19aadf9f 100644 --- a/stack.go +++ b/stack.go @@ -14,7 +14,7 @@ import ( func asInt(v []byte) (*big.Int, error) { // Only 32bit numbers allowed. if len(v) > 4 { - return nil, StackErrNumberTooBig + return nil, ErrStackNumberTooBig } if len(v) == 0 { return big.NewInt(0), nil @@ -149,7 +149,7 @@ func (s *Stack) PopBool() (bool, error) { func (s *Stack) PeekByteArray(idx int) (so []byte, err error) { sz := len(s.stk) if idx < 0 || idx >= sz { - return nil, StackErrUnderflow + return nil, ErrStackUnderflow } return s.stk[sz-idx-1], nil } @@ -177,7 +177,7 @@ func (s *Stack) PeekBool(idx int) (i bool, err error) { func (s *Stack) nipN(idx int) (so []byte, err error) { sz := len(s.stk) if idx < 0 || idx > sz-1 { - err = StackErrUnderflow + err = ErrStackUnderflow return } so = s.stk[sz-idx-1] @@ -231,7 +231,7 @@ func (s *Stack) Depth() (sz int) { // DropN(2): 1,2,3 -> 1 func (s *Stack) DropN(n int) error { if n < 1 { - return StackErrInvalidArgs + return ErrStackInvalidArgs } for ; n > 0; n-- { _, err := s.PopByteArray() @@ -248,7 +248,7 @@ func (s *Stack) DropN(n int) error { // DupN(2): 1,2,3 -> 1,2,3,2,3 func (s *Stack) DupN(n int) error { if n < 1 { - return StackErrInvalidArgs + return ErrStackInvalidArgs } // Iteratively duplicate the value n-1 down the stack n times. // this leaves us with an in-order duplicate of the top N items on the @@ -268,7 +268,7 @@ func (s *Stack) DupN(n int) error { // RotN(1): 1,2,3 -> 2,3,1 func (s *Stack) RotN(n int) error { if n < 1 { - return StackErrInvalidArgs + return ErrStackInvalidArgs } entry := 3*n - 1 // Nip the 3n-1th item from the stack to the top n times to rotate @@ -290,7 +290,7 @@ func (s *Stack) RotN(n int) error { // SwapN(2): 1,2,3,4 -> 3,4,1,2 func (s *Stack) SwapN(n int) error { if n < 1 { - return StackErrInvalidArgs + return ErrStackInvalidArgs } entry := 2*n - 1 for i := n; i > 0; i-- { @@ -311,7 +311,7 @@ func (s *Stack) SwapN(n int) error { // OverN(2): 1,2,3,4 -> 1,2,3,4,1,2 func (s *Stack) OverN(n int) error { if n < 1 { - return StackErrInvalidArgs + return ErrStackInvalidArgs } // Copy 2n-1th entry to top of the stack entry := 2*n - 1 diff --git a/stack_test.go b/stack_test.go index 0c1781fb..2448ebf6 100644 --- a/stack_test.go +++ b/stack_test.go @@ -39,7 +39,7 @@ var stackTests = []stackTest{ _, err := stack.PeekByteArray(5) return err }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{}, }, { @@ -49,7 +49,7 @@ var stackTests = []stackTest{ _, err := stack.PeekInt(5) return err }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{}, }, { @@ -59,7 +59,7 @@ var stackTests = []stackTest{ _, err := stack.PeekBool(5) return err }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{}, }, { @@ -121,7 +121,7 @@ var stackTests = []stackTest{ } return nil }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{}, }, { @@ -169,7 +169,7 @@ var stackTests = []stackTest{ return nil }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{}, }, { @@ -411,7 +411,7 @@ var stackTests = []stackTest{ return nil }, - btcscript.StackErrInvalidArgs, + btcscript.ErrStackInvalidArgs, [][]byte{}, }, { @@ -425,7 +425,7 @@ var stackTests = []stackTest{ return nil }, - btcscript.StackErrInvalidArgs, + btcscript.ErrStackInvalidArgs, [][]byte{}, }, { @@ -439,7 +439,7 @@ var stackTests = []stackTest{ return nil }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{}, }, { @@ -453,7 +453,7 @@ var stackTests = []stackTest{ return nil }, - btcscript.StackErrInvalidArgs, + btcscript.ErrStackInvalidArgs, [][]byte{}, }, { @@ -602,7 +602,7 @@ var stackTests = []stackTest{ // bite off more than we can chew return stack.NipN(3) }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{{2}, {3}}, }, { @@ -612,7 +612,7 @@ var stackTests = []stackTest{ // bite off more than we can chew return stack.NipN(3) }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{{2}, {3}}, }, { @@ -630,7 +630,7 @@ var stackTests = []stackTest{ func(stack *btcscript.Stack) error { return stack.Tuck() }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{}, }, { @@ -639,7 +639,7 @@ var stackTests = []stackTest{ func(stack *btcscript.Stack) error { return stack.Tuck() }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{}, }, { @@ -684,7 +684,7 @@ var stackTests = []stackTest{ func(stack *btcscript.Stack) error { return stack.DropN(5) }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{}, }, { @@ -693,7 +693,7 @@ var stackTests = []stackTest{ func(stack *btcscript.Stack) error { return stack.DropN(0) }, - btcscript.StackErrInvalidArgs, + btcscript.ErrStackInvalidArgs, [][]byte{}, }, { @@ -720,7 +720,7 @@ var stackTests = []stackTest{ func(stack *btcscript.Stack) error { return stack.RotN(1) }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{}, }, { @@ -729,7 +729,7 @@ var stackTests = []stackTest{ func(stack *btcscript.Stack) error { return stack.RotN(0) }, - btcscript.StackErrInvalidArgs, + btcscript.ErrStackInvalidArgs, [][]byte{}, }, { @@ -756,7 +756,7 @@ var stackTests = []stackTest{ func(stack *btcscript.Stack) error { return stack.SwapN(1) }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{}, }, { @@ -765,7 +765,7 @@ var stackTests = []stackTest{ func(stack *btcscript.Stack) error { return stack.SwapN(0) }, - btcscript.StackErrInvalidArgs, + btcscript.ErrStackInvalidArgs, [][]byte{}, }, { @@ -792,7 +792,7 @@ var stackTests = []stackTest{ func(stack *btcscript.Stack) error { return stack.OverN(1) }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{}, }, { @@ -801,7 +801,7 @@ var stackTests = []stackTest{ func(stack *btcscript.Stack) error { return stack.OverN(0) }, - btcscript.StackErrInvalidArgs, + btcscript.ErrStackInvalidArgs, [][]byte{}, }, { @@ -828,7 +828,7 @@ var stackTests = []stackTest{ func(stack *btcscript.Stack) error { return stack.PickN(1) }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{}, }, { @@ -855,7 +855,7 @@ var stackTests = []stackTest{ func(stack *btcscript.Stack) error { return stack.RollN(1) }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{}, }, { @@ -958,7 +958,7 @@ var stackTests = []stackTest{ _, err := stack.PopInt() return err }, - btcscript.StackErrUnderflow, + btcscript.ErrStackUnderflow, [][]byte{}, }, }