aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2022-09-16 16:49:24 +0100
committerglozow <gloriajzhao@gmail.com>2023-11-01 17:21:54 +0000
commitda9aceba217bbded6909f06144eaa1e1a4ebcb69 (patch)
treec3675b4dbe0177e43618688adf1d2e3e5501cc91 /src/validation.cpp
parentd51fb9caa622add96c6b594e162da5584eb927fc (diff)
downloadbitcoin-da9aceba217bbded6909f06144eaa1e1a4ebcb69.tar.xz
[refactor] move package checks into helper functions
This allows IsSorted() and IsConsistent() to be used by themselves. IsSorted() with a precomputed set is used so that we don't create this set multiple times.
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index c72188d581..e2873e8b4e 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -1258,7 +1258,7 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptMultipleTransactions(const std::
// These context-free package limits can be done before taking the mempool lock.
PackageValidationState package_state;
- if (!CheckPackage(txns, package_state)) return PackageMempoolAcceptResult(package_state, {});
+ if (!CheckPackage(txns, package_state, /*require_sorted=*/true)) return PackageMempoolAcceptResult(package_state, {});
std::vector<Workspace> workspaces{};
workspaces.reserve(txns.size());
@@ -1405,7 +1405,9 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptPackage(const Package& package,
// transactions and thus won't return any MempoolAcceptResults, just a package-wide error.
// Context-free package checks.
- if (!CheckPackage(package, package_state_quit_early)) return PackageMempoolAcceptResult(package_state_quit_early, {});
+ if (!CheckPackage(package, package_state_quit_early, /*require_sorted=*/true)) {
+ return PackageMempoolAcceptResult(package_state_quit_early, {});
+ }
// All transactions in the package must be a parent of the last transaction. This is just an
// opportunity for us to fail fast on a context-free check without taking the mempool lock.