Disable OP_CODESEPARATOR
This commit is contained in:
parent
05e2db116d
commit
bab187e963
|
@ -289,7 +289,8 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, un
|
||||||
opcode == OP_DIV ||
|
opcode == OP_DIV ||
|
||||||
opcode == OP_MOD ||
|
opcode == OP_MOD ||
|
||||||
opcode == OP_LSHIFT ||
|
opcode == OP_LSHIFT ||
|
||||||
opcode == OP_RSHIFT)
|
opcode == OP_RSHIFT ||
|
||||||
|
opcode == OP_CODESEPARATOR)
|
||||||
return set_error(serror, SCRIPT_ERR_DISABLED_OPCODE); // Disabled opcodes.
|
return set_error(serror, SCRIPT_ERR_DISABLED_OPCODE); // Disabled opcodes.
|
||||||
|
|
||||||
if (fExec && 0 <= opcode && opcode <= OP_PUSHDATA4) {
|
if (fExec && 0 <= opcode && opcode <= OP_PUSHDATA4) {
|
||||||
|
@ -814,13 +815,6 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, un
|
||||||
popstack(stack);
|
popstack(stack);
|
||||||
stack.push_back(vchHash);
|
stack.push_back(vchHash);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case OP_CODESEPARATOR:
|
|
||||||
{
|
|
||||||
// Hash starts after the code separator
|
|
||||||
pbegincodehash = pc;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_CHECKSIG:
|
case OP_CHECKSIG:
|
||||||
|
@ -981,27 +975,12 @@ public:
|
||||||
fHashSingle((nHashTypeIn & 0x1f) == SIGHASH_SINGLE),
|
fHashSingle((nHashTypeIn & 0x1f) == SIGHASH_SINGLE),
|
||||||
fHashNone((nHashTypeIn & 0x1f) == SIGHASH_NONE) {}
|
fHashNone((nHashTypeIn & 0x1f) == SIGHASH_NONE) {}
|
||||||
|
|
||||||
/** Serialize the passed scriptCode, skipping OP_CODESEPARATORs */
|
/** Serialize the passed scriptCode */
|
||||||
template<typename S>
|
template<typename S>
|
||||||
void SerializeScriptCode(S &s, int nType, int nVersion) const {
|
void SerializeScriptCode(S &s, int nType, int nVersion) const {
|
||||||
CScript::const_iterator it = scriptCode.begin();
|
auto size = scriptCode.size();
|
||||||
CScript::const_iterator itBegin = it;
|
::WriteCompactSize(s, size);
|
||||||
opcodetype opcode;
|
s.write((char*)&scriptCode.begin()[0], size);
|
||||||
unsigned int nCodeSeparators = 0;
|
|
||||||
while (scriptCode.GetOp(it, opcode)) {
|
|
||||||
if (opcode == OP_CODESEPARATOR)
|
|
||||||
nCodeSeparators++;
|
|
||||||
}
|
|
||||||
::WriteCompactSize(s, scriptCode.size() - nCodeSeparators);
|
|
||||||
it = itBegin;
|
|
||||||
while (scriptCode.GetOp(it, opcode)) {
|
|
||||||
if (opcode == OP_CODESEPARATOR) {
|
|
||||||
s.write((char*)&itBegin[0], it-itBegin-1);
|
|
||||||
itBegin = it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (itBegin != scriptCode.end())
|
|
||||||
s.write((char*)&itBegin[0], it-itBegin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Serialize an input of txTo */
|
/** Serialize an input of txTo */
|
||||||
|
|
Loading…
Reference in New Issue