| 1445 | } |
| 1446 | |
| 1447 | PackageMempoolAcceptResult ProcessNewPackage(Chainstate &active_chainstate, |
| 1448 | CTxMemPool &pool, |
| 1449 | const Package &package, |
| 1450 | bool test_accept) { |
| 1451 | AssertLockHeld(cs_main); |
| 1452 | assert(!package.empty()); |
| 1453 | assert(std::all_of(package.cbegin(), package.cend(), |
| 1454 | [](const auto &tx) { return tx != nullptr; })); |
| 1455 | |
| 1456 | const Config &config = active_chainstate.m_chainman.GetConfig(); |
| 1457 | |
| 1458 | std::vector<COutPoint> coins_to_uncache; |
| 1459 | auto result = [&]() EXCLUSIVE_LOCKS_REQUIRED(cs_main) { |
| 1460 | AssertLockHeld(cs_main); |
| 1461 | if (test_accept) { |
| 1462 | auto args = MemPoolAccept::ATMPArgs::PackageTestAccept( |
| 1463 | config, GetTime(), coins_to_uncache); |
| 1464 | return MemPoolAccept(pool, active_chainstate) |
| 1465 | .AcceptMultipleTransactions(package, args); |
| 1466 | } else { |
| 1467 | auto args = MemPoolAccept::ATMPArgs::PackageChildWithParents( |
| 1468 | config, GetTime(), coins_to_uncache); |
| 1469 | return MemPoolAccept(pool, active_chainstate) |
| 1470 | .AcceptPackage(package, args); |
| 1471 | } |
| 1472 | }(); |
| 1473 | |
| 1474 | // Uncache coins pertaining to transactions that were not submitted to the |
| 1475 | // mempool. |