Changeset View
Changeset View
Standalone View
Standalone View
src/script/script.cpp
Show First 20 Lines • Show All 502 Lines • ▼ Show 20 Lines | while (pc < end()) { | ||||
} | } | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
bool CScript::IsPushOnly() const { | bool CScript::IsPushOnly() const { | ||||
return this->IsPushOnly(begin()); | return this->IsPushOnly(begin()); | ||||
} | } | ||||
bool GetScriptOp(CScriptBase::const_iterator &pc, | |||||
CScriptBase::const_iterator end, opcodetype &opcodeRet, | |||||
std::vector<uint8_t> *pvchRet) { | |||||
opcodeRet = OP_INVALIDOPCODE; | |||||
if (pvchRet) { | |||||
pvchRet->clear(); | |||||
} | |||||
if (pc >= end) { | |||||
return false; | |||||
} | |||||
// Read instruction | |||||
if (end - pc < 1) { | |||||
return false; | |||||
} | |||||
uint32_t opcode = *pc++; | |||||
deadalnix: I don't understand why you are adding random changes to code that simply should have moved. | |||||
// Immediate operand | |||||
if (opcode <= OP_PUSHDATA4) { | |||||
uint32_t nSize = 0; | |||||
if (opcode < OP_PUSHDATA1) { | |||||
nSize = opcode; | |||||
} else if (opcode == OP_PUSHDATA1) { | |||||
if (end - pc < 1) { | |||||
return false; | |||||
} | |||||
nSize = *pc++; | |||||
} else if (opcode == OP_PUSHDATA2) { | |||||
if (end - pc < 2) { | |||||
return false; | |||||
} | |||||
nSize = ReadLE16(&pc[0]); | |||||
pc += 2; | |||||
} else if (opcode == OP_PUSHDATA4) { | |||||
if (end - pc < 4) { | |||||
return false; | |||||
} | |||||
nSize = ReadLE32(&pc[0]); | |||||
pc += 4; | |||||
} | |||||
if (end - pc < 0 || uint32_t(end - pc) < nSize) { | |||||
return false; | |||||
} | |||||
if (pvchRet) { | |||||
pvchRet->assign(pc, pc + nSize); | |||||
} | |||||
pc += nSize; | |||||
} | |||||
opcodeRet = static_cast<opcodetype>(opcode); | |||||
return true; | |||||
} |
I don't understand why you are adding random changes to code that simply should have moved.