Skip to content

Commit 96012e8

Browse files
committed
Merge pull request #5077
2aa6329 Enable customising node policy for datacarrier data size with a -datacarriersize option (Luke Dashjr)
2 parents 7bb681d + 2aa6329 commit 96012e8

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/init.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "miner.h"
1919
#include "net.h"
2020
#include "rpcserver.h"
21+
#include "script/standard.h"
2122
#include "txdb.h"
2223
#include "ui_interface.h"
2324
#include "util.h"
@@ -346,6 +347,7 @@ std::string HelpMessage(HelpMessageMode mode)
346347

347348
strUsage += "\n" + _("Node relay options:") + "\n";
348349
strUsage += " -datacarrier " + strprintf(_("Relay and mine data carrier transactions (default: %u)"), 1) + "\n";
350+
strUsage += " -datacarriersize " + strprintf(_("Maximum size of data in data carrier transactions we relay and mine (default: %u)"), MAX_OP_RETURN_RELAY) + "\n";
349351

350352
strUsage += "\n" + _("Block creation options:") + "\n";
351353
strUsage += " -blockminsize=<n> " + strprintf(_("Set minimum block size in bytes (default: %u)"), 0) + "\n";
@@ -704,6 +706,7 @@ bool AppInit2(boost::thread_group& threadGroup)
704706
#endif // ENABLE_WALLET
705707

706708
fIsBareMultisigStd = GetArg("-permitbaremultisig", true) != 0;
709+
nMaxDatacarrierBytes = GetArg("-datacarriersize", nMaxDatacarrierBytes);
707710

708711
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
709712

src/script/standard.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ using namespace std;
1515

1616
typedef vector<unsigned char> valtype;
1717

18+
unsigned nMaxDatacarrierBytes = MAX_OP_RETURN_RELAY;
19+
1820
CScriptID::CScriptID(const CScript& in) : uint160(in.size() ? Hash160(in.begin(), in.end()) : 0) {}
1921

2022
const char* GetTxnOutputType(txnouttype t)
@@ -139,8 +141,8 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
139141
}
140142
else if (opcode2 == OP_SMALLDATA)
141143
{
142-
// small pushdata, <= MAX_OP_RETURN_RELAY bytes
143-
if (vch1.size() > MAX_OP_RETURN_RELAY)
144+
// small pushdata, <= nMaxDatacarrierBytes
145+
if (vch1.size() > nMaxDatacarrierBytes)
144146
break;
145147
}
146148
else if (opcode1 != opcode2 || vch1 != vch2)

src/script/standard.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class CScriptID : public uint160
2626
};
2727

2828
static const unsigned int MAX_OP_RETURN_RELAY = 40; // bytes
29+
extern unsigned nMaxDatacarrierBytes;
2930

3031
// Mandatory script verification flags that all new blocks must comply with for
3132
// them to be valid. (but old blocks may not comply with) Currently just P2SH,

0 commit comments

Comments
 (0)