Branch data Line data Source code
1 : : // Copyright (c) 2009-2010 Satoshi Nakamoto
2 : : // Copyright (c) 2009-2020 The Bitcoin Core developers
3 : : // Distributed under the MIT software license, see the accompanying
4 : : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 : :
6 : : #include <script/script_error.h>
7 : :
8 : : #include <string>
9 : :
10 : 130756 : std::string ScriptErrorString(const ScriptError serror)
11 : : {
12 [ + + + + : 130756 : switch (serror)
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + ]
13 : : {
14 : 1492 : case SCRIPT_ERR_OK:
15 : 1492 : return "No error";
16 : 3105 : case SCRIPT_ERR_EVAL_FALSE:
17 : 3105 : return "Script evaluated without error but finished with a false/empty top stack element";
18 : 729 : case SCRIPT_ERR_VERIFY:
19 : 729 : return "Script failed an OP_VERIFY operation";
20 : 831 : case SCRIPT_ERR_EQUALVERIFY:
21 : 831 : return "Script failed an OP_EQUALVERIFY operation";
22 : 206 : case SCRIPT_ERR_CHECKMULTISIGVERIFY:
23 : 206 : return "Script failed an OP_CHECKMULTISIGVERIFY operation";
24 : 726 : case SCRIPT_ERR_CHECKSIGVERIFY:
25 : 726 : return "Script failed an OP_CHECKSIGVERIFY operation";
26 : 752 : case SCRIPT_ERR_NUMEQUALVERIFY:
27 : 752 : return "Script failed an OP_NUMEQUALVERIFY operation";
28 : 582 : case SCRIPT_ERR_SCRIPT_SIZE:
29 : 582 : return "Script is too big";
30 : 978 : case SCRIPT_ERR_PUSH_SIZE:
31 : 978 : return "Push value size limit exceeded";
32 : 2162 : case SCRIPT_ERR_OP_COUNT:
33 : 2162 : return "Operation limit exceeded";
34 : 413 : case SCRIPT_ERR_STACK_SIZE:
35 : 413 : return "Stack size limit exceeded";
36 : 954 : case SCRIPT_ERR_SIG_COUNT:
37 : 954 : return "Signature count negative or greater than pubkey count";
38 : 1124 : case SCRIPT_ERR_PUBKEY_COUNT:
39 : 1124 : return "Pubkey count negative or limit exceeded";
40 : 14203 : case SCRIPT_ERR_BAD_OPCODE:
41 : 14203 : return "Opcode missing or not understood";
42 : 5696 : case SCRIPT_ERR_DISABLED_OPCODE:
43 : 5696 : return "Attempted to use a disabled opcode";
44 : 4445 : case SCRIPT_ERR_INVALID_STACK_OPERATION:
45 : 4445 : return "Operation not valid with the current stack size";
46 : 1111 : case SCRIPT_ERR_INVALID_ALTSTACK_OPERATION:
47 : 1111 : return "Operation not valid with the current altstack size";
48 : 2003 : case SCRIPT_ERR_OP_RETURN:
49 : 2003 : return "OP_RETURN was encountered";
50 : 8741 : case SCRIPT_ERR_UNBALANCED_CONDITIONAL:
51 : 8741 : return "Invalid OP_IF construction";
52 : 1199 : case SCRIPT_ERR_NEGATIVE_LOCKTIME:
53 : 1199 : return "Negative locktime";
54 : 5503 : case SCRIPT_ERR_UNSATISFIED_LOCKTIME:
55 : 5503 : return "Locktime requirement not satisfied";
56 : 16109 : case SCRIPT_ERR_SIG_HASHTYPE:
57 : 16109 : return "Signature hash type missing or not understood";
58 : 2798 : case SCRIPT_ERR_SIG_DER:
59 : 2798 : return "Non-canonical DER signature";
60 : 1184 : case SCRIPT_ERR_MINIMALDATA:
61 : 1184 : return "Data push larger than necessary";
62 : 34 : case SCRIPT_ERR_SIG_PUSHONLY:
63 : 34 : return "Only push operators allowed in signatures";
64 : 16 : case SCRIPT_ERR_SIG_HIGH_S:
65 : 16 : return "Non-canonical signature: S value is unnecessarily high";
66 : 833 : case SCRIPT_ERR_SIG_NULLDUMMY:
67 : 833 : return "Dummy CHECKMULTISIG argument must be zero";
68 : 16 : case SCRIPT_ERR_MINIMALIF:
69 : 16 : return "OP_IF/NOTIF argument must be minimal";
70 : 15 : case SCRIPT_ERR_SIG_NULLFAIL:
71 : 15 : return "Signature must be zero for failed CHECK(MULTI)SIG operation";
72 : 816 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS:
73 : 816 : return "NOPx reserved for soft-fork upgrades";
74 : 1283 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM:
75 : 1283 : return "Witness version reserved for soft-fork upgrades";
76 : 4 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION:
77 : 4 : return "Taproot version reserved for soft-fork upgrades";
78 : 45 : case SCRIPT_ERR_DISCOURAGE_OP_SUCCESS:
79 : 45 : return "OP_SUCCESSx reserved for soft-fork upgrades";
80 : 9 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_PUBKEYTYPE:
81 : 9 : return "Public key version reserved for soft-fork upgrades";
82 : 1839 : case SCRIPT_ERR_PUBKEYTYPE:
83 : 1839 : return "Public key is neither compressed or uncompressed";
84 : 2396 : case SCRIPT_ERR_CLEANSTACK:
85 : 2396 : return "Stack size must be exactly one after execution";
86 : 1207 : case SCRIPT_ERR_WITNESS_PROGRAM_WRONG_LENGTH:
87 : 1207 : return "Witness program has incorrect length";
88 : 24853 : case SCRIPT_ERR_WITNESS_PROGRAM_WITNESS_EMPTY:
89 : 24853 : return "Witness program was passed an empty witness";
90 : 4603 : case SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH:
91 : 4603 : return "Witness program hash mismatch";
92 : 5845 : case SCRIPT_ERR_WITNESS_MALLEATED:
93 : 5845 : return "Witness requires empty scriptSig";
94 : 11 : case SCRIPT_ERR_WITNESS_MALLEATED_P2SH:
95 : 11 : return "Witness requires only-redeemscript scriptSig";
96 : 310 : case SCRIPT_ERR_WITNESS_UNEXPECTED:
97 : 310 : return "Witness provided for non-witness script";
98 : 4 : case SCRIPT_ERR_WITNESS_PUBKEYTYPE:
99 : 4 : return "Using non-compressed keys in segwit";
100 : 944 : case SCRIPT_ERR_SCHNORR_SIG_SIZE:
101 : 944 : return "Invalid Schnorr signature size";
102 : 66 : case SCRIPT_ERR_SCHNORR_SIG_HASHTYPE:
103 : 66 : return "Invalid Schnorr signature hash type";
104 : 161 : case SCRIPT_ERR_SCHNORR_SIG:
105 : 161 : return "Invalid Schnorr signature";
106 : 664 : case SCRIPT_ERR_TAPROOT_WRONG_CONTROL_SIZE:
107 : 664 : return "Invalid Taproot control block size";
108 : 11 : case SCRIPT_ERR_TAPSCRIPT_VALIDATION_WEIGHT:
109 : 11 : return "Too much signature validation relative to witness weight";
110 : 18 : case SCRIPT_ERR_TAPSCRIPT_CHECKMULTISIG:
111 : 18 : return "OP_CHECKMULTISIG(VERIFY) is not available in tapscript";
112 : 7 : case SCRIPT_ERR_TAPSCRIPT_MINIMALIF:
113 : 7 : return "OP_IF/NOTIF argument must be minimal in tapscript";
114 : 1004 : case SCRIPT_ERR_OP_CODESEPARATOR:
115 : 1004 : return "Using OP_CODESEPARATOR in non-witness script";
116 : 2471 : case SCRIPT_ERR_SIG_FINDANDDELETE:
117 : 2471 : return "Signature is found in scriptCode";
118 : 4225 : case SCRIPT_ERR_UNKNOWN_ERROR:
119 : 4225 : case SCRIPT_ERR_ERROR_COUNT:
120 : 4225 : default: break;
121 : : }
122 : 4225 : return "unknown error";
123 : : }
|