diff options
author | glozow <gloriajzhao@gmail.com> | 2023-01-19 17:31:58 +0000 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2023-11-01 17:21:54 +0000 |
commit | 6ff647a7e0d85040a6033047c5cf84f8f22b1c65 (patch) | |
tree | 9e82fe0ece6d7425e4124bd72830e0a74e590286 | |
parent | da9aceba217bbded6909f06144eaa1e1a4ebcb69 (diff) | |
download | bitcoin-6ff647a7e0d85040a6033047c5cf84f8f22b1c65.tar.xz |
scripted-diff: rename CheckPackage to IsWellFormedPackage
-BEGIN VERIFY SCRIPT-
sed -i 's/CheckPackage(/IsWellFormedPackage(/g' $(git grep -l CheckPackage)
-END VERIFY SCRIPT-
-rw-r--r-- | src/policy/packages.cpp | 2 | ||||
-rw-r--r-- | src/policy/packages.h | 2 | ||||
-rw-r--r-- | src/test/txpackage_tests.cpp | 18 | ||||
-rw-r--r-- | src/validation.cpp | 4 |
4 files changed, 13 insertions, 13 deletions
diff --git a/src/policy/packages.cpp b/src/policy/packages.cpp index 3660995bc8..3a63a9fe46 100644 --- a/src/policy/packages.cpp +++ b/src/policy/packages.cpp @@ -76,7 +76,7 @@ bool IsConsistentPackage(const Package& txns) return true; } -bool CheckPackage(const Package& txns, PackageValidationState& state, bool require_sorted) +bool IsWellFormedPackage(const Package& txns, PackageValidationState& state, bool require_sorted) { const unsigned int package_count = txns.size(); diff --git a/src/policy/packages.h b/src/policy/packages.h index 1ca1a962ba..537d8476e2 100644 --- a/src/policy/packages.h +++ b/src/policy/packages.h @@ -76,7 +76,7 @@ bool IsConsistentPackage(const Package& txns); * 3. If any dependencies exist between transactions, parents must appear before children. * 4. Transactions cannot conflict, i.e., spend the same inputs. */ -bool CheckPackage(const Package& txns, PackageValidationState& state, bool require_sorted); +bool IsWellFormedPackage(const Package& txns, PackageValidationState& state, bool require_sorted); /** Context-free check that a package is exactly one child and its parents; not all parents need to * be present, but the package must not contain any transactions that are not the child's parents. diff --git a/src/test/txpackage_tests.cpp b/src/test/txpackage_tests.cpp index 39ae727729..debefa7f93 100644 --- a/src/test/txpackage_tests.cpp +++ b/src/test/txpackage_tests.cpp @@ -48,7 +48,7 @@ BOOST_FIXTURE_TEST_CASE(package_sanitization_tests, TestChain100Setup) package_too_many.emplace_back(create_placeholder_tx(1, 1)); } PackageValidationState state_too_many; - BOOST_CHECK(!CheckPackage(package_too_many, state_too_many, /*require_sorted=*/true)); + BOOST_CHECK(!IsWellFormedPackage(package_too_many, state_too_many, /*require_sorted=*/true)); BOOST_CHECK_EQUAL(state_too_many.GetResult(), PackageValidationResult::PCKG_POLICY); BOOST_CHECK_EQUAL(state_too_many.GetRejectReason(), "package-too-many-transactions"); @@ -63,7 +63,7 @@ BOOST_FIXTURE_TEST_CASE(package_sanitization_tests, TestChain100Setup) } BOOST_CHECK(package_too_large.size() <= MAX_PACKAGE_COUNT); PackageValidationState state_too_large; - BOOST_CHECK(!CheckPackage(package_too_large, state_too_large, /*require_sorted=*/true)); + BOOST_CHECK(!IsWellFormedPackage(package_too_large, state_too_large, /*require_sorted=*/true)); BOOST_CHECK_EQUAL(state_too_large.GetResult(), PackageValidationResult::PCKG_POLICY); BOOST_CHECK_EQUAL(state_too_large.GetRejectReason(), "package-too-large"); @@ -74,7 +74,7 @@ BOOST_FIXTURE_TEST_CASE(package_sanitization_tests, TestChain100Setup) package_duplicate_txids_empty.emplace_back(MakeTransactionRef(empty_tx)); } PackageValidationState state_duplicates; - BOOST_CHECK(!CheckPackage(package_duplicate_txids_empty, state_duplicates, /*require_sorted=*/true)); + BOOST_CHECK(!IsWellFormedPackage(package_duplicate_txids_empty, state_duplicates, /*require_sorted=*/true)); BOOST_CHECK_EQUAL(state_duplicates.GetResult(), PackageValidationResult::PCKG_POLICY); BOOST_CHECK_EQUAL(state_duplicates.GetRejectReason(), "package-contains-duplicates"); BOOST_CHECK(!IsConsistentPackage(package_duplicate_txids_empty)); @@ -93,7 +93,7 @@ BOOST_FIXTURE_TEST_CASE(package_sanitization_tests, TestChain100Setup) // Transactions are considered sorted when they have no dependencies. BOOST_CHECK(IsTopoSortedPackage(package_conflicts)); PackageValidationState state_conflicts; - BOOST_CHECK(!CheckPackage(package_conflicts, state_conflicts, /*require_sorted=*/true)); + BOOST_CHECK(!IsWellFormedPackage(package_conflicts, state_conflicts, /*require_sorted=*/true)); BOOST_CHECK_EQUAL(state_conflicts.GetResult(), PackageValidationResult::PCKG_POLICY); BOOST_CHECK_EQUAL(state_conflicts.GetRejectReason(), "conflict-in-package"); @@ -188,8 +188,8 @@ BOOST_FIXTURE_TEST_CASE(noncontextual_package_tests, TestChain100Setup) CTransactionRef tx_child = MakeTransactionRef(mtx_child); PackageValidationState state; - BOOST_CHECK(CheckPackage({tx_parent, tx_child}, state, /*require_sorted=*/true)); - BOOST_CHECK(!CheckPackage({tx_child, tx_parent}, state, /*require_sorted=*/true)); + BOOST_CHECK(IsWellFormedPackage({tx_parent, tx_child}, state, /*require_sorted=*/true)); + BOOST_CHECK(!IsWellFormedPackage({tx_child, tx_parent}, state, /*require_sorted=*/true)); BOOST_CHECK_EQUAL(state.GetResult(), PackageValidationResult::PCKG_POLICY); BOOST_CHECK_EQUAL(state.GetRejectReason(), "package-not-sorted"); BOOST_CHECK(IsChildWithParents({tx_parent, tx_child})); @@ -217,7 +217,7 @@ BOOST_FIXTURE_TEST_CASE(noncontextual_package_tests, TestChain100Setup) package.push_back(MakeTransactionRef(child)); PackageValidationState state; - BOOST_CHECK(CheckPackage(package, state, /*require_sorted=*/true)); + BOOST_CHECK(IsWellFormedPackage(package, state, /*require_sorted=*/true)); BOOST_CHECK(IsChildWithParents(package)); BOOST_CHECK(IsChildWithParentsTree(package)); @@ -255,8 +255,8 @@ BOOST_FIXTURE_TEST_CASE(noncontextual_package_tests, TestChain100Setup) BOOST_CHECK(!IsChildWithParentsTree({tx_parent, tx_parent_also_child, tx_child})); // IsChildWithParents does not detect unsorted parents. BOOST_CHECK(IsChildWithParents({tx_parent_also_child, tx_parent, tx_child})); - BOOST_CHECK(CheckPackage({tx_parent, tx_parent_also_child, tx_child}, state, /*require_sorted=*/true)); - BOOST_CHECK(!CheckPackage({tx_parent_also_child, tx_parent, tx_child}, state, /*require_sorted=*/true)); + BOOST_CHECK(IsWellFormedPackage({tx_parent, tx_parent_also_child, tx_child}, state, /*require_sorted=*/true)); + BOOST_CHECK(!IsWellFormedPackage({tx_parent_also_child, tx_parent, tx_child}, state, /*require_sorted=*/true)); BOOST_CHECK_EQUAL(state.GetResult(), PackageValidationResult::PCKG_POLICY); BOOST_CHECK_EQUAL(state.GetRejectReason(), "package-not-sorted"); } diff --git a/src/validation.cpp b/src/validation.cpp index e2873e8b4e..ffa63dcff1 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, /*require_sorted=*/true)) return PackageMempoolAcceptResult(package_state, {}); + if (!IsWellFormedPackage(txns, package_state, /*require_sorted=*/true)) return PackageMempoolAcceptResult(package_state, {}); std::vector<Workspace> workspaces{}; workspaces.reserve(txns.size()); @@ -1405,7 +1405,7 @@ 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, /*require_sorted=*/true)) { + if (!IsWellFormedPackage(package, package_state_quit_early, /*require_sorted=*/true)) { return PackageMempoolAcceptResult(package_state_quit_early, {}); } |