Branch data Line data Source code
1 : : // Copyright (c) 2009-2010 Satoshi Nakamoto
2 : : // Copyright (c) 2009-present 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 : 276248 : std::string ScriptErrorString(const ScriptError serror)
11 : : {
12 [ + + + + : 276248 : switch (serror)
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ ]
13 : : {
14 : 1696 : case SCRIPT_ERR_OK:
15 : 1696 : return "No error";
16 : 18598 : case SCRIPT_ERR_EVAL_FALSE:
17 : 18598 : return "Script evaluated without error but finished with a false/empty top stack element";
18 : 1585 : case SCRIPT_ERR_VERIFY:
19 : 1585 : return "Script failed an OP_VERIFY operation";
20 : 2131 : case SCRIPT_ERR_EQUALVERIFY:
21 : 2131 : return "Script failed an OP_EQUALVERIFY operation";
22 : 47 : case SCRIPT_ERR_CHECKMULTISIGVERIFY:
23 : 47 : return "Script failed an OP_CHECKMULTISIGVERIFY operation";
24 : 1786 : case SCRIPT_ERR_CHECKSIGVERIFY:
25 : 1786 : return "Script failed an OP_CHECKSIGVERIFY operation";
26 : 1936 : case SCRIPT_ERR_NUMEQUALVERIFY:
27 : 1936 : return "Script failed an OP_NUMEQUALVERIFY operation";
28 : 246 : case SCRIPT_ERR_SCRIPT_SIZE:
29 : 246 : return "Script is too big";
30 : 2270 : case SCRIPT_ERR_PUSH_SIZE:
31 : 2270 : return "Push value size limit exceeded";
32 : 4536 : case SCRIPT_ERR_OP_COUNT:
33 : 4536 : return "Operation limit exceeded";
34 : 1602 : case SCRIPT_ERR_STACK_SIZE:
35 : 1602 : return "Stack size limit exceeded";
36 : 2891 : case SCRIPT_ERR_SIG_COUNT:
37 : 2891 : return "Signature count negative or greater than pubkey count";
38 : 2970 : case SCRIPT_ERR_PUBKEY_COUNT:
39 : 2970 : return "Pubkey count negative or limit exceeded";
40 : 26851 : case SCRIPT_ERR_BAD_OPCODE:
41 : 26851 : return "Opcode missing or not understood";
42 : 13724 : case SCRIPT_ERR_DISABLED_OPCODE:
43 : 13724 : return "Attempted to use a disabled opcode";
44 : 9598 : case SCRIPT_ERR_INVALID_STACK_OPERATION:
45 : 9598 : return "Operation not valid with the current stack size";
46 : 2129 : case SCRIPT_ERR_INVALID_ALTSTACK_OPERATION:
47 : 2129 : return "Operation not valid with the current altstack size";
48 : 6495 : case SCRIPT_ERR_OP_RETURN:
49 : 6495 : return "OP_RETURN was encountered";
50 : 9763 : case SCRIPT_ERR_UNBALANCED_CONDITIONAL:
51 : 9763 : return "Invalid OP_IF construction";
52 : 3099 : case SCRIPT_ERR_NEGATIVE_LOCKTIME:
53 : 3099 : return "Negative locktime";
54 : 14506 : case SCRIPT_ERR_UNSATISFIED_LOCKTIME:
55 : 14506 : return "Locktime requirement not satisfied";
56 : 22018 : case SCRIPT_ERR_SIG_HASHTYPE:
57 : 22018 : return "Signature hash type missing or not understood";
58 : 7678 : case SCRIPT_ERR_SIG_DER:
59 : 7678 : return "Non-canonical DER signature";
60 : 4855 : case SCRIPT_ERR_MINIMALDATA:
61 : 4855 : return "Data push larger than necessary";
62 : 254 : case SCRIPT_ERR_SIG_PUSHONLY:
63 : 254 : 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 : 1910 : case SCRIPT_ERR_SIG_NULLDUMMY:
67 : 1910 : return "Dummy CHECKMULTISIG argument must be zero";
68 : 115 : case SCRIPT_ERR_MINIMALIF:
69 : 115 : return "OP_IF/NOTIF argument must be minimal";
70 : 158 : case SCRIPT_ERR_SIG_NULLFAIL:
71 : 158 : return "Signature must be zero for failed CHECK(MULTI)SIG operation";
72 : 3869 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS:
73 : 3869 : return "NOPx reserved for soft-fork upgrades";
74 : 5892 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM:
75 : 5892 : return "Witness version reserved for soft-fork upgrades";
76 : 20 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION:
77 : 20 : return "Taproot version reserved for soft-fork upgrades";
78 : 134 : case SCRIPT_ERR_DISCOURAGE_OP_SUCCESS:
79 : 134 : 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 : 8083 : case SCRIPT_ERR_PUBKEYTYPE:
83 : 8083 : return "Public key is neither compressed or uncompressed";
84 : 9381 : case SCRIPT_ERR_CLEANSTACK:
85 : 9381 : return "Stack size must be exactly one after execution";
86 : 2340 : case SCRIPT_ERR_WITNESS_PROGRAM_WRONG_LENGTH:
87 : 2340 : return "Witness program has incorrect length";
88 : 26931 : case SCRIPT_ERR_WITNESS_PROGRAM_WITNESS_EMPTY:
89 : 26931 : return "Witness program was passed an empty witness";
90 : 12870 : case SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH:
91 : 12870 : return "Witness program hash mismatch";
92 : 6773 : case SCRIPT_ERR_WITNESS_MALLEATED:
93 : 6773 : return "Witness requires empty scriptSig";
94 : 15 : case SCRIPT_ERR_WITNESS_MALLEATED_P2SH:
95 : 15 : return "Witness requires only-redeemscript scriptSig";
96 : 705 : case SCRIPT_ERR_WITNESS_UNEXPECTED:
97 : 705 : return "Witness provided for non-witness script";
98 : 8 : case SCRIPT_ERR_WITNESS_PUBKEYTYPE:
99 : 8 : return "Using non-compressed keys in segwit";
100 : 5550 : case SCRIPT_ERR_SCHNORR_SIG_SIZE:
101 : 5550 : return "Invalid Schnorr signature size";
102 : 293 : case SCRIPT_ERR_SCHNORR_SIG_HASHTYPE:
103 : 293 : return "Invalid Schnorr signature hash type";
104 : 1517 : case SCRIPT_ERR_SCHNORR_SIG:
105 : 1517 : return "Invalid Schnorr signature";
106 : 3714 : case SCRIPT_ERR_TAPROOT_WRONG_CONTROL_SIZE:
107 : 3714 : return "Invalid Taproot control block size";
108 : 27 : case SCRIPT_ERR_TAPSCRIPT_VALIDATION_WEIGHT:
109 : 27 : return "Too much signature validation relative to witness weight";
110 : 14 : case SCRIPT_ERR_TAPSCRIPT_CHECKMULTISIG:
111 : 14 : return "OP_CHECKMULTISIG(VERIFY) is not available in tapscript";
112 : 18 : case SCRIPT_ERR_TAPSCRIPT_MINIMALIF:
113 : 18 : return "OP_IF/NOTIF argument must be minimal in tapscript";
114 : 6 : case SCRIPT_ERR_TAPSCRIPT_EMPTY_PUBKEY:
115 : 6 : return "Empty public key in tapscript";
116 : 1787 : case SCRIPT_ERR_OP_CODESEPARATOR:
117 : 1787 : return "Using OP_CODESEPARATOR in non-witness script";
118 : 7970 : case SCRIPT_ERR_SIG_FINDANDDELETE:
119 : 7970 : return "Signature is found in scriptCode";
120 : 12795 : case SCRIPT_ERR_SCRIPTNUM:
121 : 12795 : return "Script number overflowed or is non-minimally encoded";
122 : 64 : case SCRIPT_ERR_UNKNOWN_ERROR:
123 : 64 : case SCRIPT_ERR_ERROR_COUNT:
124 : 64 : default: break;
125 : : }
126 : 64 : return "unknown error";
127 : : }
|