Bitcoin ABC 0.30.5
P2P Digital Currency
|
#include <consensus/consensus.h>
#include <feerate.h>
#include <script/standard.h>
#include <optional>
#include <string>
Go to the source code of this file.
Functions | |
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, const std::optional< unsigned > &max_datacarrier_bytes, TxoutType &whichType) |
bool | IsStandardTx (const CTransaction &tx, const std::optional< unsigned > &max_datacarrier_bytes, 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) |
Variables | |
static constexpr uint64_t | DEFAULT_MAX_GENERATED_BLOCK_SIZE {2 * ONE_MEGABYTE} |
Default for -blockmaxsize, which controls the maximum size of block the mining code will create. More... | |
static constexpr unsigned int | MAX_STANDARD_TX_SIZE {100000} |
The maximum size for transactions we're willing to relay/mine. More... | |
static constexpr unsigned int | MAX_TX_IN_SCRIPT_SIG_SIZE {1650} |
Biggest 'standard' txin is a 15-of-15 P2SH multisig with compressed keys (remember the 520 byte limit on redeemScript size). More... | |
static constexpr unsigned int | DEFAULT_BYTES_PER_SIGCHECK {50} |
Default for -bytespersigcheck . More... | |
static constexpr bool | DEFAULT_PERMIT_BAREMULTISIG {true} |
Default for -permitbaremultisig. More... | |
static constexpr uint32_t | MANDATORY_SCRIPT_VERIFY_FLAGS |
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). More... | |
static constexpr uint32_t | STANDARD_SCRIPT_VERIFY_FLAGS |
Standard script verification flags that standard transactions will comply with. More... | |
static constexpr uint32_t | STANDARD_NOT_MANDATORY_VERIFY_FLAGS |
For convenience, standard but not mandatory verify flags. More... | |
static constexpr uint32_t | STANDARD_LOCKTIME_VERIFY_FLAGS |
Used as the flags parameter to sequence and nLocktime checks in non-consensus code. More... | |
bool AreInputsStandard | ( | const CTransaction & | tx, |
const CCoinsViewCache & | mapInputs, | ||
uint32_t | flags | ||
) |
Check for standard transaction types.
[in] | mapInputs | Map of previous transactions that have outputs we're spending |
Check for standard transaction types.
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.
|
staticconstexpr |
Default for -blockmintxfee, which sets the minimum feerate for a transaction in blocks created by mining code.
|
staticconstexpr |
Default for -minrelaytxfee, minimum relay fee for transactions.
|
staticconstexpr |
Min feerate for defining dust.
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.
"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.
|
inlinestatic |
int64_t GetVirtualTransactionInputSize | ( | const CTxIn & | txin, |
int64_t | nSigChecks, | ||
unsigned int | bytes_per_sigChecks | ||
) |
Definition at line 176 of file policy.cpp.
|
inlinestatic |
int64_t GetVirtualTransactionSize | ( | const CTransaction & | tx, |
int64_t | nSigChecks, | ||
unsigned int | bytes_per_sigCheck | ||
) |
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.
Definition at line 34 of file policy.cpp.
bool IsStandard | ( | const CScript & | scriptPubKey, |
const std::optional< unsigned > & | max_datacarrier_bytes, | ||
TxoutType & | whichType | ||
) |
Definition at line 38 of file policy.cpp.
bool IsStandardTx | ( | const CTransaction & | tx, |
const std::optional< unsigned > & | max_datacarrier_bytes, | ||
bool | permit_bare_multisig, | ||
const CFeeRate & | dust_relay_fee, | ||
std::string & | reason | ||
) |
Check for standard transaction types.
Definition at line 66 of file policy.cpp.
|
staticconstexpr |
Default for -incrementalrelayfee, which sets the minimum feerate increase for mempool limiting or BIP 125 replacement.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
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).
|
staticconstexpr |
|
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.
|
staticconstexpr |
Used as the flags parameter to sequence and nLocktime checks in non-consensus code.
|
staticconstexpr |
For convenience, standard but not mandatory verify flags.
|
staticconstexpr |
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.