![]() |
Bitcoin Core 30.99.0
P2P Digital Currency
|
#include <policy/policy.h>
#include <coins.h>
#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <consensus/validation.h>
#include <policy/feerate.h>
#include <primitives/transaction.h>
#include <script/interpreter.h>
#include <script/script.h>
#include <script/solver.h>
#include <serialize.h>
#include <span.h>
#include <algorithm>
#include <cstddef>
#include <vector>
Go to the source code of this file.
Functions | |
CAmount | GetDustThreshold (const CTxOut &txout, const CFeeRate &dustRelayFeeIn) |
bool | IsDust (const CTxOut &txout, const CFeeRate &dustRelayFeeIn) |
std::vector< uint32_t > | GetDust (const CTransaction &tx, CFeeRate dust_relay_rate) |
Get the vout index numbers of all dust outputs. More... | |
bool | IsStandard (const CScript &scriptPubKey, 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... | |
static bool | CheckSigopsBIP54 (const CTransaction &tx, const CCoinsViewCache &inputs) |
Check the total number of non-witness sigops across the whole transaction, as per BIP54. More... | |
bool | AreInputsStandard (const CTransaction &tx, const CCoinsViewCache &mapInputs) |
Check transaction inputs. 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 multisignatures up to n-of-100 using OP_CHECKSIG, OP_ADD, and OP_EQUAL. More... | |
bool | SpendsNonAnchorWitnessProg (const CTransaction &tx, const CCoinsViewCache &prevouts) |
Check whether this transaction spends any witness program but P2A, including not-yet-defined ones. 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 &txin, int64_t nSigOpCost, unsigned int bytes_per_sigop) |
bool AreInputsStandard | ( | const CTransaction & | tx, |
const CCoinsViewCache & | mapInputs | ||
) |
Check transaction inputs.
Check for standard transaction types.
This does three things:
Note that only the non-witness portion of the transaction is checked here.
We also check the total number of non-witness sigops across the whole transaction, as per BIP54.
Definition at line 213 of file policy.cpp.
|
static |
Check the total number of non-witness sigops across the whole transaction, as per BIP54.
Definition at line 169 of file policy.cpp.
std::vector< uint32_t > GetDust | ( | const CTransaction & | tx, |
CFeeRate | dust_relay_rate | ||
) |
Get the vout index numbers of all dust outputs.
Definition at line 70 of file policy.cpp.
Definition at line 26 of file policy.cpp.
int64_t GetVirtualTransactionInputSize | ( | const CTxIn & | txin, |
int64_t | nSigOpCost, | ||
unsigned int | bytes_per_sigop | ||
) |
Definition at line 386 of file policy.cpp.
int64_t GetVirtualTransactionSize | ( | const CTransaction & | tx, |
int64_t | nSigOpCost, | ||
unsigned int | bytes_per_sigop | ||
) |
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 376 of file policy.cpp.
Definition at line 65 of file policy.cpp.
Definition at line 79 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 99 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 multisignatures up to n-of-100 using OP_CHECKSIG, OP_ADD, and OP_EQUAL.
Also enforce a maximum stack item size limit and no annexes for tapscript spends.
Definition at line 251 of file policy.cpp.
bool SpendsNonAnchorWitnessProg | ( | const CTransaction & | tx, |
const CCoinsViewCache & | prevouts | ||
) |
Check whether this transaction spends any witness program but P2A, including not-yet-defined ones.
May return false
early for consensus-invalid transactions.
Definition at line 340 of file policy.cpp.