20 return "OP_PUSHDATA1";
22 return "OP_PUSHDATA2";
24 return "OP_PUSHDATA4";
86 return "OP_TOALTSTACK";
88 return "OP_FROMALTSTACK";
148 return "OP_EQUALVERIFY";
150 return "OP_RESERVED1";
152 return "OP_RESERVED2";
170 return "OP_0NOTEQUAL";
190 return "OP_NUMEQUAL";
192 return "OP_NUMEQUALVERIFY";
194 return "OP_NUMNOTEQUAL";
196 return "OP_LESSTHAN";
198 return "OP_GREATERTHAN";
200 return "OP_LESSTHANOREQUAL";
202 return "OP_GREATERTHANOREQUAL";
212 return "OP_RIPEMD160";
222 return "OP_CODESEPARATOR";
224 return "OP_CHECKSIG";
226 return "OP_CHECKSIGVERIFY";
228 return "OP_CHECKMULTISIG";
230 return "OP_CHECKMULTISIGVERIFY";
232 return "OP_CHECKDATASIG";
234 return "OP_CHECKDATASIGVERIFY";
236 return "OP_REVERSEBYTES";
242 return "OP_CHECKLOCKTIMEVERIFY";
244 return "OP_CHECKSEQUENCEVERIFY";
261 return "OP_INVALIDOPCODE";
271 if (data.size() == 0) {
273 return opcode ==
OP_0;
275 if (data.size() == 1 && data[0] >= 1 && data[0] <= 16) {
279 if (data.size() == 1 && data[0] == 0x81) {
283 if (data.size() <= 75) {
286 return opcode == data.size();
288 if (data.size() <= 255) {
292 if (data.size() <= 65535) {
300 const size_t nMaxNumSize) {
301 if (vch.size() > nMaxNumSize) {
305 if (vch.size() > 0) {
312 if ((vch.back() & 0x7f) == 0) {
318 if (vch.size() <= 1 || (vch[vch.size() - 2] & 0x80) == 0) {
328 if (data.size() == 0) {
333 uint8_t last = data.back();
340 if (data.size() == 1) {
346 if (data[data.size() - 2] & 0x80) {
351 for (
size_t i = data.size() - 1; i > 0; i--) {
353 if (data[i - 1] != 0) {
354 if (data[i - 1] & 0x80) {
376 (*
this)[1] == 0x14 && (*
this)[22] ==
OP_EQUAL);
382 std::vector<uint8_t> &program)
const {
383 if (this->
size() < 4 || this->
size() > 42) {
386 if ((*
this)[0] !=
OP_0 && ((*
this)[0] <
OP_1 || (*
this)[0] >
OP_16)) {
389 if (
size_t((*
this)[1] + 2) == this->
size()) {
391 program = std::vector<uint8_t>(this->
begin() + 2, this->
end());
400 std::vector<uint8_t> program;
407 if (!
GetOp(pc, opcode)) {
415 if (opcode >
OP_16) {
428 std::vector<uint8_t> *pvchRet) {
442 uint32_t opcode = *pc++;
467 if (end - pc < 0 || uint32_t(end - pc) < nSize) {
471 pvchRet->assign(pc, pc + nSize);
484 std::vector<uint8_t> item;
bool IsPayToScriptHash() const
static int DecodeOP_N(opcodetype opcode)
Encode/decode small integers:
bool IsWitnessProgram() const
bool HasValidOps() const
Check if the script contains valid OP_CODES.
bool GetOp(const_iterator &pc, opcodetype &opcodeRet, std::vector< uint8_t > &vchRet) const
static bool MinimallyEncode(std::vector< uint8_t > &data)
static bool IsMinimallyEncoded(const std::vector< uint8_t > &vch, const size_t nMaxNumSize=CScriptNum::MAXIMUM_ELEMENT_SIZE)
static uint16_t ReadLE16(const uint8_t *ptr)
static uint32_t ReadLE32(const uint8_t *ptr)
std::string GetOpName(opcodetype opcode)
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.
bool GetScriptOp(CScriptBase::const_iterator &pc, CScriptBase::const_iterator end, opcodetype &opcodeRet, std::vector< uint8_t > *pvchRet)
static const unsigned int MAX_OPCODE
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE
opcodetype
Script opcodes.