mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-31 14:32:35 +02:00
feat: enable OP_CAT in tapscript
This commit is contained in:
parent
539f991ece
commit
bcd6383f3b
@ -451,10 +451,16 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
|
|||||||
if (opcode > OP_16 && ++nOpCount > MAX_OPS_PER_SCRIPT) {
|
if (opcode > OP_16 && ++nOpCount > MAX_OPS_PER_SCRIPT) {
|
||||||
return set_error(serror, SCRIPT_ERR_OP_COUNT);
|
return set_error(serror, SCRIPT_ERR_OP_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When OP_SUCCESS disabled opcodes (CVE-2010-5137) are
|
||||||
|
// redefined in tapscript, remove them from the if below
|
||||||
|
// and put them here
|
||||||
|
if (opcode == OP_CAT) {
|
||||||
|
return set_error(serror, SCRIPT_ERR_DISABLED_OPCODE); // Disabled opcodes (CVE-2010-5137).
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opcode == OP_CAT ||
|
if (opcode == OP_SUBSTR ||
|
||||||
opcode == OP_SUBSTR ||
|
|
||||||
opcode == OP_LEFT ||
|
opcode == OP_LEFT ||
|
||||||
opcode == OP_RIGHT ||
|
opcode == OP_RIGHT ||
|
||||||
opcode == OP_INVERT ||
|
opcode == OP_INVERT ||
|
||||||
@ -1213,6 +1219,22 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Byte string operations
|
||||||
|
//
|
||||||
|
case OP_CAT:
|
||||||
|
{
|
||||||
|
if (stack.size() < 2)
|
||||||
|
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
|
||||||
|
valtype& vch1 = stacktop(-2);
|
||||||
|
valtype& vch2 = stacktop(-1);
|
||||||
|
if (vch1.size() + vch2.size() > MAX_SCRIPT_ELEMENT_SIZE)
|
||||||
|
return set_error(serror, SCRIPT_ERR_PUSH_SIZE);
|
||||||
|
vch1.insert(vch1.end(), vch2.begin(), vch2.end());
|
||||||
|
popstack(stack);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return set_error(serror, SCRIPT_ERR_BAD_OPCODE);
|
return set_error(serror, SCRIPT_ERR_BAD_OPCODE);
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ bool GetScriptOp(CScriptBase::const_iterator& pc, CScriptBase::const_iterator en
|
|||||||
|
|
||||||
bool IsOpSuccess(const opcodetype& opcode)
|
bool IsOpSuccess(const opcodetype& opcode)
|
||||||
{
|
{
|
||||||
return opcode == 80 || opcode == 98 || (opcode >= 126 && opcode <= 129) ||
|
return opcode == 80 || opcode == 98 || (opcode >= 127 && opcode <= 129) ||
|
||||||
(opcode >= 131 && opcode <= 134) || (opcode >= 137 && opcode <= 138) ||
|
(opcode >= 131 && opcode <= 134) || (opcode >= 137 && opcode <= 138) ||
|
||||||
(opcode >= 141 && opcode <= 142) || (opcode >= 149 && opcode <= 153) ||
|
(opcode >= 141 && opcode <= 142) || (opcode >= 149 && opcode <= 153) ||
|
||||||
(opcode >= 187 && opcode <= 254);
|
(opcode >= 187 && opcode <= 254);
|
||||||
|
Loading…
Reference in New Issue
Block a user