diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -1604,8 +1604,6 @@ gArgs.GetBoolArg("-permitbaremultisig", DEFAULT_PERMIT_BAREMULTISIG); fAcceptDatacarrier = gArgs.GetBoolArg("-datacarrier", DEFAULT_ACCEPT_DATACARRIER); - nMaxDatacarrierBytes = - gArgs.GetArg("-datacarriersize", nMaxDatacarrierBytes); // Option to startup with mocktime set (used for regression testing): SetMockTime(gArgs.GetArg("-mocktime", 0)); // SetMockTime(0) is a no-op diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -37,10 +37,17 @@ // Support up to x-of-3 multisig txns as standard if (n < 1 || n > 3) return false; if (m < 1 || m > n) return false; - } else if (whichType == TX_NULL_DATA && - (!fAcceptDatacarrier || - scriptPubKey.size() > nMaxDatacarrierBytes)) - return false; + } else if (whichType == TX_NULL_DATA) { + if (!fAcceptDatacarrier) { + return false; + } + + unsigned nMaxDatacarrierBytes = + gArgs.GetArg("-datacarriersize", MAX_OP_RETURN_RELAY); + if (scriptPubKey.size() > nMaxDatacarrierBytes) { + return false; + } + } return whichType != TX_NONSTANDARD; } diff --git a/src/script/standard.h b/src/script/standard.h --- a/src/script/standard.h +++ b/src/script/standard.h @@ -29,7 +29,6 @@ //!< bytes (+1 for OP_RETURN, +2 for the pushdata opcodes) static const unsigned int MAX_OP_RETURN_RELAY = 83; extern bool fAcceptDatacarrier; -extern unsigned nMaxDatacarrierBytes; /** * Mandatory script verification flags that all new blocks must comply with for diff --git a/src/script/standard.cpp b/src/script/standard.cpp --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -13,7 +13,6 @@ typedef std::vector valtype; bool fAcceptDatacarrier = DEFAULT_ACCEPT_DATACARRIER; -unsigned nMaxDatacarrierBytes = MAX_OP_RETURN_RELAY; CScriptID::CScriptID(const CScript &in) : uint160(Hash160(in.begin(), in.end())) {}