Bitcoin Core  21.99.0
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{25};
17 static constexpr uint32_t MAX_PACKAGE_SIZE{101};
19 
25  PCKG_RESULT_UNSET = 0,
26  PCKG_POLICY,
27  PCKG_TX,
28 };
29 
32 using Package = std::vector<CTransactionRef>;
33 
34 class PackageValidationState : public ValidationState<PackageValidationResult> {};
35 
42 bool CheckPackage(const Package& txns, PackageValidationState& state);
43 
44 #endif // BITCOIN_POLICY_PACKAGES_H
policy.h
PackageValidationResult::PCKG_TX
@ PCKG_TX
At least one tx is invalid.
transaction.h
validation.h
PackageValidationResult
PackageValidationResult
A "reason" why a package was invalid.
Definition: packages.h:24
PackageValidationResult::PCKG_POLICY
@ PCKG_POLICY
The package itself is invalid (e.g. too many transactions).
CheckPackage
bool CheckPackage(const Package &txns, PackageValidationState &state)
Context-free package policy checks:
Definition: packages.cpp:14
PackageValidationResult::PCKG_RESULT_UNSET
@ PCKG_RESULT_UNSET
Initial value. The package has not yet been rejected.
PackageValidationState
Definition: packages.h:34
MAX_PACKAGE_COUNT
static constexpr uint32_t MAX_PACKAGE_COUNT
Default maximum number of transactions in a package.
Definition: packages.h:15
MAX_STANDARD_TX_WEIGHT
static const unsigned int MAX_STANDARD_TX_WEIGHT
The maximum weight for transactions we're willing to relay/mine.
Definition: policy.h:24
Package
std::vector< CTransactionRef > Package
A package is an ordered list of transactions.
Definition: packages.h:32
MAX_PACKAGE_SIZE
static constexpr uint32_t MAX_PACKAGE_SIZE
Default maximum total virtual size of transactions in a package in KvB.
Definition: packages.h:17
WITNESS_SCALE_FACTOR
static const int WITNESS_SCALE_FACTOR
Definition: consensus.h:21
ValidationState
Template for capturing information about block/transaction validation.
Definition: validation.h:89