Commit af2501bf authored by Luke Dashjr's avatar Luke Dashjr Committed by Pavel Vasin

Enable customising node policy for datacarrier data size with a -datacarriersize option

parent 62b1820d
......@@ -6,6 +6,7 @@
#include "init.h"
#include "main.h"
#include "chainparams.h"
#include "script.h"
#include "txdb.h"
#include "rpcserver.h"
#include "net.h"
......@@ -244,6 +245,8 @@ std::string HelpMessage()
strUsage += " -loadblock=<file> " + _("Imports blocks from external blk000?.dat file") + "\n";
strUsage += " -maxorphanblocksmib=<n> " + strprintf(_("Keep at most <n> MiB of unconnectable blocks in memory (default: %u)"), DEFAULT_MAX_ORPHAN_BLOCKS) + "\n";
strUsage += " -datacarriersize " + strprintf(_("Maximum size of data in data carrier transactions we relay and mine (default: %u)"), MAX_OP_RETURN_RELAY) + "\n";
strUsage += "\n" + _("Block creation options:") + "\n";
strUsage += " -blockminsize=<n> " + _("Set minimum block size in bytes (default: 0)") + "\n";
strUsage += " -blockmaxsize=<n> " + _("Set maximum block size in bytes (default: 250000)") + "\n";
......@@ -441,6 +444,8 @@ bool AppInit2(boost::thread_group& threadGroup)
}
#endif
nMaxDatacarrierBytes = GetArg("-datacarriersize", nMaxDatacarrierBytes);
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
// Sanity check
......
......@@ -29,6 +29,7 @@ static const CBigNum bnFalse(0);
static const CBigNum bnTrue(1);
static const size_t nDefaultMaxNumSize = 4;
unsigned nMaxDatacarrierBytes = MAX_OP_RETURN_RELAY;
CBigNum CastToBigNum(const valtype& vch, const size_t nMaxNumSize = nDefaultMaxNumSize)
{
......@@ -1372,8 +1373,8 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
}
else if (opcode2 == OP_SMALLDATA)
{
// small pushdata, <= MAX_OP_RETURN_RELAY bytes
if (vch1.size() > MAX_OP_RETURN_RELAY)
// small pushdata, <= nMaxDatacarrierBytes
if (vch1.size() > nMaxDatacarrierBytes)
break;
}
else if (opcode1 != opcode2 || vch1 != vch2)
......
......@@ -24,6 +24,7 @@ class CTransaction;
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE = 520; // bytes
static const unsigned int MAX_OP_RETURN_RELAY = 40; // bytes
extern unsigned nMaxDatacarrierBytes;
/** Signature hash types/flags */
enum
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment