Fabcoin Core  0.16.2
P2P Digital Currency
Functions | Variables
policy.h File Reference
#include <consensus/consensus.h>
#include <policy/feerate.h>
#include <script/interpreter.h>
#include <script/standard.h>
#include <string>
Include dependency graph for policy.h:
This graph shows which files directly or indirectly include this file:

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, const bool witnessEnabled=false)
 Check transaction inputs to mitigate two potential denial-of-service attacks: More...
 
bool IsStandardTx (const CTransaction &tx, std::string &reason, const bool witnessEnabled=false)
 Check for standard transaction types. More...
 
bool AreInputsStandard (const CTransaction &tx, const CCoinsViewCache &mapInputs)
 Check for standard transaction types. More...
 
bool IsWitnessStandard (const CTransaction &tx, const CCoinsViewCache &mapInputs)
 Check if the transaction is over standard P2WSH resources limit: 3600bytes witnessScript size, 80bytes per witness stack element, 100 witness stack elements These limits are adequate for multi-signature up to n-of-100 using OP_CHECKSIG, OP_ADD, and OP_EQUAL,. More...
 
int64_t GetVirtualTransactionSize (int64_t nWeight, int64_t nSigOpCost)
 Compute the virtual transaction size (weight reinterpreted as bytes). More...
 
int64_t GetVirtualTransactionSize (const CTransaction &tx, int64_t nSigOpCost=0)
 

Variables

unsigned int dgpMaxTxSigOps
 The maximum number of sigops we're willing to relay/mine in a single tx. More...
 
CFeeRate incrementalRelayFee
 
CFeeRate dustRelayFee
 
unsigned int nBytesPerSigOp
 

Function Documentation

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

Here is the call graph for this function:

Here is the caller graph for this function:

CAmount GetDustThreshold ( const CTxOut txout,
const CFeeRate dustRelayFee 
)

Definition at line 18 of file policy.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int64_t GetVirtualTransactionSize ( int64_t  nWeight,
int64_t  nSigOpCost 
)

Compute the virtual transaction size (weight reinterpreted as bytes).

Definition at line 254 of file policy.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int64_t GetVirtualTransactionSize ( const CTransaction tx,
int64_t  nSigOpCost = 0 
)

Definition at line 259 of file policy.cpp.

Here is the call graph for this function:

bool IsDust ( const CTxOut txout,
const CFeeRate dustRelayFee 
)

Definition at line 52 of file policy.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool IsStandard ( const CScript scriptPubKey,
txnouttype whichType,
const bool  witnessEnabled 
)

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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:

Here is the caller graph for this function:

bool IsWitnessStandard ( const CTransaction tx,
const CCoinsViewCache mapInputs 
)

Check if the transaction is over standard P2WSH resources limit: 3600bytes witnessScript size, 80bytes per witness stack element, 100 witness stack elements These limits are adequate for multi-signature up to n-of-100 using OP_CHECKSIG, OP_ADD, and OP_EQUAL,.

Definition at line 198 of file policy.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

unsigned int dgpMaxTxSigOps

The maximum number of sigops we're willing to relay/mine in a single tx.

Definition at line 19 of file consensus.cpp.

CFeeRate dustRelayFee

Definition at line 251 of file policy.cpp.

CFeeRate incrementalRelayFee

Definition at line 250 of file policy.cpp.

unsigned int nBytesPerSigOp

Definition at line 252 of file policy.cpp.