29 nSize += (32 + 4 + 1 + 107 + 4);
31 return 3 * dustRelayFeeIn.
GetFee(nSize);
39 std::vector<std::vector<uint8_t>> vSolutions;
40 whichType =
Solver(scriptPubKey, vSolutions);
45 uint8_t m = vSolutions.front()[0];
46 uint8_t n = vSolutions.back()[0];
59 unsigned nMaxDatacarrierBytes =
61 if (scriptPubKey.
size() > nMaxDatacarrierBytes) {
70 const CFeeRate &dust_relay_fee, std::string &reason) {
88 reason =
"scriptsig-size";
92 reason =
"scriptsig-not-pushonly";
97 unsigned int nDataOut = 0;
101 reason =
"scriptpubkey";
107 }
else if ((whichType ==
TX_MULTISIG) && (!permit_bare_multisig)) {
108 reason =
"bare-multisig";
110 }
else if (
IsDust(txout, dust_relay_fee)) {
118 reason =
"multi-op-return";
151 std::vector<std::vector<uint8_t>> vSolutions;
162 unsigned int bytes_per_sigop) {
163 return std::max(nSize, nSigOpCount * bytes_per_sigop);
167 unsigned int bytes_per_sigop) {
169 nSigOpCount, bytes_per_sigop);
173 unsigned int bytes_per_sigop) {
175 nSigOpCount, bytes_per_sigop);
txnouttype Solver(const CScript &scriptPubKey, std::vector< std::vector< uint8_t >> &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
static const int32_t MAX_STANDARD_VERSION
static constexpr Amount zero()
int64_t GetVirtualTransactionInputSize(const CTxIn &txin, int64_t nSigOpCount, unsigned int bytes_per_sigop)
const Coin & AccessCoin(const COutPoint &output) const
Return a reference to Coin in the cache, or a pruned one if not found.
static const unsigned int MAX_OP_RETURN_RELAY
Default setting for nMaxDatacarrierBytes.
bool fAcceptDatacarrier
A data carrying output is an unspendable output containing data.
const std::vector< CTxIn > vin
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...
Amount GetDustThreshold(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
Amount GetFee(size_t nBytes) const
Return the fee in satoshis for the given size in bytes.
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.
static const 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...
Serialized script, used inside transaction inputs and outputs.
static const int PROTOCOL_VERSION
network protocol versioning
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
Fee rate in satoshis per kilobyte: Amount / kB.
bool IsStandard(const CScript &scriptPubKey, txnouttype &whichType)
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
unsigned int GetTotalSize() const
Get the total transaction size in bytes.
The basic transaction that is broadcasted on the network and contained in blocks. ...
CCoinsView that adds a memory cache for transactions to another CCoinsView.
bool IsStandardTx(const CTransaction &tx, bool permit_bare_multisig, const CFeeRate &dust_relay_fee, std::string &reason)
Check for standard transaction types.
int64_t GetVirtualTransactionSize(int64_t nSize, int64_t nSigOpCount, unsigned int bytes_per_sigop)
Compute the virtual transaction size (size, or more if sigops are too dense).
bool AreInputsStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs, uint32_t flags)
Check transaction inputs to mitigate two potential denial-of-service attacks:
static const unsigned int MAX_STANDARD_TX_SIZE
The maximum size for transactions we're willing to relay/mine.