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 : 116177 : std::string ScriptErrorString(const ScriptError serror)
11 : : {
12 [ + + + + : 116177 : switch (serror)
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + ]
13 : : {
14 : 1312 : case SCRIPT_ERR_OK:
15 : 1312 : return "No error";
16 : 6355 : case SCRIPT_ERR_EVAL_FALSE:
17 : 6355 : return "Script evaluated without error but finished with a false/empty top stack element";
18 : 643 : case SCRIPT_ERR_VERIFY:
19 : 643 : return "Script failed an OP_VERIFY operation";
20 : 743 : case SCRIPT_ERR_EQUALVERIFY:
21 : 743 : return "Script failed an OP_EQUALVERIFY operation";
22 : 131 : case SCRIPT_ERR_CHECKMULTISIGVERIFY:
23 : 131 : return "Script failed an OP_CHECKMULTISIGVERIFY operation";
24 : 565 : case SCRIPT_ERR_CHECKSIGVERIFY:
25 : 565 : return "Script failed an OP_CHECKSIGVERIFY operation";
26 : 907 : case SCRIPT_ERR_NUMEQUALVERIFY:
27 : 907 : return "Script failed an OP_NUMEQUALVERIFY operation";
28 : 146 : case SCRIPT_ERR_SCRIPT_SIZE:
29 : 146 : return "Script is too big";
30 : 930 : case SCRIPT_ERR_PUSH_SIZE:
31 : 930 : return "Push value size limit exceeded";
32 : 2200 : case SCRIPT_ERR_OP_COUNT:
33 : 2200 : return "Operation limit exceeded";
34 : 558 : case SCRIPT_ERR_STACK_SIZE:
35 : 558 : return "Stack size limit exceeded";
36 : 1051 : case SCRIPT_ERR_SIG_COUNT:
37 : 1051 : return "Signature count negative or greater than pubkey count";
38 : 1200 : case SCRIPT_ERR_PUBKEY_COUNT:
39 : 1200 : return "Pubkey count negative or limit exceeded";
40 : 11712 : case SCRIPT_ERR_BAD_OPCODE:
41 : 11712 : return "Opcode missing or not understood";
42 : 5845 : case SCRIPT_ERR_DISABLED_OPCODE:
43 : 5845 : return "Attempted to use a disabled opcode";
44 : 3465 : case SCRIPT_ERR_INVALID_STACK_OPERATION:
45 : 3465 : return "Operation not valid with the current stack size";
46 : 968 : case SCRIPT_ERR_INVALID_ALTSTACK_OPERATION:
47 : 968 : return "Operation not valid with the current altstack size";
48 : 2324 : case SCRIPT_ERR_OP_RETURN:
49 : 2324 : return "OP_RETURN was encountered";
50 : 4552 : case SCRIPT_ERR_UNBALANCED_CONDITIONAL:
51 : 4552 : return "Invalid OP_IF construction";
52 : 1249 : case SCRIPT_ERR_NEGATIVE_LOCKTIME:
53 : 1249 : return "Negative locktime";
54 : 5763 : case SCRIPT_ERR_UNSATISFIED_LOCKTIME:
55 : 5763 : return "Locktime requirement not satisfied";
56 : 15690 : case SCRIPT_ERR_SIG_HASHTYPE:
57 : 15690 : return "Signature hash type missing or not understood";
58 : 2238 : case SCRIPT_ERR_SIG_DER:
59 : 2238 : return "Non-canonical DER signature";
60 : 2155 : case SCRIPT_ERR_MINIMALDATA:
61 : 2155 : return "Data push larger than necessary";
62 : 91 : case SCRIPT_ERR_SIG_PUSHONLY:
63 : 91 : return "Only push operators allowed in signatures";
64 : 13 : case SCRIPT_ERR_SIG_HIGH_S:
65 : 13 : return "Non-canonical signature: S value is unnecessarily high";
66 : 711 : case SCRIPT_ERR_SIG_NULLDUMMY:
67 : 711 : return "Dummy CHECKMULTISIG argument must be zero";
68 : 18 : case SCRIPT_ERR_MINIMALIF:
69 : 18 : return "OP_IF/NOTIF argument must be minimal";
70 : 100 : case SCRIPT_ERR_SIG_NULLFAIL:
71 : 100 : return "Signature must be zero for failed CHECK(MULTI)SIG operation";
72 : 1975 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS:
73 : 1975 : return "NOPx reserved for soft-fork upgrades";
74 : 2299 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM:
75 : 2299 : return "Witness version reserved for soft-fork upgrades";
76 : 2 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION:
77 : 2 : return "Taproot version reserved for soft-fork upgrades";
78 : 42 : case SCRIPT_ERR_DISCOURAGE_OP_SUCCESS:
79 : 42 : return "OP_SUCCESSx reserved for soft-fork upgrades";
80 : 5 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_PUBKEYTYPE:
81 : 5 : return "Public key version reserved for soft-fork upgrades";
82 : 2968 : case SCRIPT_ERR_PUBKEYTYPE:
83 : 2968 : return "Public key is neither compressed or uncompressed";
84 : 3478 : case SCRIPT_ERR_CLEANSTACK:
85 : 3478 : return "Stack size must be exactly one after execution";
86 : 987 : case SCRIPT_ERR_WITNESS_PROGRAM_WRONG_LENGTH:
87 : 987 : return "Witness program has incorrect length";
88 : 9098 : case SCRIPT_ERR_WITNESS_PROGRAM_WITNESS_EMPTY:
89 : 9098 : return "Witness program was passed an empty witness";
90 : 5939 : case SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH:
91 : 5939 : return "Witness program hash mismatch";
92 : 2563 : case SCRIPT_ERR_WITNESS_MALLEATED:
93 : 2563 : return "Witness requires empty scriptSig";
94 : 8 : case SCRIPT_ERR_WITNESS_MALLEATED_P2SH:
95 : 8 : return "Witness requires only-redeemscript scriptSig";
96 : 214 : case SCRIPT_ERR_WITNESS_UNEXPECTED:
97 : 214 : return "Witness provided for non-witness script";
98 : 1 : case SCRIPT_ERR_WITNESS_PUBKEYTYPE:
99 : 1 : return "Using non-compressed keys in segwit";
100 : 1558 : case SCRIPT_ERR_SCHNORR_SIG_SIZE:
101 : 1558 : return "Invalid Schnorr signature size";
102 : 115 : case SCRIPT_ERR_SCHNORR_SIG_HASHTYPE:
103 : 115 : return "Invalid Schnorr signature hash type";
104 : 440 : case SCRIPT_ERR_SCHNORR_SIG:
105 : 440 : return "Invalid Schnorr signature";
106 : 1108 : case SCRIPT_ERR_TAPROOT_WRONG_CONTROL_SIZE:
107 : 1108 : 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 : 8 : case SCRIPT_ERR_TAPSCRIPT_CHECKMULTISIG:
111 : 8 : return "OP_CHECKMULTISIG(VERIFY) is not available in tapscript";
112 : 6 : case SCRIPT_ERR_TAPSCRIPT_MINIMALIF:
113 : 6 : return "OP_IF/NOTIF argument must be minimal in tapscript";
114 : 1102 : case SCRIPT_ERR_OP_CODESEPARATOR:
115 : 1102 : return "Using OP_CODESEPARATOR in non-witness script";
116 : 3227 : case SCRIPT_ERR_SIG_FINDANDDELETE:
117 : 3227 : return "Signature is found in scriptCode";
118 : 5388 : case SCRIPT_ERR_UNKNOWN_ERROR:
119 : 5388 : case SCRIPT_ERR_ERROR_COUNT:
120 : 5388 : default: break;
121 : : }
122 : 5388 : return "unknown error";
123 : : }
|