For `MempoolCheck`, it seems that the intention was to have a mempool with `check_ratio = 1` (see `-checkmempool=1`):

https://github.com/bitcoin/bitcoin/blob/e66630cc87c017f40ec29f6c1edf2ed5a286e49d/src/bench/mempool_stress.cpp#L102-L116

However in the subsequent line in the above snippet, a `CTxMemPool` gets constructed with no arguments, which means that `check_ratio` will default to 0:

https://github.com/bitcoin/bitcoin/blob/e66630cc87c017f40ec29f6c1edf2ed5a286e49d/src/txmempool.h#L571

Manually specifying `check_ratio` to 1 (according to the original intention) and running the `MempoolCheck` benchmark results in an assertion error:

```
diff --git a/src/bench/mempool_stress.cpp b/src/bench/mempool_stress.cpp
index afa4618e1b..32cdb70539 100644
--- a/src/bench/mempool_stress.cpp
+++ b/src/bench/mempool_stress.cpp
@@ -105,7 +105,7 @@ static void MempoolCheck(benchmark::Bench& bench)
     const int childTxs = bench.complexityN() > 1 ? static_cast<int>(bench.complexityN()) : 2000;
     const std::vector<CTransactionRef> ordered_coins = CreateOrderedCoins(det_rand, childTxs, /* min_ancestors */ 5);
     const auto testing_setup = MakeNoLogFileContext<const TestingSetup>(CBaseChainParams::MAIN, {"-checkmempool=1"});
-    CTxMemPool pool;
+    CTxMemPool pool{nullptr, 1};
     LOCK2(cs_main, pool.cs);
     const CCoinsViewCache& coins_tip = testing_setup.get()->m_node.chainman->ActiveChainstate().CoinsTip();
     for (auto& tx : ordered_coins) AddTx(tx, pool);
```

```sh
$ ./src/bench/bench_bitcoin -filter='MempoolCheck'
...
bench_bitcoin: txmempool.cpp:759: void CTxMemPool::check(const CCoinsViewCache &, int64_t) const: Assertion `mempoolDuplicate.HaveCoin(txin.prevout)' failed.
```

Aside from this problem, we should also probably just re-use the `CTxMemPool` in `TestingSetup`.

Ping @glozow
BOOST_CHECK(ToMemPool(spends[1]));
    block = CreateAndProcessBlock(oneSpend, scriptPubKey);
    {
        LOCK(cs_main);
        BOOST_CHECK(m_node.chainman->ActiveChain().Tip()->GetBlockHash() == block.GetHash());
    }
    
    
    BOOST_CHECK_EQUAL(m_node.mempool->size(), 0U);
}
static void ValidateCheckInputsForAllFlags(const CTransaction &tx, uint32_t failing_flags, bool add_to_cache, CCoinsViewCache& active_coins_tip) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
{
    PrecomputedTransactionData txdata;
    FastRandomContext insecure_rand(true);
    for (int count = 0; count < 10000; ++count) {
        TxValidationState state;
        
        uint32_t test_flags = (uint32_t) insecure_rand.randrange((SCRIPT_VERIFY_END_MARKER - 1) << 1);
        
        if ((test_flags & SCRIPT_VERIFY_CLEANSTACK)) {
            
            
            test_flags |= SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_WITNESS;
        }
        if ((test_flags & SCRIPT_VERIFY_WITNESS)) {
            
            test_flags |= SCRIPT_VERIFY_P2SH;
        }
        bool ret = CheckInputScripts(tx, state, &active_coins_tip, test_flags, true, add_to_cache, txdata, nullptr);