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 : 225437 : std::string ScriptErrorString(const ScriptError serror)
11 : : {
12 [ + + + + : 225437 : switch (serror)
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + ]
13 : : {
14 : 1633 : case SCRIPT_ERR_OK:
15 : 1633 : return "No error";
16 : 13061 : case SCRIPT_ERR_EVAL_FALSE:
17 : 13061 : return "Script evaluated without error but finished with a false/empty top stack element";
18 : 1315 : case SCRIPT_ERR_VERIFY:
19 : 1315 : return "Script failed an OP_VERIFY operation";
20 : 1516 : case SCRIPT_ERR_EQUALVERIFY:
21 : 1516 : return "Script failed an OP_EQUALVERIFY operation";
22 : 140 : case SCRIPT_ERR_CHECKMULTISIGVERIFY:
23 : 140 : return "Script failed an OP_CHECKMULTISIGVERIFY operation";
24 : 1828 : case SCRIPT_ERR_CHECKSIGVERIFY:
25 : 1828 : return "Script failed an OP_CHECKSIGVERIFY operation";
26 : 1671 : case SCRIPT_ERR_NUMEQUALVERIFY:
27 : 1671 : return "Script failed an OP_NUMEQUALVERIFY operation";
28 : 628 : case SCRIPT_ERR_SCRIPT_SIZE:
29 : 628 : return "Script is too big";
30 : 1935 : case SCRIPT_ERR_PUSH_SIZE:
31 : 1935 : return "Push value size limit exceeded";
32 : 4526 : case SCRIPT_ERR_OP_COUNT:
33 : 4526 : return "Operation limit exceeded";
34 : 1663 : case SCRIPT_ERR_STACK_SIZE:
35 : 1663 : return "Stack size limit exceeded";
36 : 2425 : case SCRIPT_ERR_SIG_COUNT:
37 : 2425 : return "Signature count negative or greater than pubkey count";
38 : 2448 : case SCRIPT_ERR_PUBKEY_COUNT:
39 : 2448 : return "Pubkey count negative or limit exceeded";
40 : 24053 : case SCRIPT_ERR_BAD_OPCODE:
41 : 24053 : return "Opcode missing or not understood";
42 : 12119 : case SCRIPT_ERR_DISABLED_OPCODE:
43 : 12119 : return "Attempted to use a disabled opcode";
44 : 5640 : case SCRIPT_ERR_INVALID_STACK_OPERATION:
45 : 5640 : return "Operation not valid with the current stack size";
46 : 1817 : case SCRIPT_ERR_INVALID_ALTSTACK_OPERATION:
47 : 1817 : return "Operation not valid with the current altstack size";
48 : 4497 : case SCRIPT_ERR_OP_RETURN:
49 : 4497 : return "OP_RETURN was encountered";
50 : 11003 : case SCRIPT_ERR_UNBALANCED_CONDITIONAL:
51 : 11003 : return "Invalid OP_IF construction";
52 : 2610 : case SCRIPT_ERR_NEGATIVE_LOCKTIME:
53 : 2610 : return "Negative locktime";
54 : 13117 : case SCRIPT_ERR_UNSATISFIED_LOCKTIME:
55 : 13117 : return "Locktime requirement not satisfied";
56 : 16830 : case SCRIPT_ERR_SIG_HASHTYPE:
57 : 16830 : return "Signature hash type missing or not understood";
58 : 4886 : case SCRIPT_ERR_SIG_DER:
59 : 4886 : return "Non-canonical DER signature";
60 : 5020 : case SCRIPT_ERR_MINIMALDATA:
61 : 5020 : return "Data push larger than necessary";
62 : 140 : case SCRIPT_ERR_SIG_PUSHONLY:
63 : 140 : return "Only push operators allowed in signatures";
64 : 18 : case SCRIPT_ERR_SIG_HIGH_S:
65 : 18 : return "Non-canonical signature: S value is unnecessarily high";
66 : 1483 : case SCRIPT_ERR_SIG_NULLDUMMY:
67 : 1483 : return "Dummy CHECKMULTISIG argument must be zero";
68 : 24 : case SCRIPT_ERR_MINIMALIF:
69 : 24 : return "OP_IF/NOTIF argument must be minimal";
70 : 120 : case SCRIPT_ERR_SIG_NULLFAIL:
71 : 120 : return "Signature must be zero for failed CHECK(MULTI)SIG operation";
72 : 3736 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS:
73 : 3736 : return "NOPx reserved for soft-fork upgrades";
74 : 5270 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM:
75 : 5270 : return "Witness version reserved for soft-fork upgrades";
76 : 8 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION:
77 : 8 : return "Taproot version reserved for soft-fork upgrades";
78 : 50 : case SCRIPT_ERR_DISCOURAGE_OP_SUCCESS:
79 : 50 : return "OP_SUCCESSx reserved for soft-fork upgrades";
80 : 7 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_PUBKEYTYPE:
81 : 7 : return "Public key version reserved for soft-fork upgrades";
82 : 5977 : case SCRIPT_ERR_PUBKEYTYPE:
83 : 5977 : return "Public key is neither compressed or uncompressed";
84 : 4926 : case SCRIPT_ERR_CLEANSTACK:
85 : 4926 : return "Stack size must be exactly one after execution";
86 : 2508 : case SCRIPT_ERR_WITNESS_PROGRAM_WRONG_LENGTH:
87 : 2508 : return "Witness program has incorrect length";
88 : 17983 : case SCRIPT_ERR_WITNESS_PROGRAM_WITNESS_EMPTY:
89 : 17983 : return "Witness program was passed an empty witness";
90 : 12596 : case SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH:
91 : 12596 : return "Witness program hash mismatch";
92 : 5643 : case SCRIPT_ERR_WITNESS_MALLEATED:
93 : 5643 : return "Witness requires empty scriptSig";
94 : 17 : case SCRIPT_ERR_WITNESS_MALLEATED_P2SH:
95 : 17 : return "Witness requires only-redeemscript scriptSig";
96 : 554 : case SCRIPT_ERR_WITNESS_UNEXPECTED:
97 : 554 : return "Witness provided for non-witness script";
98 : 6 : case SCRIPT_ERR_WITNESS_PUBKEYTYPE:
99 : 6 : return "Using non-compressed keys in segwit";
100 : 2728 : case SCRIPT_ERR_SCHNORR_SIG_SIZE:
101 : 2728 : return "Invalid Schnorr signature size";
102 : 180 : case SCRIPT_ERR_SCHNORR_SIG_HASHTYPE:
103 : 180 : return "Invalid Schnorr signature hash type";
104 : 572 : case SCRIPT_ERR_SCHNORR_SIG:
105 : 572 : return "Invalid Schnorr signature";
106 : 1751 : case SCRIPT_ERR_TAPROOT_WRONG_CONTROL_SIZE:
107 : 1751 : return "Invalid Taproot control block size";
108 : 16 : case SCRIPT_ERR_TAPSCRIPT_VALIDATION_WEIGHT:
109 : 16 : 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 : 15 : case SCRIPT_ERR_TAPSCRIPT_MINIMALIF:
113 : 15 : return "OP_IF/NOTIF argument must be minimal in tapscript";
114 : 2296 : case SCRIPT_ERR_OP_CODESEPARATOR:
115 : 2296 : return "Using OP_CODESEPARATOR in non-witness script";
116 : 9232 : case SCRIPT_ERR_SIG_FINDANDDELETE:
117 : 9232 : return "Signature is found in scriptCode";
118 : 11186 : case SCRIPT_ERR_UNKNOWN_ERROR:
119 : 11186 : case SCRIPT_ERR_ERROR_COUNT:
120 : 11186 : default: break;
121 : : }
122 : 11186 : return "unknown error";
123 : : }
|