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

Function ProcessNewPackage

src/validation.cpp:1478–1496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1476}
1477
1478PackageMempoolAcceptResult ProcessNewPackage(CChainState& active_chainstate, CTxMemPool& pool,
1479 const Package& package, bool test_accept)
1480{
1481 AssertLockHeld(cs_main);
1482 assert(!package.empty());
1483 assert(std::all_of(package.cbegin(), package.cend(), [](const auto& tx){return tx != nullptr;}));
1484
1485 std::vector<COutPoint> coins_to_uncache;
1486 const CChainParams& chainparams = Params();
1487 const auto result = [&]() EXCLUSIVE_LOCKS_REQUIRED(cs_main) {
1488 AssertLockHeld(cs_main);
1489 if (test_accept) {
1490 auto args = MemPoolAccept::ATMPArgs::PackageTestAccept(chainparams, GetTime(), coins_to_uncache);
1491 return MemPoolAccept(pool, active_chainstate).AcceptMultipleTransactions(package, args);
1492 } else {
1493 auto args = MemPoolAccept::ATMPArgs::PackageChildWithParents(chainparams, GetTime(), coins_to_uncache);
1494 return MemPoolAccept(pool, active_chainstate).AcceptPackage(package, args);
1495 }
1496 }();
1497
1498 // Uncache coins pertaining to transactions that were not submitted to the mempool.
1499 if (test_accept || result.m_state.IsInvalid()) {

Callers 3

BOOST_FIXTURE_TEST_CASEFunction · 0.85
FUZZ_TARGET_INITFunction · 0.85
testmempoolacceptFunction · 0.85

Calls 9

GetTimeFunction · 0.85
MemPoolAcceptClass · 0.85
cbeginMethod · 0.80
cendMethod · 0.80
AcceptPackageMethod · 0.80
ParamsClass · 0.70
EXCLUSIVE_LOCKS_REQUIREDFunction · 0.70
emptyMethod · 0.45

Tested by 2

BOOST_FIXTURE_TEST_CASEFunction · 0.68
FUZZ_TARGET_INITFunction · 0.68