#include <consensus/consensus.h>
#include <feerate.h>
#include <script/standard.h>
#include <string>
Go to the source code of this file.
|
static constexpr Amount | DEFAULT_BLOCK_MIN_TX_FEE_PER_KB (1000 *SATOSHI) |
| Default for -blockmintxfee, which sets the minimum feerate for a transaction in blocks created by mining code. More...
|
|
static constexpr CFeeRate | MEMPOOL_FULL_FEE_INCREMENT (1000 *SATOSHI) |
| Default for -incrementalrelayfee, which sets the minimum feerate increase for mempool limiting or BIP 125 replacement. More...
|
|
static constexpr Amount | DUST_RELAY_TX_FEE (1000 *SATOSHI) |
| Min feerate for defining dust. More...
|
|
static constexpr Amount | DEFAULT_MIN_RELAY_TX_FEE_PER_KB (1000 *SATOSHI) |
| Default for -minrelaytxfee, minimum relay fee for transactions. More...
|
|
Amount | GetDustThreshold (const CTxOut &txout, const CFeeRate &dustRelayFee) |
|
bool | IsDust (const CTxOut &txout, const CFeeRate &dustRelayFee) |
|
bool | IsStandard (const CScript &scriptPubKey, TxoutType &whichType) |
|
bool | IsStandardTx (const CTransaction &tx, bool permit_bare_multisig, const CFeeRate &dust_relay_fee, std::string &reason) |
| Check for standard transaction types. More...
|
|
bool | AreInputsStandard (const CTransaction &tx, const CCoinsViewCache &mapInputs, uint32_t flags) |
| Check for standard transaction types. More...
|
|
int64_t | GetVirtualTransactionSize (int64_t nSize, int64_t nSigChecks, unsigned int bytes_per_sigCheck) |
| Compute the virtual transaction size (size, or more if sigChecks are too dense). More...
|
|
int64_t | GetVirtualTransactionSize (const CTransaction &tx, int64_t nSigChecks, unsigned int bytes_per_sigCheck) |
|
int64_t | GetVirtualTransactionInputSize (const CTxIn &txin, int64_t nSigChecks, unsigned int bytes_per_sigChecks) |
|
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 for standard transaction types.
- 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
Definition at line 145 of file policy.cpp.
◆ DEFAULT_BLOCK_MIN_TX_FEE_PER_KB()
static constexpr Amount DEFAULT_BLOCK_MIN_TX_FEE_PER_KB |
( |
1000 * |
SATOSHI | ) |
|
|
staticconstexpr |
Default for -blockmintxfee, which sets the minimum feerate for a transaction in blocks created by mining code.
◆ DEFAULT_MIN_RELAY_TX_FEE_PER_KB()
static constexpr Amount DEFAULT_MIN_RELAY_TX_FEE_PER_KB |
( |
1000 * |
SATOSHI | ) |
|
|
staticconstexpr |
Default for -minrelaytxfee, minimum relay fee for transactions.
◆ DUST_RELAY_TX_FEE()
static constexpr Amount DUST_RELAY_TX_FEE |
( |
1000 * |
SATOSHI | ) |
|
|
staticconstexpr |
Min feerate for defining dust.
Historically this has been the same as 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.
◆ GetDustThreshold()
"Dust" is defined in terms of dustRelayFee, which has units satoshis-per-kilobyte. If you'd pay more than 1/3 in fees to spend something, then we consider it dust. A typical spendable txout is 34 bytes big, and will need a CTxIn of at least 148 bytes to spend: so dust is a spendable txout less than 546*dustRelayFee/1000 (in satoshis).
Definition at line 14 of file policy.cpp.
◆ GetVirtualTransactionInputSize() [1/2]
static int64_t GetVirtualTransactionInputSize |
( |
const CTxIn & |
tx | ) |
|
|
inlinestatic |
◆ GetVirtualTransactionInputSize() [2/2]
int64_t GetVirtualTransactionInputSize |
( |
const CTxIn & |
txin, |
|
|
int64_t |
nSigChecks, |
|
|
unsigned int |
bytes_per_sigChecks |
|
) |
| |
◆ GetVirtualTransactionSize() [1/3]
static int64_t GetVirtualTransactionSize |
( |
const CTransaction & |
tx | ) |
|
|
inlinestatic |
◆ GetVirtualTransactionSize() [2/3]
int64_t GetVirtualTransactionSize |
( |
const CTransaction & |
tx, |
|
|
int64_t |
nSigChecks, |
|
|
unsigned int |
bytes_per_sigCheck |
|
) |
| |
◆ GetVirtualTransactionSize() [3/3]
int64_t GetVirtualTransactionSize |
( |
int64_t |
nSize, |
|
|
int64_t |
nSigChecks, |
|
|
unsigned int |
bytes_per_sigCheck |
|
) |
| |
Compute the virtual transaction size (size, or more if sigChecks are too dense).
Definition at line 165 of file policy.cpp.
◆ 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
Definition at line 69 of file policy.cpp.
◆ MEMPOOL_FULL_FEE_INCREMENT()
static constexpr CFeeRate MEMPOOL_FULL_FEE_INCREMENT |
( |
1000 * |
SATOSHI | ) |
|
|
staticconstexpr |
Default for -incrementalrelayfee, which sets the minimum feerate increase for mempool limiting or BIP 125 replacement.
◆ DEFAULT_BYTES_PER_SIGCHECK
constexpr unsigned int DEFAULT_BYTES_PER_SIGCHECK {50} |
|
staticconstexpr |
Default for -bytespersigcheck .
Definition at line 53 of file policy.h.
◆ DEFAULT_MAX_GENERATED_BLOCK_SIZE
constexpr uint64_t DEFAULT_MAX_GENERATED_BLOCK_SIZE {2 * ONE_MEGABYTE} |
|
staticconstexpr |
Default for -blockmaxsize, which controls the maximum size of block the mining code will create.
Definition at line 24 of file policy.h.
◆ DEFAULT_PERMIT_BAREMULTISIG
constexpr bool DEFAULT_PERMIT_BAREMULTISIG {true} |
|
staticconstexpr |
Default for -permitbaremultisig.
Definition at line 55 of file policy.h.
◆ MANDATORY_SCRIPT_VERIFY_FLAGS
constexpr uint32_t MANDATORY_SCRIPT_VERIFY_FLAGS |
|
staticconstexpr |
Initial value:{
@ SCRIPT_ENABLE_SCHNORR_MULTISIG
@ SCRIPT_VERIFY_STRICTENC
@ SCRIPT_ENFORCE_SIGCHECKS
@ SCRIPT_VERIFY_MINIMALDATA
@ SCRIPT_ENABLE_SIGHASH_FORKID
When transactions fail script evaluations under standard flags, this flagset influences the decision of whether to drop them or to also ban the originator (see CheckInputScripts).
Definition at line 73 of file policy.h.
◆ MAX_STANDARD_TX_SIZE
constexpr unsigned int MAX_STANDARD_TX_SIZE {100000} |
|
staticconstexpr |
The maximum size for transactions we're willing to relay/mine.
Definition at line 33 of file policy.h.
◆ MAX_TX_IN_SCRIPT_SIG_SIZE
constexpr unsigned int MAX_TX_IN_SCRIPT_SIG_SIZE {1650} |
|
staticconstexpr |
Biggest 'standard' txin is a 15-of-15 P2SH multisig with compressed keys (remember the 520 byte limit on redeemScript size).
That works out to a (15*(33+1))+3=513 byte redeemScript, 513+1+15*(73+1)+3=1627 bytes of scriptSig, which we round off to 1650 bytes for some minor future-proofing. That's also enough to spend a 20-of-20 CHECKMULTISIG scriptPubKey, though such a scriptPubKey is not considered standard.
Definition at line 43 of file policy.h.
◆ STANDARD_LOCKTIME_VERIFY_FLAGS
constexpr uint32_t STANDARD_LOCKTIME_VERIFY_FLAGS |
|
staticconstexpr |
Initial value:{
static constexpr unsigned int LOCKTIME_VERIFY_SEQUENCE
Flags for nSequence and nLockTime locks.
Used as the flags parameter to sequence and nLocktime checks in non-consensus code.
Definition at line 107 of file policy.h.
◆ STANDARD_NOT_MANDATORY_VERIFY_FLAGS
constexpr uint32_t STANDARD_NOT_MANDATORY_VERIFY_FLAGS |
|
staticconstexpr |
Initial value:{
static constexpr uint32_t MANDATORY_SCRIPT_VERIFY_FLAGS
When transactions fail script evaluations under standard flags, this flagset influences the decision ...
static constexpr uint32_t STANDARD_SCRIPT_VERIFY_FLAGS
Standard script verification flags that standard transactions will comply with.
For convenience, standard but not mandatory verify flags.
Definition at line 100 of file policy.h.
◆ STANDARD_SCRIPT_VERIFY_FLAGS
constexpr uint32_t STANDARD_SCRIPT_VERIFY_FLAGS |
|
staticconstexpr |
Initial value:{
@ SCRIPT_VERIFY_SIGPUSHONLY
@ SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY
@ SCRIPT_VERIFY_CLEANSTACK
@ SCRIPT_DISALLOW_SEGWIT_RECOVERY
@ SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS
@ SCRIPT_VERIFY_CHECKSEQUENCEVERIFY
@ SCRIPT_VERIFY_INPUT_SIGCHECKS
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.
Note that the actual mempool validation flags may be slightly different (see GetStandardScriptFlags), however this constant should be set to the most restrictive flag set that applies in the current / next upgrade, since it is used in numerous parts of the codebase that are unable to access the contextual information of which upgrades are currently active.
Definition at line 90 of file policy.h.