14 #include "validation.h"
35 nSize += (32 + 4 + 1 + 107 + 4);
36 return dustRelayFeeIn.
GetFee(nSize);
42 return dustRelayFeeIn.
GetFee(182);
52 unsigned int K = DEFAULT_SHIELDEDTXFEE_K;
80 std::vector<valtype> vSolutions;
81 if (!
Solver(scriptPubKey, whichType, vSolutions))
86 unsigned char m = vSolutions.front()[0];
87 unsigned char n = vSolutions.back()[0];
105 if (tx->nVersion != CTransaction::TxVersion::LEGACY) {
130 reason =
"non-final";
138 unsigned int sz = tx->GetTotalSize();
139 unsigned int nMaxSize = tx->IsShieldedTx() ? MAX_TX_SIZE_AFTER_SAPLING : MAX_STANDARD_TX_SIZE;
140 if (sz >= nMaxSize) {
145 for (
const CTxIn& txin : tx->vin) {
154 reason =
"scriptsig-size";
158 reason =
"scriptsig-not-pushonly";
163 unsigned int nDataOut = 0;
165 for (
const CTxOut& txout : tx->vout) {
167 reason =
"scriptpubkey";
174 reason =
"bare-multisig";
184 reason =
"multi-op-return";
197 for (
unsigned int i = 0; i < tx.
vin.size(); i++) {
200 std::vector<std::vector<unsigned char> > vSolutions;
204 if (!
Solver(prevScript, whichType, vSolutions))
209 std::vector<std::vector<unsigned char> > stack;
215 CScript subscript(stack.back().begin(), stack.back().end());
int64_t CAmount
Amount in PIV (Can be negative)
const CChainParams & Params()
Return the currently selected parameters.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
CCoinsView that adds a memory cache for transactions to another CCoinsView.
const Coin & AccessCoin(const COutPoint &output) const
Return a reference to a Coin in the cache, or a pruned one if not found.
Fee rate in PIV per kilobyte: CAmount / kB.
CAmount GetFee(size_t size) const
Serialized script, used inside transaction inputs and outputs.
bool IsPushOnly(const_iterator pc) const
Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical).
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.
The basic transaction that is broadcasted on the network and contained in blocks.
SigVersion GetRequiredSigVersion() const
An input of a transaction.
An output of a transaction.
CTxOut out
unspent transaction output
bool EvalScript(std::vector< std::vector< unsigned char > > &stack, const CScript &script, unsigned int flags, const BaseSignatureChecker &checker, SigVersion sigversion, ScriptError *serror)
RecursiveMutex cs_main
Global state.
bool AreInputsStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check for standard transaction types.
CAmount GetDustThreshold(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
bool IsStandardTx(const CTransactionRef &tx, int nBlockHeight, std::string &reason)
Check for standard transaction types.
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
bool IsStandard(const CScript &scriptPubKey, txnouttype &whichType)
Check transaction inputs to mitigate two potential denial-of-service attacks:
CAmount GetShieldedDustThreshold(const CFeeRate &dustRelayFeeIn)
#define SPENDDESCRIPTION_SIZE
#define CTXOUT_REGULAR_SIZE
unsigned int GetSerializeSize(const std::array< T, N > &item)
array
bool Solver(const CScript &scriptPubKey, txnouttype &typeRet, std::vector< std::vector< unsigned char > > &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
unsigned nMaxDatacarrierBytes
#define AssertLockHeld(cs)
std::shared_ptr< const CTransaction > CTransactionRef
bool IsFinalTx(const CTransactionRef &tx, int nBlockHeight, int64_t nBlockTime)
Check if transaction is final and can be included in a block with the specified height and time.
bool NetworkUpgradeActive(int nHeight, const Consensus::Params ¶ms, Consensus::UpgradeIndex idx)
Returns true if the given network upgrade is active as of the given block height.