![]() |
Bitcoin Core
0.19.99
P2P Digital Currency
|
#include <consensus/consensus.h>
#include <policy/feerate.h>
#include <script/interpreter.h>
#include <script/standard.h>
#include <string>
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) |
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) |
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, unsigned int bytes_per_sigop) |
Compute the virtual transaction size (weight reinterpreted as bytes). More... | |
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) |
Variables | |
static const unsigned int | DEFAULT_BLOCK_MAX_WEIGHT = MAX_BLOCK_WEIGHT - 4000 |
Default for -blockmaxweight, which controls the range of block weights the mining code will create. More... | |
static const unsigned int | DEFAULT_BLOCK_MIN_TX_FEE = 1000 |
Default for -blockmintxfee, which sets the minimum feerate for a transaction in blocks created by mining code. More... | |
static const unsigned int | MAX_STANDARD_TX_WEIGHT = 400000 |
The maximum weight for transactions we're willing to relay/mine. More... | |
static const unsigned int | MIN_STANDARD_TX_NONWITNESS_SIZE = 82 |
The minimum non-witness size for transactions we're willing to relay/mine (1 segwit input + 1 P2WPKH output = 82 bytes) More... | |
static const unsigned int | MAX_P2SH_SIGOPS = 15 |
Maximum number of signature check operations in an IsStandard() P2SH script. More... | |
static const unsigned int | MAX_STANDARD_TX_SIGOPS_COST = MAX_BLOCK_SIGOPS_COST/5 |
The maximum number of sigops we're willing to relay/mine in a single tx. More... | |
static const unsigned int | DEFAULT_MAX_MEMPOOL_SIZE = 300 |
Default for -maxmempool, maximum megabytes of mempool memory usage. More... | |
static const unsigned int | DEFAULT_INCREMENTAL_RELAY_FEE = 1000 |
Default for -incrementalrelayfee, which sets the minimum feerate increase for mempool limiting or BIP 125 replacement. More... | |
static const unsigned int | DEFAULT_BYTES_PER_SIGOP = 20 |
Default for -bytespersigop. More... | |
static const bool | DEFAULT_PERMIT_BAREMULTISIG = true |
Default for -permitbaremultisig. More... | |
static const unsigned int | MAX_STANDARD_P2WSH_STACK_ITEMS = 100 |
The maximum number of witness stack items in a standard P2WSH script. More... | |
static const unsigned int | MAX_STANDARD_P2WSH_STACK_ITEM_SIZE = 80 |
The maximum size of each witness stack item in a standard P2WSH script. More... | |
static const unsigned int | MAX_STANDARD_P2WSH_SCRIPT_SIZE = 3600 |
The maximum size of a standard witnessScript. More... | |
static const unsigned int | DUST_RELAY_TX_FEE = 3000 |
Min feerate for defining dust. More... | |
static constexpr unsigned int | STANDARD_SCRIPT_VERIFY_FLAGS |
Standard script verification flags that standard transactions will comply with. More... | |
static constexpr unsigned int | STANDARD_NOT_MANDATORY_VERIFY_FLAGS = STANDARD_SCRIPT_VERIFY_FLAGS & ~MANDATORY_SCRIPT_VERIFY_FLAGS |
For convenience, standard but not mandatory verify flags. More... | |
static constexpr unsigned int | 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 | ||
) |
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 156 of file policy.cpp.
Definition at line 14 of file policy.cpp.
int64_t GetVirtualTransactionInputSize | ( | const CTxIn & | tx, |
int64_t | nSigOpCost, | ||
unsigned int | bytes_per_sigop | ||
) |
Definition at line 248 of file policy.cpp.
|
inlinestatic |
int64_t GetVirtualTransactionSize | ( | int64_t | nWeight, |
int64_t | nSigOpCost, | ||
unsigned int | bytes_per_sigop | ||
) |
Compute the virtual transaction size (weight reinterpreted as bytes).
Definition at line 238 of file policy.cpp.
int64_t GetVirtualTransactionSize | ( | const CTransaction & | tx, |
int64_t | nSigOpCost, | ||
unsigned int | bytes_per_sigop | ||
) |
|
inlinestatic |
Definition at line 48 of file policy.cpp.
bool IsStandard | ( | const CScript & | scriptPubKey, |
txnouttype & | whichType | ||
) |
Definition at line 53 of file policy.cpp.
bool IsStandardTx | ( | const CTransaction & | tx, |
bool | permit_bare_multisig, | ||
const CFeeRate & | dust_relay_fee, | ||
std::string & | reason | ||
) |
Check for standard transaction types.
Definition at line 76 of file policy.cpp.
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 186 of file policy.cpp.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
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
|
static |
Maximum number of signature check operations in an IsStandard() P2SH script.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Used as the flags parameter to sequence and nLocktime checks in non-consensus code.
|
static |
|
static |
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.