Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

policy.cpp File Reference
#include <policy/policy.h>
#include <validation.h>
#include <coins.h>
#include <tinyformat.h>
#include <util.h>
#include <utilstrencodings.h>
+ Include dependency graph for policy.cpp:

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.

  1. scriptSigs with extra data stuffed into them, not consumed by scriptPubKey (or P2SH script)
  2. 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()

CAmount GetDustThreshold ( const CTxOut txout,
const CFeeRate dustRelayFeeIn 
)

Definition at line 17 of file policy.cpp.

References CFeeRate::GetFee(), GetSerializeSize(), CScript::IsUnspendable(), CTxOut::scriptPubKey, and SER_DISK.

Referenced by IsDust().

◆ IsDust()

◆ IsStandard()

bool IsStandard ( const CScript scriptPubKey,
txnouttype whichType 
)

◆ IsStandardTx()

bool IsStandardTx ( const CTransaction tx,
std::string &  reason 
)

Variable Documentation

◆ dustRelayFee

◆ incrementalRelayFee

Released under the MIT license