diff options
author | MacroFake <falke.marco@gmail.com> | 2022-07-21 17:55:49 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-08-02 15:28:10 +0200 |
commit | fa2a6b8516b24d7e9ca11926a49cf2b07f661e81 (patch) | |
tree | 1e7f675e3e66591bf4fe200b4eeb787afbab1ed4 /src/script | |
parent | fa477d32eefcc3dd2f06b452066290d9936d8c5d (diff) | |
download | bitcoin-fa2a6b8516b24d7e9ca11926a49cf2b07f661e81.tar.xz |
Combine datacarrier globals into one
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/standard.cpp | 3 | ||||
-rw-r--r-- | src/script/standard.h | 11 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/script/standard.cpp b/src/script/standard.cpp index b3f6a1b669..47e9e89c94 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -16,8 +16,7 @@ typedef std::vector<unsigned char> valtype; -bool fAcceptDatacarrier = DEFAULT_ACCEPT_DATACARRIER; -unsigned nMaxDatacarrierBytes = MAX_OP_RETURN_RELAY; +std::optional<unsigned> g_max_datacarrier_bytes{DEFAULT_ACCEPT_DATACARRIER ? std::optional{MAX_OP_RETURN_RELAY} : std::nullopt}; CScriptID::CScriptID(const CScript& in) : BaseHash(Hash160(in)) {} CScriptID::CScriptID(const ScriptHash& in) : BaseHash(static_cast<uint160>(in)) {} diff --git a/src/script/standard.h b/src/script/standard.h index 448fdff010..c1c4cf4a39 100644 --- a/src/script/standard.h +++ b/src/script/standard.h @@ -13,6 +13,7 @@ #include <util/hash_type.h> #include <map> +#include <optional> #include <string> #include <variant> @@ -33,7 +34,7 @@ public: }; /** - * Default setting for nMaxDatacarrierBytes. 80 bytes of data, +1 for OP_RETURN, + * Default setting for -datacarriersize. 80 bytes of data, +1 for OP_RETURN, * +2 for the pushdata opcodes. */ static const unsigned int MAX_OP_RETURN_RELAY = 83; @@ -41,11 +42,11 @@ static const unsigned int MAX_OP_RETURN_RELAY = 83; /** * A data carrying output is an unspendable output containing data. The script * type is designated as TxoutType::NULL_DATA. + * + * Maximum size of TxoutType::NULL_DATA scripts that this node considers standard. + * If nullopt, any size is nonstandard. */ -extern bool fAcceptDatacarrier; - -/** Maximum size of TxoutType::NULL_DATA scripts that this node considers standard. */ -extern unsigned nMaxDatacarrierBytes; +extern std::optional<unsigned> g_max_datacarrier_bytes; /** * Mandatory script verification flags that all new blocks must comply with for |