Dash Core  0.12.2.1
P2P Digital Currency
policy.cpp File Reference
#include "policy/policy.h"
#include "validation.h"
#include "tinyformat.h"
#include "util.h"
#include "utilstrencodings.h"
#include <boost/foreach.hpp>

Go to the source code of this file.

Functions

bool IsStandard (const CScript &scriptPubKey, txnouttype &whichType)
 
bool IsStandardTx (const CTransaction &tx, std::string &reason)
 
bool AreInputsStandard (const CTransaction &tx, const CCoinsViewCache &mapInputs)
 

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

Referenced by AcceptToMemoryPoolWorker().

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

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

Referenced by AcceptToMemoryPoolWorker().