| 1811 | } |
| 1812 | |
| 1813 | PackageMempoolAcceptResult ProcessNewPackage(Chainstate& active_chainstate, CTxMemPool& pool, |
| 1814 | const Package& package, bool test_accept, const std::optional<CFeeRate>& client_maxfeerate) |
| 1815 | { |
| 1816 | AssertLockHeld(cs_main); |
| 1817 | assert(!package.empty()); |
| 1818 | assert(std::all_of(package.cbegin(), package.cend(), [](const auto& tx){return tx != nullptr;})); |
| 1819 | |
| 1820 | std::vector<COutPoint> coins_to_uncache; |
| 1821 | const CChainParams& chainparams = active_chainstate.m_chainman.GetParams(); |
| 1822 | auto result = [&]() EXCLUSIVE_LOCKS_REQUIRED(cs_main) { |
| 1823 | AssertLockHeld(cs_main); |
| 1824 | if (test_accept) { |
| 1825 | auto args = MemPoolAccept::ATMPArgs::PackageTestAccept(chainparams, GetTime(), coins_to_uncache); |
| 1826 | return MemPoolAccept(pool, active_chainstate).AcceptMultipleTransactionsAndCleanup(package, args); |
| 1827 | } else { |
| 1828 | auto args = MemPoolAccept::ATMPArgs::PackageChildWithParents(chainparams, GetTime(), coins_to_uncache, client_maxfeerate); |
| 1829 | return MemPoolAccept(pool, active_chainstate).AcceptPackage(package, args); |
| 1830 | } |
| 1831 | }(); |
| 1832 | |
| 1833 | // Uncache coins pertaining to transactions that were not submitted to the mempool. |
| 1834 | if (test_accept || result.m_state.IsInvalid()) { |