29 nSize += (32 + 4 + 1 + 107 + 4);
31 return 3 * dustRelayFeeIn.
GetFee(nSize);
39 const std::optional<unsigned> &max_datacarrier_bytes,
41 std::vector<std::vector<uint8_t>> vSolutions;
42 whichType =
Solver(scriptPubKey, vSolutions);
47 uint8_t m = vSolutions.front()[0];
48 uint8_t n = vSolutions.back()[0];
57 if (!max_datacarrier_bytes ||
58 scriptPubKey.
size() > *max_datacarrier_bytes) {
67 const std::optional<unsigned> &max_datacarrier_bytes,
68 bool permit_bare_multisig,
const CFeeRate &dust_relay_fee,
69 std::string &reason) {
90 reason =
"scriptsig-size";
94 reason =
"scriptsig-not-pushonly";
99 unsigned int nDataOut = 0;
104 reason =
"scriptpubkey";
111 (!permit_bare_multisig)) {
112 reason =
"bare-multisig";
114 }
else if (
IsDust(txout, dust_relay_fee)) {
122 reason =
"multi-op-return";
155 std::vector<std::vector<uint8_t>> vSolutions;
166 unsigned int bytes_per_sigCheck) {
167 return std::max(nSize,
nSigChecks * bytes_per_sigCheck);
171 unsigned int bytes_per_sigCheck) {
177 unsigned int bytes_per_sigCheck) {
CCoinsView that adds a memory cache for transactions to another CCoinsView.
const Coin & AccessCoin(const COutPoint &output) const
Return a reference to Coin in the cache, or coinEmpty if not found.
Fee rate in satoshis per kilobyte: Amount / kB.
Amount GetFee(size_t nBytes) const
Return the fee in satoshis for the given size in bytes.
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.
The basic transaction that is broadcasted on the network and contained in blocks.
static constexpr int32_t MAX_VERSION
const std::vector< CTxOut > vout
unsigned int GetTotalSize() const
Get the total transaction size in bytes.
const std::vector< CTxIn > vin
static constexpr int32_t MIN_VERSION
An input of a transaction.
An output of a transaction.
Amount GetDustThreshold(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
bool IsStandard(const CScript &scriptPubKey, const std::optional< unsigned > &max_datacarrier_bytes, TxoutType &whichType)
int64_t GetVirtualTransactionInputSize(const CTxIn &txin, int64_t nSigChecks, unsigned int bytes_per_sigCheck)
bool AreInputsStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs, uint32_t flags)
Check transaction inputs to mitigate two potential denial-of-service attacks:
bool IsStandardTx(const CTransaction &tx, const std::optional< unsigned > &max_datacarrier_bytes, bool permit_bare_multisig, const CFeeRate &dust_relay_fee, std::string &reason)
Check for standard transaction types.
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
int64_t GetVirtualTransactionSize(int64_t nSize, int64_t nSigChecks, unsigned int bytes_per_sigCheck)
Compute the virtual transaction size (size, or more if sigChecks are too dense).
static constexpr unsigned int MAX_STANDARD_TX_SIZE
The maximum size for transactions we're willing to relay/mine.
static constexpr unsigned int MAX_TX_IN_SCRIPT_SIG_SIZE
Biggest 'standard' txin is a 15-of-15 P2SH multisig with compressed keys (remember the 520 byte limit...
size_t GetSerializeSize(const T &t, int nVersion=0)
TxoutType Solver(const CScript &scriptPubKey, std::vector< std::vector< uint8_t > > &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
static constexpr Amount zero() noexcept
static const int PROTOCOL_VERSION
network protocol versioning