Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#include <policy/policy.h>
#include <validation.h>
#include <coins.h>
#include <tinyformat.h>
#include <util.h>
#include <utilstrencodings.h>
Go to the source code of this file.
Functions | |
CAmount | GetDustThreshold (const CTxOut &txout, const CFeeRate &dustRelayFeeIn) |
bool | IsDust (const CTxOut &txout, const CFeeRate &dustRelayFeeIn) |
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 transaction inputs to mitigate two potential denial-of-service attacks: More... | |
Variables | |
CFeeRate | incrementalRelayFee = CFeeRate(DEFAULT_INCREMENTAL_RELAY_FEE) |
CFeeRate | dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE) |
Function Documentation
◆ AreInputsStandard()
bool AreInputsStandard | ( | const CTransaction & | tx, |
const CCoinsViewCache & | mapInputs | ||
) |
Check transaction inputs to mitigate two potential denial-of-service attacks:
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
◆ dustRelayFee
CFeeRate dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE) |
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 = CFeeRate(DEFAULT_INCREMENTAL_RELAY_FEE) |
Definition at line 176 of file policy.cpp.
Referenced by AppInitParameterInteraction(), CTxMemPool::GetMinFee(), getnetworkinfo(), and CTxMemPool::TrimToSize().