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=0reportsCRITICAL - 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.