Bitcoin Core  0.20.99
P2P Digital Currency
script_error.cpp
Go to the documentation of this file.
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 std::string ScriptErrorString(const ScriptError serror)
11 {
12  switch (serror)
13  {
14  case SCRIPT_ERR_OK:
15  return "No error";
17  return "Script evaluated without error but finished with a false/empty top stack element";
18  case SCRIPT_ERR_VERIFY:
19  return "Script failed an OP_VERIFY operation";
21  return "Script failed an OP_EQUALVERIFY operation";
23  return "Script failed an OP_CHECKMULTISIGVERIFY operation";
25  return "Script failed an OP_CHECKSIGVERIFY operation";
27  return "Script failed an OP_NUMEQUALVERIFY operation";
29  return "Script is too big";
31  return "Push value size limit exceeded";
33  return "Operation limit exceeded";
35  return "Stack size limit exceeded";
37  return "Signature count negative or greater than pubkey count";
39  return "Pubkey count negative or limit exceeded";
41  return "Opcode missing or not understood";
43  return "Attempted to use a disabled opcode";
45  return "Operation not valid with the current stack size";
47  return "Operation not valid with the current altstack size";
49  return "OP_RETURN was encountered";
51  return "Invalid OP_IF construction";
53  return "Negative locktime";
55  return "Locktime requirement not satisfied";
57  return "Signature hash type missing or not understood";
58  case SCRIPT_ERR_SIG_DER:
59  return "Non-canonical DER signature";
61  return "Data push larger than necessary";
63  return "Only push operators allowed in signatures";
65  return "Non-canonical signature: S value is unnecessarily high";
67  return "Dummy CHECKMULTISIG argument must be zero";
69  return "OP_IF/NOTIF argument must be minimal";
71  return "Signature must be zero for failed CHECK(MULTI)SIG operation";
73  return "NOPx reserved for soft-fork upgrades";
75  return "Witness version reserved for soft-fork upgrades";
77  return "Taproot version reserved for soft-fork upgrades";
79  return "OP_SUCCESSx reserved for soft-fork upgrades";
81  return "Public key version reserved for soft-fork upgrades";
83  return "Public key is neither compressed or uncompressed";
85  return "Stack size must be exactly one after execution";
87  return "Witness program has incorrect length";
89  return "Witness program was passed an empty witness";
91  return "Witness program hash mismatch";
93  return "Witness requires empty scriptSig";
95  return "Witness requires only-redeemscript scriptSig";
97  return "Witness provided for non-witness script";
99  return "Using non-compressed keys in segwit";
101  return "Invalid Schnorr signature size";
103  return "Invalid Schnorr signature hash type";
105  return "Invalid Schnorr signature";
107  return "Invalid Taproot control block size";
109  return "Too much signature validation relative to witness weight";
111  return "OP_CHECKMULTISIG(VERIFY) is not available in tapscript";
113  return "OP_IF/NOTIF argument must be minimal in tapscript";
115  return "Using OP_CODESEPARATOR in non-witness script";
117  return "Signature is found in scriptCode";
120  default: break;
121  }
122  return "unknown error";
123 }
enum ScriptError_t ScriptError
std::string ScriptErrorString(const ScriptError serror)