Go to the source code of this file.
|
CAmount | GetDustThreshold (const CTxOut &txout, const CFeeRate &dustRelayFee) |
|
bool | IsDust (const CTxOut &txout, const CFeeRate &dustRelayFee) |
|
bool | IsStandard (const CScript &scriptPubKey, txnouttype &whichType) |
|
bool | IsStandardTx (const CTransaction &tx, bool permit_bare_multisig, const CFeeRate &dust_relay_fee, std::string &reason) |
|
bool | AreInputsStandard (const CTransaction &tx, const CCoinsViewCache &mapInputs) |
|
bool | IsWitnessStandard (const CTransaction &tx, const CCoinsViewCache &mapInputs) |
|
int64_t | GetVirtualTransactionSize (int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop) |
|
int64_t | GetVirtualTransactionSize (const CTransaction &tx, int64_t nSigOpCost, unsigned int bytes_per_sigop) |
|
int64_t | GetVirtualTransactionInputSize (const CTxIn &tx, int64_t nSigOpCost, unsigned int bytes_per_sigop) |
|
static int64_t | GetVirtualTransactionSize (const CTransaction &tx) |
|
static int64_t | GetVirtualTransactionInputSize (const CTxIn &tx) |
|
◆ AreInputsStandard()
Check for standard transaction types
- Parameters
-
[in] | mapInputs | Map of previous transactions that have outputs we're spending |
- Returns
- True if all inputs (scriptSigs) use only standard transaction forms
Check transaction inputs to mitigate two potential denial-of-service attacks:
- 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
◆ GetDustThreshold()
◆ GetVirtualTransactionInputSize() [1/2]
int64_t GetVirtualTransactionInputSize |
( |
const CTxIn & |
tx, |
|
|
int64_t |
nSigOpCost, |
|
|
unsigned int |
bytes_per_sigop |
|
) |
| |
◆ GetVirtualTransactionInputSize() [2/2]
static int64_t GetVirtualTransactionInputSize |
( |
const CTxIn & |
tx | ) |
|
|
inlinestatic |
◆ GetVirtualTransactionSize() [1/3]
Compute the virtual transaction size (weight reinterpreted as bytes).
◆ GetVirtualTransactionSize() [2/3]
◆ GetVirtualTransactionSize() [3/3]
◆ IsDust()
◆ IsStandard()
◆ IsStandardTx()
bool IsStandardTx |
( |
const CTransaction & |
tx, |
|
|
bool |
permit_bare_multisig, |
|
|
const CFeeRate & |
dust_relay_fee, |
|
|
std::string & |
reason |
|
) |
| |
Check for standard transaction types
- Returns
- True if all outputs (scriptPubKeys) use only standard transaction forms
◆ IsWitnessStandard()
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,
◆ DEFAULT_BLOCK_MAX_WEIGHT
Default for -blockmaxweight, which controls the range of block weights the mining code will create
◆ DEFAULT_BLOCK_MIN_TX_FEE
const unsigned int DEFAULT_BLOCK_MIN_TX_FEE = 1000 |
|
static |
Default for -blockmintxfee, which sets the minimum feerate for a transaction in blocks created by mining code
◆ DEFAULT_BYTES_PER_SIGOP
const unsigned int DEFAULT_BYTES_PER_SIGOP = 20 |
|
static |
Default for -bytespersigop
◆ DEFAULT_INCREMENTAL_RELAY_FEE
const unsigned int DEFAULT_INCREMENTAL_RELAY_FEE = 1000 |
|
static |
Default for -incrementalrelayfee, which sets the minimum feerate increase for mempool limiting or BIP 125 replacement
◆ DEFAULT_MAX_MEMPOOL_SIZE
const unsigned int DEFAULT_MAX_MEMPOOL_SIZE = 300 |
|
static |
Default for -maxmempool, maximum megabytes of mempool memory usage
◆ DEFAULT_PERMIT_BAREMULTISIG
const bool DEFAULT_PERMIT_BAREMULTISIG = true |
|
static |
Default for -permitbaremultisig
◆ DUST_RELAY_TX_FEE
const unsigned int DUST_RELAY_TX_FEE = 3000 |
|
static |
Min feerate for defining dust. Historically this has been based on the minRelayTxFee, however changing the dust limit changes which transactions are standard and should be done with care and ideally rarely. It makes sense to only increase the dust limit after prior releases were already not creating outputs below the new threshold
◆ MAX_P2SH_SIGOPS
const unsigned int MAX_P2SH_SIGOPS = 15 |
|
static |
Maximum number of signature check operations in an IsStandard() P2SH script
◆ MAX_STANDARD_P2WSH_SCRIPT_SIZE
const unsigned int MAX_STANDARD_P2WSH_SCRIPT_SIZE = 3600 |
|
static |
The maximum size of a standard witnessScript
◆ MAX_STANDARD_P2WSH_STACK_ITEM_SIZE
const unsigned int MAX_STANDARD_P2WSH_STACK_ITEM_SIZE = 80 |
|
static |
The maximum size of each witness stack item in a standard P2WSH script
◆ MAX_STANDARD_P2WSH_STACK_ITEMS
const unsigned int MAX_STANDARD_P2WSH_STACK_ITEMS = 100 |
|
static |
The maximum number of witness stack items in a standard P2WSH script
◆ MAX_STANDARD_TX_SIGOPS_COST
The maximum number of sigops we're willing to relay/mine in a single tx
◆ MAX_STANDARD_TX_WEIGHT
const unsigned int MAX_STANDARD_TX_WEIGHT = 400000 |
|
static |
The maximum weight for transactions we're willing to relay/mine
◆ MIN_STANDARD_TX_NONWITNESS_SIZE
const unsigned int MIN_STANDARD_TX_NONWITNESS_SIZE = 82 |
|
static |
The minimum non-witness size for transactions we're willing to relay/mine (1 segwit input + 1 P2WPKH output = 82 bytes)
◆ STANDARD_LOCKTIME_VERIFY_FLAGS
constexpr unsigned int STANDARD_LOCKTIME_VERIFY_FLAGS |
|
static |
Initial value:static constexpr unsigned int LOCKTIME_VERIFY_SEQUENCE
Definition: consensus.h:28
static constexpr unsigned int LOCKTIME_MEDIAN_TIME_PAST
Definition: consensus.h:30
Used as the flags parameter to sequence and nLocktime checks in non-consensus code.
◆ STANDARD_NOT_MANDATORY_VERIFY_FLAGS
For convenience, standard but not mandatory verify flags.
◆ STANDARD_SCRIPT_VERIFY_FLAGS
constexpr unsigned int STANDARD_SCRIPT_VERIFY_FLAGS |
|
static |
Initial value:Definition: interpreter.h:109
Definition: interpreter.h:97
Definition: interpreter.h:48
Definition: interpreter.h:55
Definition: interpreter.h:76
Definition: interpreter.h:45
Definition: interpreter.h:105
Definition: interpreter.h:101
Definition: interpreter.h:52
Definition: interpreter.h:93
Definition: interpreter.h:83
Definition: interpreter.h:113
Definition: interpreter.h:64
static const unsigned int MANDATORY_SCRIPT_VERIFY_FLAGS
Definition: standard.h:54
Definition: interpreter.h:117
Definition: interpreter.h:88
Standard script verification flags that standard transactions will comply with. However scripts violating these flags may still be present in valid blocks and we must accept those blocks.