Merge pull request #5077

2aa6329 Enable customising node policy for datacarrier data size with a -datacarriersize option (Luke Dashjr)
This commit is contained in:
Wladimir J. van der Laan 2014-10-31 11:10:10 +01:00
commit 96012e83f1
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
3 changed files with 8 additions and 2 deletions

View File

@ -18,6 +18,7 @@
#include "miner.h" #include "miner.h"
#include "net.h" #include "net.h"
#include "rpcserver.h" #include "rpcserver.h"
#include "script/standard.h"
#include "txdb.h" #include "txdb.h"
#include "ui_interface.h" #include "ui_interface.h"
#include "util.h" #include "util.h"
@ -346,6 +347,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += "\n" + _("Node relay options:") + "\n"; strUsage += "\n" + _("Node relay options:") + "\n";
strUsage += " -datacarrier " + strprintf(_("Relay and mine data carrier transactions (default: %u)"), 1) + "\n"; strUsage += " -datacarrier " + strprintf(_("Relay and mine data carrier transactions (default: %u)"), 1) + "\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 += "\n" + _("Block creation options:") + "\n";
strUsage += " -blockminsize=<n> " + strprintf(_("Set minimum block size in bytes (default: %u)"), 0) + "\n"; strUsage += " -blockminsize=<n> " + strprintf(_("Set minimum block size in bytes (default: %u)"), 0) + "\n";
@ -704,6 +706,7 @@ bool AppInit2(boost::thread_group& threadGroup)
#endif // ENABLE_WALLET #endif // ENABLE_WALLET
fIsBareMultisigStd = GetArg("-permitbaremultisig", true) != 0; fIsBareMultisigStd = GetArg("-permitbaremultisig", true) != 0;
nMaxDatacarrierBytes = GetArg("-datacarriersize", nMaxDatacarrierBytes);
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log // ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log

View File

@ -15,6 +15,8 @@ using namespace std;
typedef vector<unsigned char> valtype; typedef vector<unsigned char> valtype;
unsigned nMaxDatacarrierBytes = MAX_OP_RETURN_RELAY;
CScriptID::CScriptID(const CScript& in) : uint160(in.size() ? Hash160(in.begin(), in.end()) : 0) {} CScriptID::CScriptID(const CScript& in) : uint160(in.size() ? Hash160(in.begin(), in.end()) : 0) {}
const char* GetTxnOutputType(txnouttype t) const char* GetTxnOutputType(txnouttype t)
@ -139,8 +141,8 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
} }
else if (opcode2 == OP_SMALLDATA) else if (opcode2 == OP_SMALLDATA)
{ {
// small pushdata, <= MAX_OP_RETURN_RELAY bytes // small pushdata, <= nMaxDatacarrierBytes
if (vch1.size() > MAX_OP_RETURN_RELAY) if (vch1.size() > nMaxDatacarrierBytes)
break; break;
} }
else if (opcode1 != opcode2 || vch1 != vch2) else if (opcode1 != opcode2 || vch1 != vch2)

View File

@ -26,6 +26,7 @@ public:
}; };
static const unsigned int MAX_OP_RETURN_RELAY = 40; // bytes static const unsigned int MAX_OP_RETURN_RELAY = 40; // bytes
extern unsigned nMaxDatacarrierBytes;
// Mandatory script verification flags that all new blocks must comply with for // Mandatory script verification flags that all new blocks must comply with for
// them to be valid. (but old blocks may not comply with) Currently just P2SH, // them to be valid. (but old blocks may not comply with) Currently just P2SH,