forked from Bitcoin-ABC/bitcoin-abc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript_error.h
108 lines (86 loc) · 2.04 KB
/
script_error.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_SCRIPT_SCRIPT_ERROR_H
#define BITCOIN_SCRIPT_SCRIPT_ERROR_H
enum class ScriptError {
OK = 0,
UNKNOWN,
EVAL_FALSE,
OP_RETURN,
/* Max sizes */
SCRIPT_SIZE,
PUSH_SIZE,
OP_COUNT,
STACK_SIZE,
SIG_COUNT,
PUBKEY_COUNT,
/* Operands checks */
INVALID_OPERAND_SIZE,
INVALID_NUMBER_RANGE,
IMPOSSIBLE_ENCODING,
INVALID_SPLIT_RANGE,
INVALID_BIT_COUNT,
/* Failed verify operations */
VERIFY,
EQUALVERIFY,
CHECKMULTISIGVERIFY,
CHECKSIGVERIFY,
CHECKDATASIGVERIFY,
NUMEQUALVERIFY,
/* Logical/Format/Canonical errors */
BAD_OPCODE,
DISABLED_OPCODE,
INVALID_STACK_OPERATION,
INVALID_ALTSTACK_OPERATION,
UNBALANCED_CONDITIONAL,
/* Divisor errors */
DIV_BY_ZERO,
MOD_BY_ZERO,
/* Bitfield errors */
INVALID_BITFIELD_SIZE,
INVALID_BIT_RANGE,
/* CHECKLOCKTIMEVERIFY and CHECKSEQUENCEVERIFY */
NEGATIVE_LOCKTIME,
UNSATISFIED_LOCKTIME,
/* Malleability */
SIG_HASHTYPE,
SIG_DER,
MINIMALDATA,
SIG_PUSHONLY,
SIG_HIGH_S,
SIG_NULLDUMMY,
PUBKEYTYPE,
CLEANSTACK,
MINIMALIF,
SIG_NULLFAIL,
/* Schnorr */
SIG_BADLENGTH,
SIG_NONSCHNORR,
/* softfork safeness */
DISCOURAGE_UPGRADABLE_NOPS,
/* misc */
NONCOMPRESSED_PUBKEY,
/* anti replay */
ILLEGAL_FORKID,
MUST_USE_FORKID,
ERROR_COUNT,
};
#define SCRIPT_ERR_LAST ScriptError::ERROR_COUNT
const char *ScriptErrorString(const ScriptError error);
namespace {
inline bool set_success(ScriptError *ret) {
if (ret) {
*ret = ScriptError::OK;
}
return true;
}
inline bool set_error(ScriptError *ret, const ScriptError serror) {
if (ret) {
*ret = serror;
}
return false;
}
} // namespace
#endif // BITCOIN_SCRIPT_SCRIPT_ERROR_H