Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/script/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, un
return set_error(serror, SCRIPT_ERR_PUSH_SIZE);

// Note how OP_RESERVED does not count towards the opcode limit.
if (opcode > OP_16 && ++nOpCount > 201)
if (opcode > OP_16 && ++nOpCount > MAX_OPCODES_PER_SCRIPT)
return set_error(serror, SCRIPT_ERR_OP_COUNT);

if (opcode == OP_CAT ||
Expand Down Expand Up @@ -830,7 +830,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, un
if (nKeysCount < 0 || nKeysCount > 20)
return set_error(serror, SCRIPT_ERR_PUBKEY_COUNT);
nOpCount += nKeysCount;
if (nOpCount > 201)
if (nOpCount > MAX_OPCODES_PER_SCRIPT)
return set_error(serror, SCRIPT_ERR_OP_COUNT);
int ikey = ++i;
i += nKeysCount;
Expand Down
1 change: 1 addition & 0 deletions src/script/script.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <vector>

static const unsigned int MAX_SCRIPT_ELEMENT_SIZE = 520; // bytes
static const unsigned int MAX_OPCODES_PER_SCRIPT = 201;

template <typename T>
std::vector<unsigned char> ToByteVector(const T& in)
Expand Down