| 1476 | } |
| 1477 | |
| 1478 | PackageMempoolAcceptResult 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()) { |