6 #ifndef BITCOIN_SCRIPT_STANDARD_H 7 #define BITCOIN_SCRIPT_STANDARD_H 21 template<
typename HashType>
29 explicit BaseHash(
const HashType& in) : m_hash(in) {}
33 return m_hash.begin();
36 const unsigned char*
begin()
const 38 return m_hash.begin();
46 const unsigned char*
end()
const 51 operator std::vector<unsigned char>()
const 53 return std::vector<unsigned char>{m_hash.begin(), m_hash.end()};
58 return m_hash.ToString();
63 return m_hash == other.m_hash;
68 return !(m_hash == other.m_hash);
71 bool operator<(const BaseHash<HashType>& other)
const noexcept
73 return m_hash < other.m_hash;
81 unsigned char*
data() {
return m_hash.data(); }
82 const unsigned char*
data()
const {
return m_hash.data(); }
184 unsigned char program[40];
212 using CTxDestination = std::variant<CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown>;
266 #endif // BITCOIN_SCRIPT_STANDARD_H
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
bool ExtractDestinations(const CScript &scriptPubKey, TxoutType &typeRet, std::vector< CTxDestination > &addressRet, int &nRequiredRet)
Parse a standard scriptPubKey with one or more destination addresses.
const unsigned char * data() const
WitnessV0KeyHash(const uint160 &hash)
CScript GetScriptForRawPubKey(const CPubKey &pubkey)
Generate a P2PK script for the given pubkey.
unsigned char program[40]
static const unsigned int MAX_OP_RETURN_RELAY
Default setting for nMaxDatacarrierBytes.
static const bool DEFAULT_ACCEPT_DATACARRIER
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
friend bool operator==(const CNoDestination &a, const CNoDestination &b)
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
const unsigned char * begin() const
unspendable OP_RETURN script that carries data
CKeyID ToKeyID(const PKHash &key_hash)
std::string GetTxnOutputType(TxoutType t)
Get the name of a TxoutType as a string.
const unsigned char * end() const
friend bool operator<(const CNoDestination &a, const CNoDestination &b)
CTxDestination subtype to encode any future Witness version.
An encapsulated public key.
bool operator!=(const BaseHash< HashType > &other) const noexcept
PKHash(const uint160 &hash)
CScript GetScriptForMultisig(int nRequired, const std::vector< CPubKey > &keys)
Generate a multisig script.
bool fAcceptDatacarrier
A data carrying output is an unspendable output containing data.
CScriptID(const uint160 &in)
WitnessV0ScriptHash(const uint256 &hash)
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
friend bool operator==(const WitnessUnknown &w1, const WitnessUnknown &w2)
Serialized script, used inside transaction inputs and outputs.
std::string ToString() const
A reference to a CKey: the Hash160 of its serialized public key.
Only for Witness versions not already defined above.
friend bool operator<(const WitnessUnknown &w1, const WitnessUnknown &w2)
A reference to a CScript: the Hash160 of its serialization (see script.h)
TxoutType Solver(const CScript &scriptPubKey, std::vector< std::vector< unsigned char >> &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
BaseHash(const HashType &in)
unsigned nMaxDatacarrierBytes
Maximum size of TxoutType::NULL_DATA scripts that this node considers standard.
bool operator==(const BaseHash< HashType > &other) const noexcept
static const unsigned int MANDATORY_SCRIPT_VERIFY_FLAGS
Mandatory script verification flags that all new blocks must comply with for them to be valid...
ScriptHash(const uint160 &hash)