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);
77 std::vector<std::vector<unsigned char> > vSolutions;
78 if (!
Solver(scriptPubKey, whichType, vSolutions))
83 unsigned char m = vSolutions.front()[0];
84 unsigned char n = vSolutions.back()[0];
112 if (sz >= MAX_STANDARD_TX_WEIGHT) {
127 reason =
"scriptsig-size";
131 reason =
"scriptsig-not-pushonly";
136 unsigned int nDataOut = 0;
140 reason =
"scriptpubkey";
147 reason =
"bare-multisig";
157 reason =
"multi-op-return";
169 for (
unsigned int i = 0; i < tx.
vin.size(); i++)
173 std::vector<std::vector<unsigned char> > vSolutions;
177 if (!
Solver(prevScript, whichType, vSolutions))
182 std::vector<std::vector<unsigned char> > stack;
188 CScript subscript(stack.back().begin(), stack.back().end());
189 if (subscript.GetSigOpCount(
true) > MAX_P2SH_SIGOPS) {
203 for (
unsigned int i = 0; i < tx.
vin.size(); i++)
207 if (tx.
vin[i].scriptWitness.IsNull())
216 std::vector <std::vector<unsigned char> > stack;
224 prevScript =
CScript(stack.back().begin(), stack.back().end());
227 int witnessversion = 0;
228 std::vector<unsigned char> witnessprogram;
235 if (witnessversion == 0 && witnessprogram.size() == 32) {
236 if (tx.
vin[i].scriptWitness.stack.back().size() > MAX_STANDARD_P2WSH_SCRIPT_SIZE)
238 size_t sizeWitnessStack = tx.
vin[i].scriptWitness.stack.size() - 1;
239 if (sizeWitnessStack > MAX_STANDARD_P2WSH_STACK_ITEMS)
241 for (
unsigned int j = 0; j < sizeWitnessStack; j++) {
242 if (tx.
vin[i].scriptWitness.stack[j].size() > MAX_STANDARD_P2WSH_STACK_ITEM_SIZE)
256 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).
bool Solver(const CScript &scriptPubKey, txnouttype &typeRet, std::vector< std::vector< unsigned char > > &vSolutionsRet, bool contractConsensus)
Return public keys or hashes from scriptPubKey, for 'standard' transaction types. ...
static const int32_t MAX_STANDARD_VERSION
bool IsPushOnly(const_iterator pc) const
Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical).
int64_t GetTransactionWeight(const CTransaction &tx)
bool IsPayToScriptHash() const
size_t GetSerializeSize(const T &t, int nType, int nVersion=0)
CTxOut out
unspent transaction output
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...
int64_t CAmount
Amount in lius (Can be negative)
bool AreInputsStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check for standard transaction types.
An input of a transaction.
bool IsWitnessProgram(int &version, std::vector< unsigned char > &program) const
const std::vector< CTxOut > vout
const Coin & AccessCoin(const COutPoint &output) const
Return a reference to Coin in the cache, or a pruned one if not found.
bool IsUnspendable() const
Returns whether the script is guaranteed to fail at execution, regardless of the initial stack...
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)
CAmount GetFee(size_t nBytes) const
Return the fee in liu for the given size in bytes.
Serialized script, used inside transaction inputs and outputs.
Fee rate in liu per kilobyte: CAmount / kB.
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
bool IsStandard(const CScript &scriptPubKey, txnouttype &whichType, const bool witnessEnabled)
Check transaction inputs to mitigate two potential denial-of-service attacks:
dev::WithExisting max(dev::WithExisting _a, dev::WithExisting _b)
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