Browse Source

OK, it was decided that MAX_SCRIPT_ELEMENT_SIZE shall be 3072.

cn
Jianping Wu 6 years ago
parent
commit
e30e56ef11
  1. 2
      src/net_processing.cpp
  2. 2
      src/policy/policy.cpp
  3. 2
      src/script/script.h
  4. 2
      src/wallet/wallet.cpp

2
src/net_processing.cpp

@ -2798,7 +2798,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr @@ -2798,7 +2798,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
std::vector<unsigned char> vData;
vRecv >> vData;
// Nodes must NEVER send a data item > 520 bytes (the max size for a script data object,
// Nodes must NEVER send a data item > MAX_SCRIPT_ELEMENT_SIZE bytes (the max size for a script data object,
// and thus, the maximum size any matched object can have) in a filteradd message
bool bad = false;
if (vData.size() > MAX_SCRIPT_ELEMENT_SIZE) {

2
src/policy/policy.cpp

@ -99,7 +99,7 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason, const bool witnes @@ -99,7 +99,7 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason, const bool witnes
for (const CTxIn& txin : tx.vin)
{
// Biggest 'standard' txin is a 15-of-15 P2SH multisig with compressed
// keys (remember the 520 byte limit on redeemScript size). That works
// keys (remember the MAX_SCRIPT_ELEMENT_SIZE byte limit on redeemScript size). That works
// out to a (15*(33+1))+3=513 byte redeemScript, 513+1+15*(73+1)+3=1627
// bytes of scriptSig, which we round off to 1650 bytes for some minor
// future-proofing. That's also enough to spend a 20-of-20

2
src/script/script.h

@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
#include <vector>
// Maximum number of bytes pushable to the stack
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE = 520;
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE = 3072;
// Maximum number of non-push operations per script
static const int MAX_OPS_PER_SCRIPT = 201;

2
src/wallet/wallet.cpp

@ -4352,7 +4352,7 @@ std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key) @@ -4352,7 +4352,7 @@ std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key)
CTxDestination CWallet::AddAndGetDestinationForScript(const CScript& script, OutputType type)
{
// Note that scripts over 520 bytes are not yet supported.
// Note that scripts over MAX_SCRIPT_ELEMENT_SIZE bytes are not yet supported.
switch (type) {
case OUTPUT_TYPE_LEGACY:
return CScriptID(script);

Loading…
Cancel
Save