Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#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 |
A reference to a CScript: the Hash160 of its serialization (see script.h) More... | |
class | CNoDestination |
Typedefs | |
typedef boost::variant< CNoDestination, CKeyID, CScriptID > | CTxDestination |
A txout script template with a specific destination. More... | |
Enumerations | |
enum | txnouttype { TX_NONSTANDARD, TX_PUBKEY, TX_PUBKEYHASH, TX_SCRIPTHASH, TX_MULTISIG, TX_NULL_DATA } |
Functions | |
bool | IsValidDestination (const CTxDestination &dest) |
Check whether a CTxDestination is a CNoDestination. More... | |
const char * | GetTxnOutputType (txnouttype t) |
Get the name of a txnouttype as a C string, or nullptr if unknown. More... | |
bool | Solver (const CScript &scriptPubKey, txnouttype &typeRet, std::vector< std::vector< unsigned char > > &vSolutionsRet) |
Parse a scriptPubKey and identify script type for standard scripts. More... | |
bool | ExtractDestination (const CScript &scriptPubKey, CTxDestination &addressRet) |
Parse a standard scriptPubKey for the destination address. More... | |
bool | ExtractDestinations (const CScript &scriptPubKey, txnouttype &typeRet, std::vector< CTxDestination > &addressRet, int &nRequiredRet) |
Parse a standard scriptPubKey with one or more destination addresses. More... | |
CScript | GetScriptForDestination (const CTxDestination &dest) |
Generate a Bitcoin scriptPubKey for the given CTxDestination. More... | |
CScript | GetScriptForRawPubKey (const CPubKey &pubkey) |
Generate a P2PK script for the given pubkey. More... | |
CScript | GetScriptForMultisig (int nRequired, const std::vector< CPubKey > &keys) |
Generate a multisig script. More... | |
Variables | |
static const bool | DEFAULT_ACCEPT_DATACARRIER = true |
static const unsigned int | MAX_OP_RETURN_RELAY = 83 |
Default setting for nMaxDatacarrierBytes. More... | |
bool | fAcceptDatacarrier |
A data carrying output is an unspendable output containing data. More... | |
unsigned | nMaxDatacarrierBytes |
Maximum size of TX_NULL_DATA scripts that this node considers standard. More... | |
static const unsigned int | MANDATORY_SCRIPT_VERIFY_FLAGS = SCRIPT_VERIFY_P2SH |
Mandatory script verification flags that all new blocks must comply with for them to be valid. More... | |
Typedef Documentation
◆ CTxDestination
typedef boost::variant<CNoDestination, CKeyID, CScriptID> CTxDestination |
A txout script template with a specific destination.
It is either:
- CNoDestination: no destination set
- CKeyID: TX_PUBKEYHASH destination
- CScriptID: TX_SCRIPTHASH destination A CTxDestination is the internal data type encoded in a bitcoin address
Definition at line 80 of file standard.h.
Enumeration Type Documentation
◆ txnouttype
enum txnouttype |
Enumerator | |
---|---|
TX_NONSTANDARD | |
TX_PUBKEY | |
TX_PUBKEYHASH | |
TX_SCRIPTHASH | |
TX_MULTISIG | |
TX_NULL_DATA | unspendable OP_RETURN script that carries data |
Definition at line 56 of file standard.h.
Function Documentation
◆ ExtractDestination()
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, and P2SH scripts.
Definition at line 158 of file standard.cpp.
References CPubKey::GetID(), CPubKey::IsValid(), Solver(), TX_PUBKEY, TX_PUBKEYHASH, and TX_SCRIPTHASH.
Referenced by CheckProRegTx(), CheckProUpRegTx(), CheckWalletOwnsScript(), TransactionRecord::decomposeTransaction(), ExtractDestinations(), CWallet::GetAccountName(), CWallet::GetAddressBalances(), CWallet::GetAddressGroupings(), CWalletTx::GetAmounts(), getblocktemplate(), CMasternodePayments::GetMasternodeTxOuts(), GetNextMasternodeForPayment(), CWallet::GetOutpointAndKeysFromOutput(), getreceivedbyaccount(), CSuperblockManager::GetRequiredPaymentsString(), GetRequiredPaymentsString(), CSuperblockManager::GetSuperblockPayments(), ImportScript(), CWallet::IsChange(), CMasternodePayments::IsTransactionValid(), CSuperblock::IsValid(), CWallet::ListCoins(), ListReceived(), listunspent(), CProRegTx::MakeSignString(), masternodelist(), ProcessImport(), PaymentServer::processPaymentRequest(), CWallet::SelectCoinsGroupedByAddresses(), TransactionDesc::toHTML(), CProRegTx::ToJson(), CDeterministicMNState::ToJson(), CProUpServTx::ToJson(), CProUpRegTx::ToJson(), CDeterministicMN::ToJson(), CProRegTx::ToString(), CDeterministicMNState::ToString(), CProUpServTx::ToString(), CProUpRegTx::ToString(), MasternodeList::updateDIP3List(), CoinControlDialog::updateLabels(), and CoinControlDialog::updateView().
◆ ExtractDestinations()
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.
Definition at line 188 of file standard.cpp.
References ExtractDestination(), CPubKey::GetID(), CPubKey::IsValid(), Solver(), TX_MULTISIG, TX_NONSTANDARD, and TX_NULL_DATA.
Referenced by CAffectedKeysVisitor::Process(), and ScriptPubKeyToUniv().
◆ GetScriptForDestination()
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.
Definition at line 256 of file standard.cpp.
Referenced by CWallet::AddHDPubKey(), CWallet::AddKeyPubKeyWithDB(), CGovernancePayment::CGovernancePayment(), CWallet::CreateCollateralTransaction(), createrawtransaction(), CWallet::CreateTransaction(), CTransactionBuilder::CTransactionBuilder(), CTransactionBuilderOutput::CTransactionBuilderOutput(), PaymentServer::fetchPaymentACK(), CWallet::GetAccountDestination(), getreceivedbyaddress(), CreateTransactionTestSetup::GetRecipients(), CKeyHolder::GetScriptForDestination(), ImportAddress(), CTransactionBuilder::IsDust(), GUIUtil::isDust(), IsMine(), MutateTxAddOutAddr(), MutateTxAddOutMultiSig(), MutateTxAddOutPubKey(), MutateTxAddOutScript(), WalletModel::prepareTransaction(), ProcessImport(), WalletModelTransaction::reassignAmounts(), sendmany(), SendMoney(), SetupDummyInputs(), and validateaddress().
◆ GetScriptForMultisig()
Generate a multisig script.
Definition at line 269 of file standard.cpp.
References CScript::EncodeOP_N(), OP_CHECKMULTISIG, and ToByteVector().
Referenced by CreateMultisigRedeemscript(), and MutateTxAddOutMultiSig().
◆ GetScriptForRawPubKey()
Generate a P2PK script for the given pubkey.
Definition at line 264 of file standard.cpp.
References CPubKey::begin(), CPubKey::end(), and OP_CHECKSIG.
Referenced by CWallet::AddHDPubKey(), CWallet::AddKeyPubKeyWithDB(), ListCoinsTestingSetup::AddTx(), BOOST_FIXTURE_TEST_CASE(), CreateTransactionTestSetup::CreateTransactionTestSetup(), CreateTransactionTestSetup::GetCoins(), importpubkey(), ListCoinsTestingSetup::ListCoinsTestingSetup(), MutateTxAddOutPubKey(), and ProcessImport().
◆ GetTxnOutputType()
const char* GetTxnOutputType | ( | txnouttype | t | ) |
Get the name of a txnouttype as a C string, or nullptr if unknown.
Definition at line 21 of file standard.cpp.
References TX_MULTISIG, TX_NONSTANDARD, TX_NULL_DATA, TX_PUBKEY, TX_PUBKEYHASH, and TX_SCRIPTHASH.
Referenced by ScriptPubKeyToUniv().
◆ IsValidDestination()
bool IsValidDestination | ( | const CTxDestination & | dest | ) |
Check whether a CTxDestination is a CNoDestination.
Definition at line 281 of file standard.cpp.
Referenced by AddrToPubKey(), SendCoinsDialog::coinControlChangeEdited(), createrawtransaction(), dumpprivkey(), fundrawtransaction(), getaccount(), getIndexKey(), GetNextMasternodeForPayment(), getreceivedbyaddress(), ImportAddress(), importaddress(), listunspent(), MaybePushAddress(), MutateTxAddOutAddr(), SignVerifyMessageDialog::on_signMessageButton_SM_clicked(), SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked(), CSuperblock::ParsePaymentSchedule(), ParsePrivKey(), ProcessImport(), sendfrom(), sendmany(), sendtoaddress(), setaccount(), signmessage(), TransactionDesc::toHTML(), validateaddress(), CProposalValidator::ValidatePaymentAddress(), and verifymessage().
◆ Solver()
bool Solver | ( | const CScript & | scriptPubKey, |
txnouttype & | typeRet, | ||
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.
- Parameters
-
[in] scriptPubKey Script to parse [out] typeRet The script type [out] vSolutionsRet Vector of parsed pubkeys and hashes
- Returns
- True if script matches standard template
Definition at line 35 of file standard.cpp.
References prevector< N, T, Size, Diff >::begin(), CScript::clear(), CScript::DecodeOP_N(), prevector< N, T, Size, Diff >::end(), CScript::GetOp(), CScript::IsPayToScriptHash(), CScript::IsPushOnly(), OP_0, OP_1, OP_16, OP_CHECKMULTISIG, OP_CHECKSIG, OP_DUP, OP_EQUALVERIFY, OP_HASH160, OP_PUBKEY, OP_PUBKEYHASH, OP_PUBKEYS, OP_RETURN, OP_SMALLINTEGER, prevector< N, T, Size, Diff >::size(), TX_MULTISIG, TX_NONSTANDARD, TX_NULL_DATA, TX_PUBKEY, TX_PUBKEYHASH, and TX_SCRIPTHASH.
Referenced by AreInputsStandard(), CombineSignatures(), ExtractDestination(), ExtractDestinations(), IsMine(), CBloomFilter::IsRelevantAndUpdate(), IsStandard(), and SignStep().
Variable Documentation
◆ DEFAULT_ACCEPT_DATACARRIER
|
static |
Definition at line 16 of file standard.h.
Referenced by AppInitParameterInteraction(), and HelpMessage().
◆ fAcceptDatacarrier
bool fAcceptDatacarrier |
A data carrying output is an unspendable output containing data.
The script type is designated as TX_NULL_DATA.
Definition at line 16 of file standard.cpp.
Referenced by AppInitParameterInteraction(), and IsStandard().
◆ MANDATORY_SCRIPT_VERIFY_FLAGS
|
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.
Definition at line 54 of file standard.h.
◆ MAX_OP_RETURN_RELAY
|
static |
Default setting for nMaxDatacarrierBytes.
80 bytes of data, +1 for OP_RETURN, +2 for the pushdata opcodes.
Definition at line 34 of file standard.h.
Referenced by HelpMessage().
◆ nMaxDatacarrierBytes
unsigned nMaxDatacarrierBytes |
Maximum size of TX_NULL_DATA scripts that this node considers standard.
Definition at line 17 of file standard.cpp.
Referenced by AppInitParameterInteraction(), and IsStandard().