PIVX Core  5.6.99
P2P Digital Currency
Functions | Variables
policy.cpp File Reference
#include "policy/policy.h"
#include "consensus/tx_verify.h"
#include "tinyformat.h"
#include "util/system.h"
#include "utilstrencodings.h"
#include "validation.h"
Include dependency graph for policy.cpp:

Go to the source code of this file.

Functions

CAmount GetDustThreshold (const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
 
CAmount GetDustThreshold (const CFeeRate &dustRelayFeeIn)
 
bool IsDust (const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
 
CAmount GetShieldedDustThreshold (const CFeeRate &dustRelayFeeIn)
 
bool IsStandard (const CScript &scriptPubKey, txnouttype &whichType)
 Check transaction inputs to mitigate two potential denial-of-service attacks: More...
 
bool IsStandardTx (const CTransactionRef &tx, int nBlockHeight, std::string &reason)
 Check for standard transaction types. More...
 
bool AreInputsStandard (const CTransaction &tx, const CCoinsViewCache &mapInputs)
 Check for standard transaction types. More...
 

Variables

bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG
 
CFeeRate dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE)
 

Function Documentation

◆ AreInputsStandard()

bool AreInputsStandard ( const CTransaction tx,
const CCoinsViewCache mapInputs 
)

Check for standard transaction types.

Parameters
[in]mapInputsMap of previous transactions that have outputs we're spending
Returns
True if all inputs (scriptSigs) use only standard transaction forms

Definition at line 191 of file policy.cpp.

Here is the call graph for this function:

◆ GetDustThreshold() [1/2]

CAmount GetDustThreshold ( const CFeeRate dustRelayFeeIn)

Definition at line 39 of file policy.cpp.

Here is the call graph for this function:

◆ GetDustThreshold() [2/2]

CAmount GetDustThreshold ( const CTxOut txout,
const CFeeRate dustRelayFeeIn 
)

Definition at line 21 of file policy.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetShieldedDustThreshold()

CAmount GetShieldedDustThreshold ( const CFeeRate dustRelayFeeIn)

Definition at line 50 of file policy.cpp.

Here is the caller graph for this function:

◆ IsDust()

bool IsDust ( const CTxOut txout,
const CFeeRate dustRelayFeeIn 
)

Definition at line 45 of file policy.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsStandard()

bool IsStandard ( const CScript scriptPubKey,
txnouttype whichType 
)

Check transaction inputs to mitigate two potential denial-of-service attacks:

  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

Check transaction inputs, and make sure any pay-to-script-hash transactions are evaluating IsStandard scripts

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 78 of file policy.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsStandardTx()

bool IsStandardTx ( const CTransactionRef tx,
int  nBlockHeight,
std::string &  reason 
)

Check for standard transaction types.

Returns
True if all outputs (scriptPubKeys) use only standard transaction forms

Definition at line 100 of file policy.cpp.

Here is the call graph for this function:

Variable Documentation

◆ dustRelayFee

CFeeRate dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE)

Definition at line 19 of file policy.cpp.

◆ fIsBareMultisigStd

bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG

Definition at line 17 of file policy.cpp.