test: cover unused mempool space in coins cache limit #35490

pull w0xlt wants to merge 1 commits into bitcoin:master from w0xlt:mempool-kernel-regression-tests changing 1 files +21 −0
  1. w0xlt commented at 12:05 AM on June 9, 2026: contributor

    This PR adds a unit test for Chainstate::GetCoinsCacheSizeState().

    Chainstate::GetCoinsCacheSizeState() calculates when the UTXO/coins cache is too large and should be flushed. Part of that calculation includes unused -maxmempool space. For example, if the mempool limit is 300 MiB but the mempool is mostly empty, some of that unused space can be counted toward the coins cache limit.

    The existing validation_flush_tests.cpp test checks this calculation by calling:

    chainstate.GetCoinsCacheSizeState(MAX_COINS_BYTES, max_mempool_size_bytes)
    

    This new test checks the no-argument call:

    chainstate.GetCoinsCacheSizeState()
    

    That is the call used by validation code during normal operation.

    The test grows the coins cache above the coins-only limit, then checks that:

    • calling the explicit helper with max_mempool_size_bytes=0 reports CRITICAL
    • calling the normal no-argument method does not report CRITICAL, because it includes unused mempool space

    This makes sure future refactors do not accidentally drop unused mempool space from the normal cache-size calculation.

  2. test: cover unused mempool space in coins cache 843f163c66
  3. DrahtBot added the label Tests on Jun 9, 2026
  4. DrahtBot commented at 12:06 AM on June 9, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35490.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK sedited

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. sedited commented at 7:42 AM on June 9, 2026: contributor

    Concept ACK

  6. sedited requested review from l0rinc on Jun 9, 2026


l0rinc

Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-06-11 10:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me