Changeset View
Changeset View
Standalone View
Standalone View
src/script/script.cpp
Show First 20 Lines • Show All 449 Lines • ▼ Show 20 Lines | bool CScript::IsWitnessProgram(int &version, | ||||
if (size_t((*this)[1] + 2) == this->size()) { | if (size_t((*this)[1] + 2) == this->size()) { | ||||
version = DecodeOP_N((opcodetype)(*this)[0]); | version = DecodeOP_N((opcodetype)(*this)[0]); | ||||
program = std::vector<uint8_t>(this->begin() + 2, this->end()); | program = std::vector<uint8_t>(this->begin() + 2, this->end()); | ||||
return true; | return true; | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
// Wrapper returning only the predicate | |||||
bool CScript::IsWitnessProgram() const { | |||||
int version; | |||||
std::vector<uint8_t> program; | |||||
return IsWitnessProgram(version, program); | |||||
} | |||||
bool CScript::IsPushOnly(const_iterator pc) const { | bool CScript::IsPushOnly(const_iterator pc) const { | ||||
while (pc < end()) { | while (pc < end()) { | ||||
opcodetype opcode; | opcodetype opcode; | ||||
if (!GetOp(pc, opcode)) { | if (!GetOp(pc, opcode)) { | ||||
return false; | return false; | ||||
} | } | ||||
// Note that IsPushOnly() *does* consider OP_RESERVED to be a push-type | // Note that IsPushOnly() *does* consider OP_RESERVED to be a push-type | ||||
Show All 13 Lines |