Bitcoin ABC  0.24.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 
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::SIG_PUSHONLY
@ SIG_PUSHONLY
ScriptError
ScriptError
Definition: script_error.h:11
ScriptError::INVALID_OPERAND_SIZE
@ INVALID_OPERAND_SIZE
ScriptError::EVAL_FALSE
@ EVAL_FALSE
ScriptError::SIG_NULLFAIL
@ SIG_NULLFAIL
ScriptError::ILLEGAL_FORKID
@ ILLEGAL_FORKID
ScriptError::OK
@ OK
ScriptError::MINIMALDATA
@ MINIMALDATA
ScriptError::SIG_NONSCHNORR
@ SIG_NONSCHNORR
ScriptError::NEGATIVE_LOCKTIME
@ NEGATIVE_LOCKTIME
ScriptErrorString
std::string ScriptErrorString(const ScriptError error)
Definition: script_error.cpp:10
ScriptError::INPUT_SIGCHECKS
@ INPUT_SIGCHECKS
ScriptError::UNBALANCED_CONDITIONAL
@ UNBALANCED_CONDITIONAL
ScriptError::PUBKEY_COUNT
@ PUBKEY_COUNT
ScriptError::CHECKDATASIGVERIFY
@ CHECKDATASIGVERIFY
ScriptError::BAD_OPCODE
@ BAD_OPCODE
ScriptError::SCRIPT_SIZE
@ SCRIPT_SIZE
ScriptError::NUMEQUALVERIFY
@ NUMEQUALVERIFY
ScriptError::PUBKEYTYPE
@ PUBKEYTYPE
ScriptError::SIG_COUNT
@ SIG_COUNT
ScriptError::SIG_HASHTYPE
@ SIG_HASHTYPE
ScriptError::STACK_SIZE
@ STACK_SIZE
ScriptError::INVALID_BITFIELD_SIZE
@ INVALID_BITFIELD_SIZE
ScriptError::INVALID_BIT_RANGE
@ INVALID_BIT_RANGE
ScriptError::CHECKSIGVERIFY
@ CHECKSIGVERIFY
ScriptError::SIG_HIGH_S
@ SIG_HIGH_S
ScriptError::MOD_BY_ZERO
@ MOD_BY_ZERO
ScriptError::OP_COUNT
@ OP_COUNT
ScriptError::INVALID_BIT_COUNT
@ INVALID_BIT_COUNT
ScriptError::CLEANSTACK
@ CLEANSTACK
ScriptError::INVALID_ALTSTACK_OPERATION
@ INVALID_ALTSTACK_OPERATION
ScriptError::DISABLED_OPCODE
@ DISABLED_OPCODE
ScriptError::UNSATISFIED_LOCKTIME
@ UNSATISFIED_LOCKTIME
ScriptError::INVALID_NUMBER_RANGE
@ INVALID_NUMBER_RANGE
ScriptError::OP_RETURN
@ OP_RETURN
ScriptError::IMPOSSIBLE_ENCODING
@ IMPOSSIBLE_ENCODING
ScriptError::INVALID_SPLIT_RANGE
@ INVALID_SPLIT_RANGE
ScriptError::INVALID_STACK_OPERATION
@ INVALID_STACK_OPERATION
ScriptError::EQUALVERIFY
@ EQUALVERIFY
ScriptError::SIG_DER
@ SIG_DER
ScriptError::ERROR_COUNT
@ ERROR_COUNT
ScriptError::SIG_BADLENGTH
@ SIG_BADLENGTH
ScriptError::DIV_BY_ZERO
@ DIV_BY_ZERO
ScriptError::PUSH_SIZE
@ PUSH_SIZE
error
bool error(const char *fmt, const Args &... args)
Definition: system.h:48
ScriptError::VERIFY
@ VERIFY
ScriptError::UNKNOWN
@ UNKNOWN
ScriptError::DISCOURAGE_UPGRADABLE_NOPS
@ DISCOURAGE_UPGRADABLE_NOPS
ScriptError::SIGCHECKS_LIMIT_EXCEEDED
@ SIGCHECKS_LIMIT_EXCEEDED
ScriptError::CHECKMULTISIGVERIFY
@ CHECKMULTISIGVERIFY
ScriptError::MUST_USE_FORKID
@ MUST_USE_FORKID
ScriptError::MINIMALIF
@ MINIMALIF