Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#include <consensus/consensus.h>
#include <policy/feerate.h>
#include <script/interpreter.h>
#include <script/standard.h>
#include <string>
Go to the source code of this file.
Functions | |
CAmount | GetDustThreshold (const CTxOut &txout, const CFeeRate &dustRelayFee) |
bool | IsDust (const CTxOut &txout, const CFeeRate &dustRelayFee) |
bool | IsStandard (const CScript &scriptPubKey, txnouttype &whichType) |
bool | IsStandardTx (const CTransaction &tx, std::string &reason) |
Check for standard transaction types. More... | |
bool | AreInputsStandard (const CTransaction &tx, const CCoinsViewCache &mapInputs) |
Check for standard transaction types. More... | |
Variables | |
static const unsigned int | DEFAULT_BLOCK_MAX_SIZE = 2000000 |
Default for -blockmaxsize, which controls the maximum size of block the mining code will create. More... | |
static const unsigned int | DEFAULT_BLOCK_MIN_TX_FEE = 1000 |
Default for -blockmintxfee, which sets the minimum feerate for a transaction in blocks created by mining code. More... | |
static const unsigned int | MAX_STANDARD_TX_SIZE = 100000 |
The maximum size for transactions we're willing to relay/mine. More... | |
static const unsigned int | MAX_P2SH_SIGOPS = 15 |
Maximum number of signature check operations in an IsStandard() P2SH script. More... | |
static const unsigned int | MAX_STANDARD_TX_SIGOPS = 4000 |
The maximum number of sigops we're willing to relay/mine in a single tx. More... | |
static const unsigned int | DEFAULT_MAX_MEMPOOL_SIZE = 300 |
Default for -maxmempool, maximum megabytes of mempool memory usage. More... | |
static const unsigned int | DEFAULT_INCREMENTAL_RELAY_FEE = 1000 |
Default for -incrementalrelayfee, which sets the minimum feerate increase for mempool limiting or BIP 125 replacement. More... | |
static const unsigned int | DUST_RELAY_TX_FEE = 3000 |
Min feerate for defining dust. More... | |
static const unsigned int | STANDARD_SCRIPT_VERIFY_FLAGS |
Standard script verification flags that standard transactions will comply with. More... | |
static const unsigned int | STANDARD_NOT_MANDATORY_VERIFY_FLAGS = STANDARD_SCRIPT_VERIFY_FLAGS & ~MANDATORY_SCRIPT_VERIFY_FLAGS |
For convenience, standard but not mandatory verify flags. More... | |
static const unsigned int | STANDARD_LOCKTIME_VERIFY_FLAGS |
Used as the flags parameter to sequence and nLocktime checks in non-consensus code. More... | |
CFeeRate | incrementalRelayFee |
CFeeRate | dustRelayFee |
Function Documentation
◆ AreInputsStandard()
bool AreInputsStandard | ( | const CTransaction & | tx, |
const CCoinsViewCache & | mapInputs | ||
) |
Check for standard transaction types.
- Parameters
-
[in] mapInputs Map of previous transactions that have outputs we're spending
- Returns
- True if all inputs (scriptSigs) use only standard transaction forms
Check for standard transaction types.
- scriptSigs with extra data stuffed into them, not consumed by scriptPubKey (or P2SH script)
- P2SH scripts with a crazy number of expensive CHECKSIG/CHECKMULTISIG operations
Why bother? To avoid denial-of-service attacks; an attacker can submit a standard HASH... OP_EQUAL transaction, which will get accepted into blocks. The redemption script can be anything; an attacker could use a very expensive-to-check-upon-redemption script like: DUP CHECKSIG DROP ... repeated 100 times... OP_1
Definition at line 142 of file policy.cpp.
References CCoinsViewCache::AccessCoin(), EvalScript(), CTransaction::IsCoinBase(), MAX_P2SH_SIGOPS, Coin::out, SCRIPT_VERIFY_NONE, CTxOut::scriptPubKey, SIGVERSION_BASE, Solver(), TX_SCRIPTHASH, and CTransaction::vin.
Referenced by AcceptToMemoryPoolWorker(), and CCoinsCaching().
◆ GetDustThreshold()
Definition at line 17 of file policy.cpp.
References CFeeRate::GetFee(), GetSerializeSize(), CScript::IsUnspendable(), CTxOut::scriptPubKey, and SER_DISK.
Referenced by IsDust().
◆ IsDust()
Definition at line 35 of file policy.cpp.
References GetDustThreshold(), and CTxOut::nValue.
Referenced by CWallet::CreateTransaction(), CTransactionBuilder::IsDust(), GUIUtil::isDust(), IsStandardTx(), PaymentServer::processPaymentRequest(), and CoinControlDialog::updateLabels().
◆ IsStandard()
bool IsStandard | ( | const CScript & | scriptPubKey, |
txnouttype & | whichType | ||
) |
Definition at line 40 of file policy.cpp.
References fAcceptDatacarrier, nMaxDatacarrierBytes, prevector< N, T, Size, Diff >::size(), Solver(), TX_MULTISIG, TX_NONSTANDARD, and TX_NULL_DATA.
Referenced by IsStandardTx().
◆ IsStandardTx()
bool IsStandardTx | ( | const CTransaction & | tx, |
std::string & | reason | ||
) |
Check for standard transaction types.
- Returns
- True if all outputs (scriptPubKeys) use only standard transaction forms
Definition at line 62 of file policy.cpp.
References CTransaction::CURRENT_VERSION, dustRelayFee, fIsBareMultisigStd, GetSerializeSize(), IsDust(), CScript::IsPushOnly(), IsStandard(), MAX_STANDARD_TX_SIZE, CTransaction::MAX_STANDARD_VERSION, CTransaction::nVersion, FeeCalculation::reason, CTxOut::scriptPubKey, CTxIn::scriptSig, SER_NETWORK, prevector< N, T, Size, Diff >::size(), TX_MULTISIG, TX_NULL_DATA, CTransaction::vin, and CTransaction::vout.
Referenced by AcceptToMemoryPoolWorker().
Variable Documentation
◆ DEFAULT_BLOCK_MAX_SIZE
|
static |
Default for -blockmaxsize, which controls the maximum size of block the mining code will create.
Definition at line 20 of file policy.h.
Referenced by DefaultOptions(), HelpMessage(), and BlockAssembler::Options::Options().
◆ DEFAULT_BLOCK_MIN_TX_FEE
|
static |
Default for -blockmintxfee, which sets the minimum feerate for a transaction in blocks created by mining code.
Definition at line 22 of file policy.h.
Referenced by DefaultOptions(), HelpMessage(), and BlockAssembler::Options::Options().
◆ DEFAULT_INCREMENTAL_RELAY_FEE
|
static |
Default for -incrementalrelayfee, which sets the minimum feerate increase for mempool limiting or BIP 125 replacement.
Definition at line 32 of file policy.h.
Referenced by HelpMessage().
◆ DEFAULT_MAX_MEMPOOL_SIZE
|
static |
Default for -maxmempool, maximum megabytes of mempool memory usage.
Definition at line 30 of file policy.h.
Referenced by AcceptToMemoryPoolWorker(), AppInitMain(), AppInitParameterInteraction(), FlushStateToDisk(), GetMinimumFee(), HelpMessage(), mempoolInfoToJSON(), and UpdateMempoolForReorg().
◆ DUST_RELAY_TX_FEE
|
static |
Min feerate for defining dust.
Historically this has been based on the minRelayTxFee, however changing the dust limit changes which transactions are standard and should be done with care and ideally rarely. It makes sense to only increase the dust limit after prior releases were already not creating outputs below the new threshold
Definition at line 38 of file policy.h.
Referenced by HelpMessage().
◆ dustRelayFee
CFeeRate dustRelayFee |
Definition at line 177 of file policy.cpp.
Referenced by AppInitParameterInteraction(), CWallet::CreateTransaction(), GetDiscardRate(), GUIUtil::isDust(), IsStandardTx(), PaymentServer::processPaymentRequest(), and CoinControlDialog::updateLabels().
◆ incrementalRelayFee
CFeeRate incrementalRelayFee |
Definition at line 176 of file policy.cpp.
Referenced by AppInitParameterInteraction(), CTxMemPool::GetMinFee(), getnetworkinfo(), and CTxMemPool::TrimToSize().
◆ MAX_P2SH_SIGOPS
|
static |
Maximum number of signature check operations in an IsStandard() P2SH script.
Definition at line 26 of file policy.h.
Referenced by AreInputsStandard().
◆ MAX_STANDARD_TX_SIGOPS
|
static |
The maximum number of sigops we're willing to relay/mine in a single tx.
Definition at line 28 of file policy.h.
Referenced by AcceptToMemoryPoolWorker().
◆ MAX_STANDARD_TX_SIZE
|
static |
The maximum size for transactions we're willing to relay/mine.
Definition at line 24 of file policy.h.
Referenced by AddOrphanTx(), ContextualCheckTransaction(), CWallet::CreateTransaction(), and IsStandardTx().
◆ STANDARD_LOCKTIME_VERIFY_FLAGS
|
static |
Used as the flags parameter to sequence and nLocktime checks in non-consensus code.
Definition at line 60 of file policy.h.
Referenced by AcceptToMemoryPoolWorker(), BlockAssembler::CreateNewBlock(), and UpdateMempoolForReorg().
◆ STANDARD_NOT_MANDATORY_VERIFY_FLAGS
|
static |
For convenience, standard but not mandatory verify flags.
Definition at line 57 of file policy.h.
Referenced by CheckInputs().
◆ STANDARD_SCRIPT_VERIFY_FLAGS
|
static |
Standard script verification flags that standard transactions will comply with.
However scripts violating these flags may still be present in valid blocks and we must accept those blocks.
Definition at line 44 of file policy.h.
Referenced by AcceptToMemoryPoolWorker(), MutateTxSign(), ProduceSignature(), and signrawtransaction().