11#include <unordered_set>
18 "bad-txns-vin-empty");
21 if (tx.
vout.empty()) {
23 "bad-txns-vout-empty");
34 for (
const auto &txout : tx.
vout) {
37 "bad-txns-vout-negative");
42 "bad-txns-vout-toolarge");
45 nValueOut += txout.nValue;
48 "bad-txns-txouttotal-toolarge");
58 "first tx is not coinbase");
66 if (tx.
vin[0].scriptSig.size() < 2 ||
85 std::unordered_set<COutPoint, SaltedOutpointHasher> vInOutPoints;
86 for (
const auto &txin : tx.
vin) {
87 if (txin.prevout.IsNull()) {
89 "bad-txns-prevout-null");
98 if (!vInOutPoints.insert(txin.prevout).second) {
100 "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)
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)