When I apply https://github.com/domob1812/bitcoin/commit/694eb5b52ab243d3f62c8c5da4346883ec51ed44 (to add mempool checks when (dis)connecting the tip), p2p-fullblocktest.py becomes flaky and fails the mempool check sometimes with:
bitcoind: txmempool.cpp:722: void CTxMemPool::check(const CCoinsViewCache*) const: Assertion `CheckInputs(tx, state, mempoolDuplicate, false, 0, false, __null)' failed.
To me this looks like an issue with mempool handling or checking. I think that the mempool should be valid at the points where the checks are inserted. If this is indeed the case, then this should not happen. Let me know if my assumption is wrong and the mempool is not supposed to be consistent at these positions in the code.