Skip to content

Commit 6ff647a

Browse files
committed
scripted-diff: rename CheckPackage to IsWellFormedPackage
-BEGIN VERIFY SCRIPT- sed -i 's/CheckPackage(/IsWellFormedPackage(/g' $(git grep -l CheckPackage) -END VERIFY SCRIPT-
1 parent da9aceb commit 6ff647a

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/policy/packages.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ bool IsConsistentPackage(const Package& txns)
7676
return true;
7777
}
7878

79-
bool CheckPackage(const Package& txns, PackageValidationState& state, bool require_sorted)
79+
bool IsWellFormedPackage(const Package& txns, PackageValidationState& state, bool require_sorted)
8080
{
8181
const unsigned int package_count = txns.size();
8282

src/policy/packages.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ bool IsConsistentPackage(const Package& txns);
7676
* 3. If any dependencies exist between transactions, parents must appear before children.
7777
* 4. Transactions cannot conflict, i.e., spend the same inputs.
7878
*/
79-
bool CheckPackage(const Package& txns, PackageValidationState& state, bool require_sorted);
79+
bool IsWellFormedPackage(const Package& txns, PackageValidationState& state, bool require_sorted);
8080

8181
/** Context-free check that a package is exactly one child and its parents; not all parents need to
8282
* be present, but the package must not contain any transactions that are not the child's parents.

src/test/txpackage_tests.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ BOOST_FIXTURE_TEST_CASE(package_sanitization_tests, TestChain100Setup)
4848
package_too_many.emplace_back(create_placeholder_tx(1, 1));
4949
}
5050
PackageValidationState state_too_many;
51-
BOOST_CHECK(!CheckPackage(package_too_many, state_too_many, /*require_sorted=*/true));
51+
BOOST_CHECK(!IsWellFormedPackage(package_too_many, state_too_many, /*require_sorted=*/true));
5252
BOOST_CHECK_EQUAL(state_too_many.GetResult(), PackageValidationResult::PCKG_POLICY);
5353
BOOST_CHECK_EQUAL(state_too_many.GetRejectReason(), "package-too-many-transactions");
5454

@@ -63,7 +63,7 @@ BOOST_FIXTURE_TEST_CASE(package_sanitization_tests, TestChain100Setup)
6363
}
6464
BOOST_CHECK(package_too_large.size() <= MAX_PACKAGE_COUNT);
6565
PackageValidationState state_too_large;
66-
BOOST_CHECK(!CheckPackage(package_too_large, state_too_large, /*require_sorted=*/true));
66+
BOOST_CHECK(!IsWellFormedPackage(package_too_large, state_too_large, /*require_sorted=*/true));
6767
BOOST_CHECK_EQUAL(state_too_large.GetResult(), PackageValidationResult::PCKG_POLICY);
6868
BOOST_CHECK_EQUAL(state_too_large.GetRejectReason(), "package-too-large");
6969

@@ -74,7 +74,7 @@ BOOST_FIXTURE_TEST_CASE(package_sanitization_tests, TestChain100Setup)
7474
package_duplicate_txids_empty.emplace_back(MakeTransactionRef(empty_tx));
7575
}
7676
PackageValidationState state_duplicates;
77-
BOOST_CHECK(!CheckPackage(package_duplicate_txids_empty, state_duplicates, /*require_sorted=*/true));
77+
BOOST_CHECK(!IsWellFormedPackage(package_duplicate_txids_empty, state_duplicates, /*require_sorted=*/true));
7878
BOOST_CHECK_EQUAL(state_duplicates.GetResult(), PackageValidationResult::PCKG_POLICY);
7979
BOOST_CHECK_EQUAL(state_duplicates.GetRejectReason(), "package-contains-duplicates");
8080
BOOST_CHECK(!IsConsistentPackage(package_duplicate_txids_empty));
@@ -93,7 +93,7 @@ BOOST_FIXTURE_TEST_CASE(package_sanitization_tests, TestChain100Setup)
9393
// Transactions are considered sorted when they have no dependencies.
9494
BOOST_CHECK(IsTopoSortedPackage(package_conflicts));
9595
PackageValidationState state_conflicts;
96-
BOOST_CHECK(!CheckPackage(package_conflicts, state_conflicts, /*require_sorted=*/true));
96+
BOOST_CHECK(!IsWellFormedPackage(package_conflicts, state_conflicts, /*require_sorted=*/true));
9797
BOOST_CHECK_EQUAL(state_conflicts.GetResult(), PackageValidationResult::PCKG_POLICY);
9898
BOOST_CHECK_EQUAL(state_conflicts.GetRejectReason(), "conflict-in-package");
9999

@@ -188,8 +188,8 @@ BOOST_FIXTURE_TEST_CASE(noncontextual_package_tests, TestChain100Setup)
188188
CTransactionRef tx_child = MakeTransactionRef(mtx_child);
189189

190190
PackageValidationState state;
191-
BOOST_CHECK(CheckPackage({tx_parent, tx_child}, state, /*require_sorted=*/true));
192-
BOOST_CHECK(!CheckPackage({tx_child, tx_parent}, state, /*require_sorted=*/true));
191+
BOOST_CHECK(IsWellFormedPackage({tx_parent, tx_child}, state, /*require_sorted=*/true));
192+
BOOST_CHECK(!IsWellFormedPackage({tx_child, tx_parent}, state, /*require_sorted=*/true));
193193
BOOST_CHECK_EQUAL(state.GetResult(), PackageValidationResult::PCKG_POLICY);
194194
BOOST_CHECK_EQUAL(state.GetRejectReason(), "package-not-sorted");
195195
BOOST_CHECK(IsChildWithParents({tx_parent, tx_child}));
@@ -217,7 +217,7 @@ BOOST_FIXTURE_TEST_CASE(noncontextual_package_tests, TestChain100Setup)
217217
package.push_back(MakeTransactionRef(child));
218218

219219
PackageValidationState state;
220-
BOOST_CHECK(CheckPackage(package, state, /*require_sorted=*/true));
220+
BOOST_CHECK(IsWellFormedPackage(package, state, /*require_sorted=*/true));
221221
BOOST_CHECK(IsChildWithParents(package));
222222
BOOST_CHECK(IsChildWithParentsTree(package));
223223

@@ -255,8 +255,8 @@ BOOST_FIXTURE_TEST_CASE(noncontextual_package_tests, TestChain100Setup)
255255
BOOST_CHECK(!IsChildWithParentsTree({tx_parent, tx_parent_also_child, tx_child}));
256256
// IsChildWithParents does not detect unsorted parents.
257257
BOOST_CHECK(IsChildWithParents({tx_parent_also_child, tx_parent, tx_child}));
258-
BOOST_CHECK(CheckPackage({tx_parent, tx_parent_also_child, tx_child}, state, /*require_sorted=*/true));
259-
BOOST_CHECK(!CheckPackage({tx_parent_also_child, tx_parent, tx_child}, state, /*require_sorted=*/true));
258+
BOOST_CHECK(IsWellFormedPackage({tx_parent, tx_parent_also_child, tx_child}, state, /*require_sorted=*/true));
259+
BOOST_CHECK(!IsWellFormedPackage({tx_parent_also_child, tx_parent, tx_child}, state, /*require_sorted=*/true));
260260
BOOST_CHECK_EQUAL(state.GetResult(), PackageValidationResult::PCKG_POLICY);
261261
BOOST_CHECK_EQUAL(state.GetRejectReason(), "package-not-sorted");
262262
}

src/validation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptMultipleTransactions(const std::
12581258

12591259
// These context-free package limits can be done before taking the mempool lock.
12601260
PackageValidationState package_state;
1261-
if (!CheckPackage(txns, package_state, /*require_sorted=*/true)) return PackageMempoolAcceptResult(package_state, {});
1261+
if (!IsWellFormedPackage(txns, package_state, /*require_sorted=*/true)) return PackageMempoolAcceptResult(package_state, {});
12621262

12631263
std::vector<Workspace> workspaces{};
12641264
workspaces.reserve(txns.size());
@@ -1405,7 +1405,7 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptPackage(const Package& package,
14051405
// transactions and thus won't return any MempoolAcceptResults, just a package-wide error.
14061406

14071407
// Context-free package checks.
1408-
if (!CheckPackage(package, package_state_quit_early, /*require_sorted=*/true)) {
1408+
if (!IsWellFormedPackage(package, package_state_quit_early, /*require_sorted=*/true)) {
14091409
return PackageMempoolAcceptResult(package_state_quit_early, {});
14101410
}
14111411

0 commit comments

Comments
 (0)