38 int witnessversion = 0;
39 std::vector<unsigned char> witnessprogram;
44 nSize += (32 + 4 + 1 + (107 / WITNESS_SCALE_FACTOR) + 4);
46 nSize += (32 + 4 + 1 + 107 + 4);
49 return dustRelayFeeIn.
GetFee(nSize);
59 std::vector<std::vector<unsigned char> > vSolutions;
60 whichType =
Solver(scriptPubKey, vSolutions);
65 unsigned char m = vSolutions.front()[0];
66 unsigned char n = vSolutions.back()[0];
91 unsigned int sz = GetTransactionWeight(tx);
92 if (sz > MAX_STANDARD_TX_WEIGHT) {
107 reason =
"scriptsig-size";
111 reason =
"scriptsig-not-pushonly";
116 unsigned int nDataOut = 0;
137 reason =
"multi-op-return";
165 for (
unsigned int i = 0; i < tx.
vin.size(); i++)
169 std::vector<std::vector<unsigned char> > vSolutions;
174 std::vector<std::vector<unsigned char> > stack;
180 CScript subscript(stack.back().begin(), stack.back().end());
181 if (subscript.GetSigOpCount(
true) > MAX_P2SH_SIGOPS) {
195 for (
unsigned int i = 0; i < tx.
vin.size(); i++)
199 if (tx.
vin[i].scriptWitness.IsNull())
208 std::vector <std::vector<unsigned char> > stack;
216 prevScript =
CScript(stack.back().begin(), stack.back().end());
219 int witnessversion = 0;
220 std::vector<unsigned char> witnessprogram;
227 if (witnessversion == 0 && witnessprogram.size() == WITNESS_V0_SCRIPTHASH_SIZE) {
228 if (tx.
vin[i].scriptWitness.stack.back().size() > MAX_STANDARD_P2WSH_SCRIPT_SIZE)
230 size_t sizeWitnessStack = tx.
vin[i].scriptWitness.stack.size() - 1;
231 if (sizeWitnessStack > MAX_STANDARD_P2WSH_STACK_ITEMS)
233 for (
unsigned int j = 0; j < sizeWitnessStack; j++) {
234 if (tx.
vin[i].scriptWitness.stack[j].size() > MAX_STANDARD_P2WSH_STACK_ITEM_SIZE)
248 return (std::max(nWeight, nSigOpCost *
nBytesPerSigOp) + WITNESS_SCALE_FACTOR - 1) / WITNESS_SCALE_FACTOR;
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost)
Compute the virtual transaction size (weight reinterpreted as bytes).
static const int32_t MAX_STANDARD_VERSION
unspendable OP_RETURN script that carries data
const Coin & AccessCoin(const COutPoint &output) const
Return a reference to Coin in the cache, or a pruned one if not found.
bool IsPayToScriptHash() const
CTxOut out
unspent transaction output
bool fAcceptDatacarrier
A data carrying output is an unspendable output containing data.
txnouttype Solver(const CScript &scriptPubKey, std::vector< std::vector< unsigned char >> &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
bool IsWitnessProgram(int &version, std::vector< unsigned char > &program) const
int64_t GetVirtualTransactionInputSize(const CTxIn &txin, int64_t nSigOpCost)
unsigned int nBytesPerSigOp
const std::vector< CTxIn > vin
bool IsWitnessStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check if the transaction is over standard P2WSH resources limit: 3600bytes witnessScript size...
size_t GetSerializeSize(const T &t, int nVersion=0)
bool IsUnspendable() const
Returns whether the script is guaranteed to fail at execution, regardless of the initial stack...
int64_t CAmount
Amount in satoshis (Can be negative)
bool AreInputsStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check transaction inputs to mitigate two potential denial-of-service attacks:
Only for Witness versions not already defined above.
An input of a transaction.
bool IsPushOnly(const_iterator pc) const
Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical).
const std::vector< CTxOut > vout
An output of a transaction.
bool EvalScript(std::vector< std::vector< unsigned char > > &stack, const CScript &script, unsigned int flags, const BaseSignatureChecker &checker, SigVersion sigversion, ScriptError *serror)
CAmount GetDustThreshold(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
Serialized script, used inside transaction inputs and outputs.
Fee rate in satoshis per kilobyte: CAmount / kB.
bool IsStandardTx(const CTransaction &tx, std::string &reason)
Check for standard transaction types.
bool IsStandard(const CScript &scriptPubKey, txnouttype &whichType)
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
The basic transaction that is broadcasted on the network and contained in blocks. ...
CCoinsView that adds a memory cache for transactions to another CCoinsView.
CFeeRate incrementalRelayFee
unsigned nMaxDatacarrierBytes
Maximum size of TX_NULL_DATA scripts that this node considers standard.
CAmount GetFee(size_t nBytes) const
Return the fee in satoshis for the given size in bytes.