> fuzz: call `EmplaceCoinInternalDANGER` as well in `SimulationTest`
>
> Adds test coverage by randomly calling `EmplaceCoinInternalDANGER` in `SimulationTest` to verify it remains correct as we modify it in a future commit.
> coins: Keep track of number of dirty entries in `CCoinsViewCache`
>
> Adds `m_dirty_count` member to track the running count of dirty cache entries as follows:
> * Incremented when entries are marked dirty via `CCoinsCacheEntry::SetDirty`
> * Decremented when dirty entries are removed or cleaned
> * Passed through `CoinsViewCacheCursor` and updated during iteration
>
> The dirty count is needed because after non-wiping flushes (introduced in #28280 and #28233), the percentage of dirty entries in the cache may be far below 100%. Using total cache size for flush warnings and disk space checks is therefore misleading.
>
> Updates all test code to properly initialize and maintain the dirty count.
> validation: Use dirty entry count in flush warnings and disk space checks
>
> Changes flush warnings to use the actual number of dirty entries being written rather than total cache size or memory usage:
> * Moves warning from `FlushStateToDisk` to `CCoinsViewDB::BatchWrite` so it applies to both regular flushes and `AssumeUTXO` snapshot writes
> * Changes threshold from `WARN_FLUSH_COINS_SIZE` (1 GiB) to `WARN_FLUSH_COINS_COUNT` (10M entries), approximately equivalent - this also helps with the confusion caused by UTXO size difference on-disk vs in-memory
> * Moves benchmark logging to `BatchWrite` where the actual disk I/O occurs to make sure AssumeUTXO also warns
> * Uses dirty count for disk space check (48 bytes per entry estimate)
> * Removes redundant `changed` counter since `dirty_count` is now tracked
>
> This ensures users are warned appropriately even when only a fraction of the cache is dirty, and provides accurate warnings during `AssumeUTXO` loads.
Co-authored-by: l0rinc <pap.lorinc@gmail.com>
Co-authored-by: Andrew Toth <andrewstoth@gmail.com>
Co-authored-by: optout <13562139+optout21@users.noreply.github.com>
This is a backport of core#33512
Depends on D20104