60 nSize += (32 + 4 + 1 + 107 + 4);
82 std::vector<std::vector<unsigned char> >
vSolutions;
128 reason =
"scriptsig-size";
131 if (!
txin.scriptSig.IsPushOnly()) {
132 reason =
"scriptsig-not-pushonly";
141 reason =
"scriptpubkey";
146 unsigned int size = txout.scriptPubKey.size();
148 reason =
"datacarrier";
153 reason =
"bare-multisig";
175 for (
const auto&
txin: tx.
vin) {
226 for (
unsigned int i = 0; i < tx.
vin.size(); i++) {
229 std::vector<std::vector<unsigned char> >
vSolutions;
242 std::vector<std::vector<unsigned char> > stack;
270 for (
unsigned int i = 0; i < tx.
vin.size(); i++)
274 if (tx.
vin[i].scriptWitness.IsNull())
289 std::vector <std::vector<unsigned char> > stack;
326 std::span stack{tx.
vin[i].scriptWitness.stack};
327 if (stack.size() >= 2 && !stack.back().empty() && stack.back()[0] ==
ANNEX_TAG) {
331 if (stack.size() >= 2) {
338 for (
const auto&
item : stack) {
342 }
else if (stack.size() == 1) {
362 for (
const auto&
txin: tx.
vin) {
375 std::vector <std::vector<uint8_t>> stack;
380 const CScript redeem_script{stack.
back().begin(), stack.back().end()};
381 if (redeem_script.IsWitnessProgram(version,
program)) {
int64_t CAmount
Amount in satoshis (Can be negative)
#define Assert(val)
Identity function.
CCoinsView that adds a memory cache for transactions to another CCoinsView.
const Coin & AccessCoin(const COutPoint &output) const
Return a reference to Coin in the cache, or coinEmpty if not found.
Fee rate in satoshis per virtualbyte: CAmount / vB the feerate is represented internally as FeeFrac.
Serialized script, used inside transaction inputs and outputs.
bool IsUnspendable() const
Returns whether the script is guaranteed to fail at execution, regardless of the initial stack.
unsigned int GetSigOpCount(bool fAccurate) const
Pre-version-0.6, Bitcoin always counted CHECKMULTISIGs as 20 sigops.
bool IsWitnessProgram(int &version, std::vector< unsigned char > &program) const
The basic transaction that is broadcasted on the network and contained in blocks.
const std::vector< CTxOut > vout
const std::vector< CTxIn > vin
An input of a transaction.
An output of a transaction.
CTxOut out
unspent transaction output
bool Invalid(Result result, const std::string &reject_reason="", const std::string &debug_message="")
static int32_t GetTransactionWeight(const CTransaction &tx)
@ TX_INPUTS_NOT_STANDARD
inputs (covered by txid) failed policy rules
constexpr int WITNESS_SCALE_FACTOR
bool EvalScript(std::vector< std::vector< unsigned char > > &stack, const CScript &script, script_verify_flags flags, const BaseSignatureChecker &checker, SigVersion sigversion, ScriptExecutionData &execdata, ScriptError *serror)
@ BASE
Bare scripts and BIP16 P2SH-wrapped redeemscripts.
constexpr uint8_t TAPROOT_LEAF_MASK
constexpr uint8_t TAPROOT_LEAF_TAPSCRIPT
constexpr size_t WITNESS_V0_SCRIPTHASH_SIZE
Signature hash sizes.
constexpr size_t WITNESS_V1_TAPROOT_SIZE
constexpr script_verify_flags SCRIPT_VERIFY_NONE
Script verification flags.
TxValidationState ValidateInputsStandardness(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check transaction inputs.
bool SpendsNonAnchorWitnessProg(const CTransaction &tx, const CCoinsViewCache &prevouts)
Check whether this transaction spends any witness program but P2A, including not-yet-defined ones.
CAmount GetDustThreshold(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop)
Compute the virtual transaction size (weight reinterpreted as bytes).
static bool CheckSigopsBIP54(const CTransaction &tx, const CCoinsViewCache &inputs)
Check the total number of non-witness sigops across the whole transaction, as per BIP54.
bool IsWitnessStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check if the transaction is over standard P2WSH resources limit: 3600bytes witnessScript size,...
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.
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.
int64_t GetSigOpsAdjustedWeight(int64_t weight, int64_t sigop_cost, unsigned int bytes_per_sigop)
constexpr decltype(CTransaction::version) TX_MIN_STANDARD_VERSION
constexpr unsigned int MAX_TX_LEGACY_SIGOPS
The maximum number of potentially executed legacy signature operations in a single standard tx.
constexpr decltype(CTransaction::version) TX_MAX_STANDARD_VERSION
constexpr unsigned int MAX_STANDARD_P2WSH_STACK_ITEMS
The maximum number of witness stack items in a standard P2WSH script.
constexpr unsigned int MAX_STANDARD_TAPSCRIPT_STACK_ITEM_SIZE
The maximum size in bytes of each witness stack item in a standard BIP 342 script (Taproot,...
constexpr unsigned int MAX_DUST_OUTPUTS_PER_TX
Maximum number of ephemeral dust outputs allowed.
constexpr unsigned int MAX_STANDARD_P2WSH_STACK_ITEM_SIZE
The maximum size in bytes of each witness stack item in a standard P2WSH script.
constexpr int32_t MAX_STANDARD_TX_WEIGHT
The maximum weight for transactions we're willing to relay/mine.
constexpr unsigned int MAX_P2SH_SIGOPS
Maximum number of signature check operations in an IsStandard() P2SH script.
constexpr unsigned int MAX_STANDARD_P2WSH_SCRIPT_SIZE
The maximum size in bytes of a standard witnessScript.
constexpr unsigned int MAX_STANDARD_SCRIPTSIG_SIZE
The maximum size of a standard ScriptSig.
constexpr unsigned int ANNEX_TAG
std::string ScriptErrorString(const ScriptError serror)
enum ScriptError_t ScriptError
uint64_t GetSerializeSize(const T &t)
TxoutType Solver(const CScript &scriptPubKey, std::vector< std::vector< unsigned char > > &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
@ WITNESS_UNKNOWN
Only for Witness versions not already defined above.
@ NULL_DATA
unspendable OP_RETURN script that carries data
T & SpanPopBack(std::span< T > &span)
A span is an object that can refer to a contiguous sequence of objects.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.