Changeset View
Changeset View
Standalone View
Standalone View
src/script/script.h
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | enum opcodetype { | ||||
OP_SMALLINTEGER = 0xfa, | OP_SMALLINTEGER = 0xfa, | ||||
OP_PUBKEYS = 0xfb, | OP_PUBKEYS = 0xfb, | ||||
OP_PUBKEYHASH = 0xfd, | OP_PUBKEYHASH = 0xfd, | ||||
OP_PUBKEY = 0xfe, | OP_PUBKEY = 0xfe, | ||||
OP_INVALIDOPCODE = 0xff, | OP_INVALIDOPCODE = 0xff, | ||||
}; | }; | ||||
// Maximum value that an opcode can be | |||||
static const unsigned int MAX_OPCODE = OP_NOP10; | |||||
const char *GetOpName(opcodetype opcode); | const char *GetOpName(opcodetype opcode); | ||||
class scriptnum_error : public std::runtime_error { | class scriptnum_error : public std::runtime_error { | ||||
public: | public: | ||||
explicit scriptnum_error(const std::string &str) | explicit scriptnum_error(const std::string &str) | ||||
: std::runtime_error(str) {} | : std::runtime_error(str) {} | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 439 Lines • ▼ Show 20 Lines | public: | ||||
/** | /** | ||||
* Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it | * Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it | ||||
* consensus-critical). | * consensus-critical). | ||||
*/ | */ | ||||
bool IsPushOnly(const_iterator pc) const; | bool IsPushOnly(const_iterator pc) const; | ||||
bool IsPushOnly() const; | bool IsPushOnly() const; | ||||
/** Check if the script contains valid OP_CODES */ | |||||
bool HasValidOps() const; | |||||
/** | /** | ||||
* Returns whether the script is guaranteed to fail at execution, regardless | * Returns whether the script is guaranteed to fail at execution, regardless | ||||
* of the initial stack. This allows outputs to be pruned instantly when | * of the initial stack. This allows outputs to be pruned instantly when | ||||
* entering the UTXO set. | * entering the UTXO set. | ||||
*/ | */ | ||||
bool IsUnspendable() const { | bool IsUnspendable() const { | ||||
return (size() > 0 && *begin() == OP_RETURN) || | return (size() > 0 && *begin() == OP_RETURN) || | ||||
(size() > MAX_SCRIPT_SIZE); | (size() > MAX_SCRIPT_SIZE); | ||||
Show All 18 Lines |