Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
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) {
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:226
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
ScriptError
@ 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)