39 int witnessversion = 0;
40 std::vector<unsigned char> witnessprogram;
45 nSize += (32 + 4 + 1 + (107 / WITNESS_SCALE_FACTOR) + 4);
47 nSize += (32 + 4 + 1 + 107 + 4);
50 return dustRelayFeeIn.
GetFee(nSize);
63 std::vector<std::vector<unsigned char> > vSolutions;
64 if (!
Solver(scriptPubKey, whichType, vSolutions))
69 unsigned char m = vSolutions.front()[0];
70 unsigned char n = vSolutions.back()[0];
98 unsigned int sz = GetTransactionWeight(tx);
99 if (sz >= MAX_STANDARD_TX_WEIGHT) {
114 reason =
"scriptsig-size";
118 reason =
"scriptsig-not-pushonly";
123 unsigned int nDataOut = 0;
124 unsigned int nAssetDataOut = 0;
128 reason =
"scriptpubkey";
137 reason =
"bare-multisig";
147 reason =
"multi-op-return";
152 if (nAssetDataOut > 10) {
153 reason =
"tomany-op-rvn-asset";
181 for (
unsigned int i = 0; i < tx.
vin.size(); i++)
185 std::vector<std::vector<unsigned char> > vSolutions;
189 if (!
Solver(prevScript, whichType, vSolutions))
194 std::vector<std::vector<unsigned char> > stack;
200 CScript subscript(stack.back().begin(), stack.back().end());
201 if (subscript.GetSigOpCount(
true) > MAX_P2SH_SIGOPS) {
215 for (
unsigned int i = 0; i < tx.
vin.size(); i++)
219 if (tx.
vin[i].scriptWitness.IsNull())
228 std::vector <std::vector<unsigned char> > stack;
236 prevScript =
CScript(stack.back().begin(), stack.back().end());
239 int witnessversion = 0;
240 std::vector<unsigned char> witnessprogram;
247 if (witnessversion == 0 && witnessprogram.size() == 32) {
248 if (tx.
vin[i].scriptWitness.stack.back().size() > MAX_STANDARD_P2WSH_SCRIPT_SIZE)
250 size_t sizeWitnessStack = tx.
vin[i].scriptWitness.stack.size() - 1;
251 if (sizeWitnessStack > MAX_STANDARD_P2WSH_STACK_ITEMS)
253 for (
unsigned int j = 0; j < sizeWitnessStack; j++) {
254 if (tx.
vin[i].scriptWitness.stack[j].size() > MAX_STANDARD_P2WSH_STACK_ITEM_SIZE)
268 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
size_t GetSerializeSize(const T &t, int nType, int nVersion=0)
CTxOut out
unspent transaction output
bool fAcceptDatacarrier
A data carrying output is an unspendable output containing data.
bool IsWitnessProgram(int &version, std::vector< unsigned char > &program) const
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...
bool IsUnspendable() const
Returns whether the script is guaranteed to fail at execution, regardless of the initial stack...
int64_t CAmount
Amount in corbies (Can be negative)
bool AreInputsStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check transaction inputs to mitigate two potential denial-of-service attacks:
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 IsStandardTx(const CTransaction &tx, std::string &reason, const bool witnessEnabled)
Check for standard transaction types.
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)
bool Solver(const CScript &scriptPubKey, txnouttype &typeRet, std::vector< std::vector< unsigned char > > &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
Serialized script, used inside transaction inputs and outputs.
Fee rate in satoshis per kilobyte: CAmount / kB.
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
bool IsStandard(const CScript &scriptPubKey, txnouttype &whichType, const bool witnessEnabled)
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.
unspendable OP_RAVEN_ASSET script that carries data
bool IsAssetScript(int &nType, bool &fIsOwner, int &nStartingIndex) const
CAmount GetFee(size_t nBytes) const
Return the fee in satoshis for the given size in bytes.