Bitcoin ABC 0.30.7
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
11enum class ScriptError {
12 OK = 0,
13 UNKNOWN,
16
17 /* Max sizes */
25
26 /* Operands checks */
32
33 /* Failed verify operations */
34 VERIFY,
40
41 /* Logical/Format/Canonical errors */
47
48 /* Divisor errors */
51
52 /* Bitfield errors */
55
56 /* CHECKLOCKTIMEVERIFY and CHECKSEQUENCEVERIFY */
59
60 /* Malleability */
62 SIG_DER,
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
90std::string ScriptErrorString(const ScriptError error);
91
92namespace {
93
94inline bool set_success(ScriptError *ret) {
95 if (ret) {
96 *ret = ScriptError::OK;
97 }
98 return true;
99}
100
101inline 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
bool error(const char *fmt, const Args &...args)
Definition: logging.h:263
#define SIG_COUNT
Definition: tests_impl.h:38
@ OP_RETURN
Definition: script.h:84
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)