12#include <unordered_set>
16 const unsigned int package_count = txns.size();
22 const int64_t total_size = std::accumulate(txns.cbegin(), txns.cend(), 0,
23 [](int64_t
sum,
const auto& tx) { return sum + GetVirtualTransactionSize(*tx); });
33 std::unordered_set<uint256, SaltedTxidHasher> later_txids;
34 std::transform(txns.cbegin(), txns.cend(), std::inserter(later_txids, later_txids.end()),
35 [](
const auto& tx) { return tx->GetHash(); });
36 for (
const auto& tx : txns) {
37 for (
const auto& input : tx->vin) {
38 if (later_txids.find(input.prevout.hash) != later_txids.end()) {
43 later_txids.erase(tx->GetHash());
47 std::unordered_set<COutPoint, SaltedOutpointHasher> inputs_seen;
48 for (
const auto& tx : txns) {
49 for (
const auto& input : tx->vin) {
50 if (inputs_seen.find(input.prevout) != inputs_seen.end()) {
58 std::transform(tx->vin.cbegin(), tx->vin.cend(), std::inserter(inputs_seen, inputs_seen.end()),
59 [](
const auto& input) { return input.prevout; });
bool Invalid(Result result, const std::string &reject_reason="", const std::string &debug_message="")
bool CheckPackage(const Package &txns, PackageValidationState &state)
Context-free package policy checks:
std::vector< CTransactionRef > Package
A package is an ordered list of transactions.
static constexpr uint32_t MAX_PACKAGE_COUNT
Default maximum number of transactions in a package.
static constexpr uint32_t MAX_PACKAGE_SIZE
Default maximum total virtual size of transactions in a package in KvB.
@ PCKG_POLICY
The package itself is invalid (e.g. too many transactions).