19 return "OP_PUSHDATA1";
21 return "OP_PUSHDATA2";
23 return "OP_PUSHDATA4";
85 return "OP_TOALTSTACK";
87 return "OP_FROMALTSTACK";
147 return "OP_EQUALVERIFY";
149 return "OP_RESERVED1";
151 return "OP_RESERVED2";
169 return "OP_0NOTEQUAL";
189 return "OP_NUMEQUAL";
191 return "OP_NUMEQUALVERIFY";
193 return "OP_NUMNOTEQUAL";
195 return "OP_LESSTHAN";
197 return "OP_GREATERTHAN";
199 return "OP_LESSTHANOREQUAL";
201 return "OP_GREATERTHANOREQUAL";
211 return "OP_RIPEMD160";
221 return "OP_CODESEPARATOR";
223 return "OP_CHECKSIG";
225 return "OP_CHECKSIGVERIFY";
227 return "OP_CHECKMULTISIG";
229 return "OP_CHECKMULTISIGVERIFY";
231 return "OP_CHECKDATASIG";
233 return "OP_CHECKDATASIGVERIFY";
235 return "OP_REVERSEBYTES";
241 return "OP_CHECKLOCKTIMEVERIFY";
243 return "OP_CHECKSEQUENCEVERIFY";
260 return "OP_INVALIDOPCODE";
270 if (data.size() == 0) {
272 return opcode ==
OP_0;
274 if (data.size() == 1 && data[0] >= 1 && data[0] <= 16) {
278 if (data.size() == 1 && data[0] == 0x81) {
282 if (data.size() <= 75) {
285 return opcode == data.size();
287 if (data.size() <= 255) {
291 if (data.size() <= 65535) {
299 const size_t nMaxNumSize) {
300 if (vch.size() > nMaxNumSize) {
304 if (vch.size() > 0) {
311 if ((vch.back() & 0x7f) == 0) {
317 if (vch.size() <= 1 || (vch[vch.size() - 2] & 0x80) == 0) {
327 if (data.size() == 0) {
332 uint8_t last = data.back();
339 if (data.size() == 1) {
345 if (data[data.size() - 2] & 0x80) {
350 for (
size_t i = data.size() - 1; i > 0; i--) {
352 if (data[i - 1] != 0) {
353 if (data[i - 1] & 0x80) {
374 return (this->size() == 23 && (*
this)[0] ==
OP_HASH160 &&
375 (*
this)[1] == 0x14 && (*
this)[22] ==
OP_EQUAL);
382 if (data.size() > 64 || this->size() != data.size() + 2) {
386 if ((*
this)[0] !=
OP_RETURN || (*this)[1] != data.size()) {
390 for (
size_t i = 0; i < data.size(); i++) {
391 if ((*
this)[i + 2] != data[i]) {
402 std::vector<uint8_t> &program)
const {
403 if (this->size() < 4 || this->size() > 42) {
406 if ((*
this)[0] !=
OP_0 && ((*
this)[0] <
OP_1 || (*
this)[0] >
OP_16)) {
409 if (
size_t((*
this)[1] + 2) == this->size()) {
411 program = std::vector<uint8_t>(this->begin() + 2, this->end());
420 std::vector<uint8_t> program;
421 return IsWitnessProgram(version, program);
427 if (!GetOp(pc, opcode)) {
435 if (opcode >
OP_16) {
443 return this->IsPushOnly(begin());
448 std::vector<uint8_t> *pvchRet) {
462 uint32_t opcode = *pc++;
487 if (end - pc < 0 || uint32_t(end - pc) < nSize) {
491 pvchRet->assign(pc, pc + nSize);
504 std::vector<uint8_t> item;
505 if (!GetOp(it, opcode, item) || opcode >
MAX_OPCODE ||
static uint16_t ReadLE16(const uint8_t *ptr)
static const unsigned int MAX_OPCODE
bool IsWitnessProgram() const
bool IsPayToScriptHash() const
bool GetScriptOp(CScriptBase::const_iterator &pc, CScriptBase::const_iterator end, opcodetype &opcodeRet, std::vector< uint8_t > *pvchRet)
bool HasValidOps() const
Check if the script contains valid OP_CODES.
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE
static bool IsMinimallyEncoded(const std::vector< uint8_t > &vch, const size_t nMaxNumSize=CScriptNum::MAXIMUM_ELEMENT_SIZE)
bool CheckMinimalPush(const std::vector< uint8_t > &data, opcodetype opcode)
Check whether the given stack element data would be minimally pushed using the given opcode...
opcodetype
Script opcodes.
bool IsCommitment(const std::vector< uint8_t > &data) const
static uint32_t ReadLE32(const uint8_t *ptr)
const char * GetOpName(opcodetype opcode)
static bool MinimallyEncode(std::vector< uint8_t > &data)