Bitcoin ABC  0.28.12
P2P Digital Currency
script_error.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2016 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 #ifndef BITCOIN_SCRIPT_SCRIPT_ERROR_H
7 #define BITCOIN_SCRIPT_SCRIPT_ERROR_H
8 
9 #include <string>
10 
11 enum class ScriptError {
12  OK = 0,
13  UNKNOWN,
14  EVAL_FALSE,
15  OP_RETURN,
16 
17  /* Max sizes */
19  PUSH_SIZE,
20  OP_COUNT,
21  STACK_SIZE,
22  SIG_COUNT,
25 
26  /* Operands checks */
32 
33  /* Failed verify operations */
34  VERIFY,
40 
41  /* Logical/Format/Canonical errors */
42  BAD_OPCODE,
47 
48  /* Divisor errors */
51 
52  /* Bitfield errors */
55 
56  /* CHECKLOCKTIMEVERIFY and CHECKSEQUENCEVERIFY */
59 
60  /* Malleability */
62  SIG_DER,
65  SIG_HIGH_S,
66  PUBKEYTYPE,
67  CLEANSTACK,
68  MINIMALIF,
70 
71  /* Schnorr */
74 
75  /* softfork safeness */
77 
78  /* anti replay */
81 
82  /* Auxiliary errors (unused by interpreter) */
84 
86 };
87 
88 #define SCRIPT_ERR_LAST ScriptError::ERROR_COUNT
89 
90 std::string ScriptErrorString(const ScriptError error);
91 
92 namespace {
93 
94 inline bool set_success(ScriptError *ret) {
95  if (ret) {
96  *ret = ScriptError::OK;
97  }
98  return true;
99 }
100 
101 inline bool set_error(ScriptError *ret, const ScriptError serror) {
102  if (ret) {
103  *ret = serror;
104  }
105  return false;
106 }
107 
108 } // namespace
109 
110 #endif // BITCOIN_SCRIPT_SCRIPT_ERROR_H
ScriptError
Definition: script_error.h:11
@ DISCOURAGE_UPGRADABLE_NOPS
@ INVALID_ALTSTACK_OPERATION
@ UNSATISFIED_LOCKTIME
@ INVALID_BITFIELD_SIZE
@ SIGCHECKS_LIMIT_EXCEEDED
@ INVALID_OPERAND_SIZE
@ INVALID_STACK_OPERATION
@ UNBALANCED_CONDITIONAL
@ INVALID_NUMBER_RANGE
std::string ScriptErrorString(const ScriptError error)
bool error(const char *fmt, const Args &...args)
Definition: system.h:45