Bitcoin
|
#include <script/interpreter.h>
#include <uint256.h>
#include <boost/variant.hpp>
#include <stdint.h>
Go to the source code of this file.
Classes | |
class | CScriptID |
class | CNoDestination |
struct | PKHash |
struct | ScriptHash |
struct | WitnessV0ScriptHash |
struct | WitnessV0KeyHash |
struct | WitnessUnknown |
CTxDestination subtype to encode any future Witness version. More... | |
Typedefs | |
typedef boost::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown > | CTxDestination |
Enumerations | |
enum | txnouttype { TX_NONSTANDARD, TX_PUBKEY, TX_PUBKEYHASH, TX_SCRIPTHASH, TX_MULTISIG, TX_NULL_DATA, TX_WITNESS_V0_SCRIPTHASH, TX_WITNESS_V0_KEYHASH, TX_WITNESS_UNKNOWN } |
Functions | |
bool | IsValidDestination (const CTxDestination &dest) |
const char * | GetTxnOutputType (txnouttype t) |
txnouttype | Solver (const CScript &scriptPubKey, std::vector< std::vector< unsigned char >> &vSolutionsRet) |
bool | ExtractDestination (const CScript &scriptPubKey, CTxDestination &addressRet) |
bool | ExtractDestinations (const CScript &scriptPubKey, txnouttype &typeRet, std::vector< CTxDestination > &addressRet, int &nRequiredRet) |
CScript | GetScriptForDestination (const CTxDestination &dest) |
CScript | GetScriptForRawPubKey (const CPubKey &pubkey) |
CScript | GetScriptForMultisig (int nRequired, const std::vector< CPubKey > &keys) |
CScript | GetScriptForWitness (const CScript &redeemscript) |
Variables | |
static const bool | DEFAULT_ACCEPT_DATACARRIER = true |
static const unsigned int | MAX_OP_RETURN_RELAY = 83 |
bool | fAcceptDatacarrier |
unsigned | nMaxDatacarrierBytes |
static const unsigned int | MANDATORY_SCRIPT_VERIFY_FLAGS = SCRIPT_VERIFY_P2SH |
typedef boost::variant<CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown> CTxDestination |
A txout script template with a specific destination. It is either:
enum txnouttype |
bool ExtractDestination | ( | const CScript & | scriptPubKey, |
CTxDestination & | addressRet | ||
) |
Parse a standard scriptPubKey for the destination address. Assigns result to the addressRet parameter and returns true if successful. For multisig scripts, instead use ExtractDestinations. Currently only works for P2PK, P2PKH, P2SH, P2WPKH, and P2WSH scripts.
bool ExtractDestinations | ( | const CScript & | scriptPubKey, |
txnouttype & | typeRet, | ||
std::vector< CTxDestination > & | addressRet, | ||
int & | nRequiredRet | ||
) |
Parse a standard scriptPubKey with one or more destination addresses. For multisig scripts, this populates the addressRet vector with the pubkey IDs and nRequiredRet with the n required to spend. For other destinations, addressRet is populated with a single value and nRequiredRet is set to 1. Returns true if successful.
Note: this function confuses destinations (a subset of CScripts that are encodable as an address) with key identifiers (of keys involved in a CScript), and its use should be phased out.
CScript GetScriptForDestination | ( | const CTxDestination & | dest | ) |
Generate a Bitcoin scriptPubKey for the given CTxDestination. Returns a P2PKH script for a CKeyID destination, a P2SH script for a CScriptID, and an empty script for CNoDestination.
Generate a multisig script.
Generate a P2PK script for the given pubkey.
Generate a pay-to-witness script for the given redeem script. If the redeem script is P2PK or P2PKH, this returns a P2WPKH script, otherwise it returns a P2WSH script.
TODO: replace calls to GetScriptForWitness with GetScriptForDestination using the various witness-specific CTxDestination subtypes.
const char* GetTxnOutputType | ( | txnouttype | t | ) |
Get the name of a txnouttype as a C string, or nullptr if unknown.
bool IsValidDestination | ( | const CTxDestination & | dest | ) |
Check whether a CTxDestination is a CNoDestination.
txnouttype Solver | ( | const CScript & | scriptPubKey, |
std::vector< std::vector< unsigned char >> & | vSolutionsRet | ||
) |
Parse a scriptPubKey and identify script type for standard scripts. If successful, returns script type and parsed pubkeys or hashes, depending on the type. For example, for a P2SH script, vSolutionsRet will contain the script hash, for P2PKH it will contain the key hash, etc.
[in] | scriptPubKey | Script to parse |
[out] | vSolutionsRet | Vector of parsed pubkeys and hashes |
|
static |
bool fAcceptDatacarrier |
A data carrying output is an unspendable output containing data. The script type is designated as TX_NULL_DATA.
|
static |
Mandatory script verification flags that all new blocks must comply with for them to be valid. (but old blocks may not comply with) Currently just P2SH, but in the future other flags may be added, such as a soft-fork to enforce strict DER encoding.
Failing one of these tests may trigger a DoS ban - see CheckInputs() for details.
|
static |
Default setting for nMaxDatacarrierBytes. 80 bytes of data, +1 for OP_RETURN, +2 for the pushdata opcodes.
unsigned nMaxDatacarrierBytes |
Maximum size of TX_NULL_DATA scripts that this node considers standard.