Bitcoin Core  21.99.0
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 }
ScriptErrorString
std::string ScriptErrorString(const ScriptError serror)
Definition: script_error.cpp:10
SCRIPT_ERR_OP_COUNT
@ SCRIPT_ERR_OP_COUNT
Definition: script_error.h:21
SCRIPT_ERR_WITNESS_MALLEATED_P2SH
@ SCRIPT_ERR_WITNESS_MALLEATED_P2SH
Definition: script_error.h:68
SCRIPT_ERR_NEGATIVE_LOCKTIME
@ SCRIPT_ERR_NEGATIVE_LOCKTIME
Definition: script_error.h:41
SCRIPT_ERR_INVALID_ALTSTACK_OPERATION
@ SCRIPT_ERR_INVALID_ALTSTACK_OPERATION
Definition: script_error.h:37
SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM
@ SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM
Definition: script_error.h:58
SCRIPT_ERR_OK
@ SCRIPT_ERR_OK
Definition: script_error.h:13
SCRIPT_ERR_TAPROOT_WRONG_CONTROL_SIZE
@ SCRIPT_ERR_TAPROOT_WRONG_CONTROL_SIZE
Definition: script_error.h:76
SCRIPT_ERR_SIG_NULLFAIL
@ SCRIPT_ERR_SIG_NULLFAIL
Definition: script_error.h:54
SCRIPT_ERR_WITNESS_UNEXPECTED
@ SCRIPT_ERR_WITNESS_UNEXPECTED
Definition: script_error.h:69
SCRIPT_ERR_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION
@ SCRIPT_ERR_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION
Definition: script_error.h:59
SCRIPT_ERR_SIG_DER
@ SCRIPT_ERR_SIG_DER
Definition: script_error.h:46
SCRIPT_ERR_OP_RETURN
@ SCRIPT_ERR_OP_RETURN
Definition: script_error.h:16
SCRIPT_ERR_SIG_PUSHONLY
@ SCRIPT_ERR_SIG_PUSHONLY
Definition: script_error.h:48
SCRIPT_ERR_SCHNORR_SIG
@ SCRIPT_ERR_SCHNORR_SIG
Definition: script_error.h:75
SCRIPT_ERR_EVAL_FALSE
@ SCRIPT_ERR_EVAL_FALSE
Definition: script_error.h:15
SCRIPT_ERR_CHECKMULTISIGVERIFY
@ SCRIPT_ERR_CHECKMULTISIGVERIFY
Definition: script_error.h:29
SCRIPT_ERR_MINIMALDATA
@ SCRIPT_ERR_MINIMALDATA
Definition: script_error.h:47
ScriptError
enum ScriptError_t ScriptError
SCRIPT_ERR_TAPSCRIPT_VALIDATION_WEIGHT
@ SCRIPT_ERR_TAPSCRIPT_VALIDATION_WEIGHT
Definition: script_error.h:77
SCRIPT_ERR_SCHNORR_SIG_HASHTYPE
@ SCRIPT_ERR_SCHNORR_SIG_HASHTYPE
Definition: script_error.h:74
SCRIPT_ERR_DISABLED_OPCODE
@ SCRIPT_ERR_DISABLED_OPCODE
Definition: script_error.h:35
SCRIPT_ERR_WITNESS_PROGRAM_WITNESS_EMPTY
@ SCRIPT_ERR_WITNESS_PROGRAM_WITNESS_EMPTY
Definition: script_error.h:65
SCRIPT_ERR_SIG_COUNT
@ SCRIPT_ERR_SIG_COUNT
Definition: script_error.h:23
SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS
@ SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS
Definition: script_error.h:57
SCRIPT_ERR_PUSH_SIZE
@ SCRIPT_ERR_PUSH_SIZE
Definition: script_error.h:20
SCRIPT_ERR_STACK_SIZE
@ SCRIPT_ERR_STACK_SIZE
Definition: script_error.h:22
SCRIPT_ERR_EQUALVERIFY
@ SCRIPT_ERR_EQUALVERIFY
Definition: script_error.h:28
SCRIPT_ERR_SIG_FINDANDDELETE
@ SCRIPT_ERR_SIG_FINDANDDELETE
Definition: script_error.h:83
SCRIPT_ERR_SCRIPT_SIZE
@ SCRIPT_ERR_SCRIPT_SIZE
Definition: script_error.h:19
SCRIPT_ERR_DISCOURAGE_OP_SUCCESS
@ SCRIPT_ERR_DISCOURAGE_OP_SUCCESS
Definition: script_error.h:60
SCRIPT_ERR_SIG_HASHTYPE
@ SCRIPT_ERR_SIG_HASHTYPE
Definition: script_error.h:45
SCRIPT_ERR_INVALID_STACK_OPERATION
@ SCRIPT_ERR_INVALID_STACK_OPERATION
Definition: script_error.h:36
SCRIPT_ERR_MINIMALIF
@ SCRIPT_ERR_MINIMALIF
Definition: script_error.h:53
SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH
@ SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH
Definition: script_error.h:66
SCRIPT_ERR_OP_CODESEPARATOR
@ SCRIPT_ERR_OP_CODESEPARATOR
Definition: script_error.h:82
SCRIPT_ERR_CLEANSTACK
@ SCRIPT_ERR_CLEANSTACK
Definition: script_error.h:52
SCRIPT_ERR_SCHNORR_SIG_SIZE
@ SCRIPT_ERR_SCHNORR_SIG_SIZE
Definition: script_error.h:73
SCRIPT_ERR_CHECKSIGVERIFY
@ SCRIPT_ERR_CHECKSIGVERIFY
Definition: script_error.h:30
SCRIPT_ERR_TAPSCRIPT_CHECKMULTISIG
@ SCRIPT_ERR_TAPSCRIPT_CHECKMULTISIG
Definition: script_error.h:78
SCRIPT_ERR_WITNESS_PROGRAM_WRONG_LENGTH
@ SCRIPT_ERR_WITNESS_PROGRAM_WRONG_LENGTH
Definition: script_error.h:64
SCRIPT_ERR_UNBALANCED_CONDITIONAL
@ SCRIPT_ERR_UNBALANCED_CONDITIONAL
Definition: script_error.h:38
SCRIPT_ERR_PUBKEY_COUNT
@ SCRIPT_ERR_PUBKEY_COUNT
Definition: script_error.h:24
script_error.h
SCRIPT_ERR_SIG_HIGH_S
@ SCRIPT_ERR_SIG_HIGH_S
Definition: script_error.h:49
SCRIPT_ERR_VERIFY
@ SCRIPT_ERR_VERIFY
Definition: script_error.h:27
SCRIPT_ERR_NUMEQUALVERIFY
@ SCRIPT_ERR_NUMEQUALVERIFY
Definition: script_error.h:31
SCRIPT_ERR_TAPSCRIPT_MINIMALIF
@ SCRIPT_ERR_TAPSCRIPT_MINIMALIF
Definition: script_error.h:79
SCRIPT_ERR_DISCOURAGE_UPGRADABLE_PUBKEYTYPE
@ SCRIPT_ERR_DISCOURAGE_UPGRADABLE_PUBKEYTYPE
Definition: script_error.h:61
SCRIPT_ERR_SIG_NULLDUMMY
@ SCRIPT_ERR_SIG_NULLDUMMY
Definition: script_error.h:50
SCRIPT_ERR_BAD_OPCODE
@ SCRIPT_ERR_BAD_OPCODE
Definition: script_error.h:34
SCRIPT_ERR_WITNESS_MALLEATED
@ SCRIPT_ERR_WITNESS_MALLEATED
Definition: script_error.h:67
SCRIPT_ERR_UNKNOWN_ERROR
@ SCRIPT_ERR_UNKNOWN_ERROR
Definition: script_error.h:14
SCRIPT_ERR_UNSATISFIED_LOCKTIME
@ SCRIPT_ERR_UNSATISFIED_LOCKTIME
Definition: script_error.h:42
SCRIPT_ERR_PUBKEYTYPE
@ SCRIPT_ERR_PUBKEYTYPE
Definition: script_error.h:51
SCRIPT_ERR_WITNESS_PUBKEYTYPE
@ SCRIPT_ERR_WITNESS_PUBKEYTYPE
Definition: script_error.h:70
SCRIPT_ERR_ERROR_COUNT
@ SCRIPT_ERR_ERROR_COUNT
Definition: script_error.h:85