 |
Bitcoin Core
22.99.0
P2P Digital Currency
|
Go to the documentation of this file.
34 int witnessversion = 0;
35 std::vector<unsigned char> witnessprogram;
47 nSize += (32 + 4 + 1 + 107 + 4);
50 return dustRelayFeeIn.
GetFee(nSize);
60 std::vector<std::vector<unsigned char> > vSolutions;
61 whichType =
Solver(scriptPubKey, vSolutions);
66 unsigned char m = vSolutions.front()[0];
67 unsigned char n = vSolutions.back()[0];
109 reason =
"scriptsig-size";
113 reason =
"scriptsig-not-pushonly";
118 unsigned int nDataOut = 0;
122 reason =
"scriptpubkey";
129 reason =
"bare-multisig";
131 }
else if (
IsDust(txout, dust_relay_fee)) {
139 reason =
"multi-op-return";
170 for (
unsigned int i = 0; i < tx.
vin.size(); i++) {
173 std::vector<std::vector<unsigned char> > vSolutions;
182 std::vector<std::vector<unsigned char> > stack;
188 CScript subscript(stack.back().begin(), stack.back().end());
203 for (
unsigned int i = 0; i < tx.
vin.size(); i++)
207 if (tx.
vin[i].scriptWitness.IsNull())
217 std::vector <std::vector<unsigned char> > stack;
225 prevScript =
CScript(stack.back().begin(), stack.back().end());
229 int witnessversion = 0;
230 std::vector<unsigned char> witnessprogram;
240 size_t sizeWitnessStack = tx.
vin[i].scriptWitness.stack.size() - 1;
243 for (
unsigned int j = 0; j < sizeWitnessStack; j++) {
254 Span stack{tx.
vin[i].scriptWitness.stack};
255 if (stack.size() >= 2 && !stack.back().empty() && stack.back()[0] ==
ANNEX_TAG) {
259 if (stack.size() >= 2) {
263 if (control_block.empty())
return false;
266 for (
const auto& item : stack) {
270 }
else if (stack.size() == 1) {
int64_t GetVirtualTransactionInputSize(const CTxIn &txin, int64_t nSigOpCost, unsigned int bytes_per_sigop)
size_t GetSerializeSize(const T &t, int nVersion=0)
An input of a transaction.
const std::vector< CTxIn > vin
static const unsigned int MAX_STANDARD_P2WSH_SCRIPT_SIZE
The maximum size in bytes of a standard witnessScript.
static constexpr size_t WITNESS_V0_SCRIPTHASH_SIZE
Signature hash sizes.
TxoutType Solver(const CScript &scriptPubKey, std::vector< std::vector< unsigned char >> &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
@ BASE
Bare scripts and BIP16 P2SH-wrapped redeemscripts.
bool IsStandard(const CScript &scriptPubKey, TxoutType &whichType)
@ WITNESS_UNKNOWN
Only for Witness versions not already defined above.
bool IsWitnessStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check if the transaction is over standard P2WSH resources limit: 3600bytes witnessScript size,...
static constexpr unsigned int ANNEX_TAG
T & SpanPopBack(Span< T > &span)
Pop the last element off a span, and return a reference to that element.
bool IsWitnessProgram(int &version, std::vector< unsigned char > &program) const
bool IsStandardTx(const CTransaction &tx, bool permit_bare_multisig, const CFeeRate &dust_relay_fee, std::string &reason)
Check for standard transaction types.
const Coin & AccessCoin(const COutPoint &output) const
Return a reference to Coin in the cache, or coinEmpty if not found.
static constexpr decltype(CTransaction::nVersion) TX_MAX_STANDARD_VERSION
bool IsPayToScriptHash() const
bool AreInputsStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check transaction inputs to mitigate two potential denial-of-service attacks:
Fee rate in satoshis per kilobyte: CAmount / kB.
The basic transaction that is broadcasted on the network and contained in blocks.
CTxOut out
unspent transaction output
bool IsPushOnly(const_iterator pc) const
Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical).
A Span is an object that can refer to a contiguous sequence of objects.
static const 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,...
static const unsigned int MAX_P2SH_SIGOPS
Maximum number of signature check operations in an IsStandard() P2SH script.
An output of a transaction.
static const unsigned int MAX_STANDARD_SCRIPTSIG_SIZE
The maximum size of a standard ScriptSig.
const std::vector< CTxOut > vout
static const unsigned int MAX_STANDARD_P2WSH_STACK_ITEM_SIZE
The maximum size in bytes of each witness stack item in a standard P2WSH script.
static constexpr uint8_t TAPROOT_LEAF_MASK
int64_t CAmount
Amount in satoshis (Can be negative)
static const unsigned int MAX_STANDARD_P2WSH_STACK_ITEMS
The maximum number of witness stack items in a standard P2WSH script.
unsigned nMaxDatacarrierBytes
Maximum size of TxoutType::NULL_DATA scripts that this node considers standard.
Serialized script, used inside transaction inputs and outputs.
@ NULL_DATA
unspendable OP_RETURN script that carries data
static const unsigned int MAX_STANDARD_TX_WEIGHT
The maximum weight for transactions we're willing to relay/mine.
static int64_t GetTransactionWeight(const CTransaction &tx)
CCoinsView that adds a memory cache for transactions to another CCoinsView.
bool EvalScript(std::vector< std::vector< unsigned char > > &stack, const CScript &script, unsigned int flags, const BaseSignatureChecker &checker, SigVersion sigversion, ScriptExecutionData &execdata, ScriptError *serror)
unsigned int GetSigOpCount(bool fAccurate) const
Pre-version-0.6, Bitcoin always counted CHECKMULTISIGs as 20 sigops.
static int64_t GetTransactionInputWeight(const CTxIn &txin)
static constexpr uint8_t TAPROOT_LEAF_TAPSCRIPT
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
static constexpr size_t WITNESS_V1_TAPROOT_SIZE
bool IsUnspendable() const
Returns whether the script is guaranteed to fail at execution, regardless of the initial stack.
CAmount GetFee(uint32_t num_bytes) const
Return the fee in satoshis for the given size in bytes.
bool fAcceptDatacarrier
A data carrying output is an unspendable output containing data.
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 const int WITNESS_SCALE_FACTOR