Bitcoin ABC  0.28.12
P2P Digital Currency
packages.h
Go to the documentation of this file.
1 // Copyright (c) 2021 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_POLICY_PACKAGES_H
6 #define BITCOIN_POLICY_PACKAGES_H
7 
8 #include <consensus/validation.h>
9 #include <policy/policy.h>
10 #include <primitives/transaction.h>
11 
12 #include <vector>
13 
15 static constexpr uint32_t MAX_PACKAGE_COUNT{50};
17 static constexpr uint32_t MAX_PACKAGE_SIZE{101};
18 static_assert(MAX_PACKAGE_SIZE * 1000 >= MAX_STANDARD_TX_SIZE);
19 
31  PCKG_TX,
32 };
33 
38 using Package = std::vector<CTransactionRef>;
39 
40 class PackageValidationState : public ValidationState<PackageValidationResult> {
41 };
42 
51 bool CheckPackage(const Package &txns, PackageValidationState &state);
52 
60 bool IsChildWithParents(const Package &package);
61 
62 #endif // BITCOIN_POLICY_PACKAGES_H
Template for capturing information about block/transaction validation.
Definition: validation.h:82
bool IsChildWithParents(const Package &package)
Context-free check that a package is exactly one child and its parents; not all parents need to be pr...
Definition: packages.cpp:77
std::vector< CTransactionRef > Package
A package is an ordered list of transactions.
Definition: packages.h:38
static constexpr uint32_t MAX_PACKAGE_COUNT
Default maximum number of transactions in a package.
Definition: packages.h:15
static constexpr uint32_t MAX_PACKAGE_SIZE
Default maximum total size of transactions in a package in KB.
Definition: packages.h:17
bool CheckPackage(const Package &txns, PackageValidationState &state)
Context-free package policy checks:
Definition: packages.cpp:13
PackageValidationResult
A "reason" why a package was invalid.
Definition: packages.h:25
@ PCKG_POLICY
The package itself is invalid (e.g. too many transactions).
@ PCKG_RESULT_UNSET
Initial value. The package has not yet been rejected.
@ PCKG_TX
At least one tx is invalid.
static constexpr unsigned int MAX_STANDARD_TX_SIZE
The maximum size for transactions we're willing to relay/mine.
Definition: policy.h:34