mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
Combine datacarrier globals into one
This commit is contained in:
parent
fa477d32ee
commit
fa2a6b8516
4 changed files with 16 additions and 12 deletions
|
@ -975,8 +975,11 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb
|
||||||
|
|
||||||
if (!g_wallet_init_interface.ParameterInteraction()) return false;
|
if (!g_wallet_init_interface.ParameterInteraction()) return false;
|
||||||
|
|
||||||
fAcceptDatacarrier = args.GetBoolArg("-datacarrier", DEFAULT_ACCEPT_DATACARRIER);
|
if (args.GetBoolArg("-datacarrier", DEFAULT_ACCEPT_DATACARRIER)) {
|
||||||
nMaxDatacarrierBytes = args.GetIntArg("-datacarriersize", nMaxDatacarrierBytes);
|
g_max_datacarrier_bytes = args.GetIntArg("-datacarriersize", MAX_OP_RETURN_RELAY);
|
||||||
|
} else {
|
||||||
|
g_max_datacarrier_bytes = std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
// Option to startup with mocktime set (used for regression testing):
|
// Option to startup with mocktime set (used for regression testing):
|
||||||
SetMockTime(args.GetIntArg("-mocktime", 0)); // SetMockTime(0) is a no-op
|
SetMockTime(args.GetIntArg("-mocktime", 0)); // SetMockTime(0) is a no-op
|
||||||
|
|
|
@ -82,9 +82,10 @@ bool IsStandard(const CScript& scriptPubKey, TxoutType& whichType)
|
||||||
return false;
|
return false;
|
||||||
if (m < 1 || m > n)
|
if (m < 1 || m > n)
|
||||||
return false;
|
return false;
|
||||||
} else if (whichType == TxoutType::NULL_DATA &&
|
} else if (whichType == TxoutType::NULL_DATA) {
|
||||||
(!fAcceptDatacarrier || scriptPubKey.size() > nMaxDatacarrierBytes)) {
|
if (!g_max_datacarrier_bytes || scriptPubKey.size() > *g_max_datacarrier_bytes) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
|
|
||||||
typedef std::vector<unsigned char> valtype;
|
typedef std::vector<unsigned char> valtype;
|
||||||
|
|
||||||
bool fAcceptDatacarrier = DEFAULT_ACCEPT_DATACARRIER;
|
std::optional<unsigned> g_max_datacarrier_bytes{DEFAULT_ACCEPT_DATACARRIER ? std::optional{MAX_OP_RETURN_RELAY} : std::nullopt};
|
||||||
unsigned nMaxDatacarrierBytes = MAX_OP_RETURN_RELAY;
|
|
||||||
|
|
||||||
CScriptID::CScriptID(const CScript& in) : BaseHash(Hash160(in)) {}
|
CScriptID::CScriptID(const CScript& in) : BaseHash(Hash160(in)) {}
|
||||||
CScriptID::CScriptID(const ScriptHash& in) : BaseHash(static_cast<uint160>(in)) {}
|
CScriptID::CScriptID(const ScriptHash& in) : BaseHash(static_cast<uint160>(in)) {}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <util/hash_type.h>
|
#include <util/hash_type.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <variant>
|
#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.
|
* +2 for the pushdata opcodes.
|
||||||
*/
|
*/
|
||||||
static const unsigned int MAX_OP_RETURN_RELAY = 83;
|
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
|
* A data carrying output is an unspendable output containing data. The script
|
||||||
* type is designated as TxoutType::NULL_DATA.
|
* 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;
|
extern std::optional<unsigned> g_max_datacarrier_bytes;
|
||||||
|
|
||||||
/** Maximum size of TxoutType::NULL_DATA scripts that this node considers standard. */
|
|
||||||
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
|
||||||
|
|
Loading…
Add table
Reference in a new issue