Skip to content

Commit 4cb8757

Browse files
committed
Merge #10313: [Consensus] Add constant for maximum stack size
cb184b3 Add constant for maximum stack size (Gregory Sanders) Tree-SHA512: 0ec4a28552a6eee7fba8c69278f63c61f095e4ba06cb34456bd0162cd702370d10cca621ae1797a0d5e62fb39814cbb8245d3a7adc007ca39dab7a49cbc925dc
2 parents f2f7e97 + cb184b3 commit 4cb8757

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/script/interpreter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
10281028
}
10291029

10301030
// Size limits
1031-
if (stack.size() + altstack.size() > 1000)
1031+
if (stack.size() + altstack.size() > MAX_STACK_SIZE)
10321032
return set_error(serror, SCRIPT_ERR_STACK_SIZE);
10331033
}
10341034
}

src/script/script.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ static const int MAX_PUBKEYS_PER_MULTISIG = 20;
3030
// Maximum script length in bytes
3131
static const int MAX_SCRIPT_SIZE = 10000;
3232

33+
// Maximum number of values on script interpreter stack
34+
static const int MAX_STACK_SIZE = 1000;
35+
3336
// Threshold for nLockTime: below this value it is interpreted as block number,
3437
// otherwise as UNIX timestamp.
3538
static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC

0 commit comments

Comments
 (0)