MCPcopy Create free account
hub / github.com/ElementsProject/elements / BOOST_FIXTURE_TEST_CASE

Function BOOST_FIXTURE_TEST_CASE

src/test/txpackage_tests.cpp:38–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38BOOST_FIXTURE_TEST_CASE(package_sanitization_tests, TestChain100Setup)
39{
40 // Packages can't have more than 25 transactions.
41 Package package_too_many;
42 package_too_many.reserve(MAX_PACKAGE_COUNT + 1);
43 for (size_t i{0}; i < MAX_PACKAGE_COUNT + 1; ++i) {
44 package_too_many.emplace_back(create_placeholder_tx(1, 1));
45 }
46 PackageValidationState state_too_many;
47 BOOST_CHECK(!CheckPackage(package_too_many, state_too_many));
48 BOOST_CHECK_EQUAL(state_too_many.GetResult(), PackageValidationResult::PCKG_POLICY);
49 BOOST_CHECK_EQUAL(state_too_many.GetRejectReason(), "package-too-many-transactions");
50
51 // Packages can't have a total size of more than 101KvB.
52 CTransactionRef large_ptx = create_placeholder_tx(150, 150);
53 Package package_too_large;
54 auto size_large = GetVirtualTransactionSize(*large_ptx);
55 size_t total_size{0};
56 while (total_size <= MAX_PACKAGE_SIZE * 1000) {
57 package_too_large.push_back(large_ptx);
58 total_size += size_large;
59 }
60 BOOST_CHECK(package_too_large.size() <= MAX_PACKAGE_COUNT);
61 PackageValidationState state_too_large;
62 BOOST_CHECK(!CheckPackage(package_too_large, state_too_large));
63 BOOST_CHECK_EQUAL(state_too_large.GetResult(), PackageValidationResult::PCKG_POLICY);
64 BOOST_CHECK_EQUAL(state_too_large.GetRejectReason(), "package-too-large");
65}
66
67BOOST_FIXTURE_TEST_CASE(package_validation_tests, TestChain100Setup)
68{

Callers

nothing calls this directly

Calls 15

create_placeholder_txFunction · 0.85
CheckPackageFunction · 0.85
GetScriptForDestinationFunction · 0.85
PKHashClass · 0.85
ProcessNewPackageFunction · 0.85
IsChildWithParentsFunction · 0.85
WitnessV0ScriptHashClass · 0.85
WitnessV0KeyHashClass · 0.85
CAssetClass · 0.85
emplace_backMethod · 0.80
GetResultMethod · 0.80
GetRejectReasonMethod · 0.80

Tested by

no test coverage detected