12#include <unordered_set>
19 "bad-txns-vin-empty");
22 if (tx.
vout.empty()) {
24 "bad-txns-vout-empty");
35 for (
const auto &txout : tx.
vout) {
38 "bad-txns-vout-negative");
43 "bad-txns-vout-toolarge");
46 nValueOut += txout.nValue;
49 "bad-txns-txouttotal-toolarge");
59 "first tx is not coinbase");
67 if (tx.
vin[0].scriptSig.size() < 2 ||
86 std::unordered_set<COutPoint, SaltedOutpointHasher> vInOutPoints;
87 for (
const auto &txin : tx.
vin) {
88 if (txin.prevout.IsNull()) {
90 "bad-txns-prevout-null");
99 if (!vInOutPoints.insert(txin.prevout).second) {
101 "bad-txns-inputs-duplicate");
bool MoneyRange(const Amount nValue)
static constexpr Amount MAX_MONEY
No amount larger than this (in satoshi) is valid.
The basic transaction that is broadcasted on the network and contained in blocks.
const std::vector< CTxOut > vout
const std::vector< CTxIn > vin
bool Invalid(Result result, const std::string &reject_reason="", const std::string &debug_message="")
@ TX_CONSENSUS
invalid by consensus rules
static const int MAX_COINBASE_SCRIPTSIG_SIZE
Coinbase scripts have their own script size limit.
static const uint64_t MAX_TX_SIZE
The maximum allowed size for a transaction, in bytes.
size_t GetSerializeSize(const T &t, int nVersion=0)
static constexpr Amount zero() noexcept
static bool CheckTransactionCommon(const CTransaction &tx, TxValidationState &state)
bool CheckRegularTransaction(const CTransaction &tx, TxValidationState &state)
Context-independent validity checks for coinbase and non-coinbase transactions.
bool CheckCoinbase(const CTransaction &tx, TxValidationState &state)
static const int PROTOCOL_VERSION
network protocol versioning