Repository navigation
Open
Labels
Tracking IssueTracks longer-running projects and releases. Gathers TODOs, issues, PRs, and status updates.
Description
The coins cache (the CCoinsView* stack, CCoinsViewCache, and friends) is a correctness- and performance-critical part of validation, IBD, and assumeutxo.
Over time it has accumulated subtle invariants and legacy states (around cache entry flags, spent coin handling, and error catching), and we have been chipping away at it through focused refactors, bugfixes, tests, and performance work.
This issue tracks the related PRs to help reviewers see how they fit together.
The overall aim is fewer error cases, cleaner cache layering, and parallel validation.
PRs needing review
Testing
- fuzz: Implement
connect_blockharness #35850 - fuzzConnectBlock()directly without mutating chainstate.
Remove invalid cache states
- coins: tighten cache entry state invariants #34864 - remove unreachable FRESH-but-not-DIRTY state from code and tests.
Simplify view hierarchy
- coins: delegate
CCoinsViewDB::HaveCointoGetCoin#34320 - replaceHaveCoin()withGetCoin(). - coins,dbwrapper: make database point-read failures fatal #34132 - centralize coins DB read failures in
CDBWrapperand remove the error-catcher layer.
Database and cursor correctness
- txdb: reject undecodable first coin cursor key #35654 - reject an undecodable first coin cursor key.
- coins: prevent DB resize from invalidating cursors #35744 - prevent AssumeUTXO cache resizing from invalidating coins DB cursors.
- validation: return block-file flush errors #35714 - stop writing block-index and coins metadata after a blockfile flush failure.
Parallel validation
- coins: parallel input prevout fetching followups #35738 - clean up and fuzz async prevout fetching and its coins-view overlay.
- validation: use parallel input prevout fetching in TestBlockValidity #35751 - use parallel prevout fetching in
TestBlockValidity().
Optimizations
- coins: cache UTXO outpoint hash codes #35195 - let libstdc++ cache UTXO outpoint hash codes for faster coins-map operations.
- leveldb: move unused block-cache budget to write buffers #35620 - move unused LevelDB block-cache budget to write buffers.
- refactor: avoid redundant input lookup in
CheckTxInputs#35657 - avoid the redundant UTXO lookup pre-pass inCheckTxInputs().
Other
- fix assumevalid is ignored during reindex #33854 - skip early chain activation during reindex when headers are below minimum chainwork (see assumevalid is not always applied when reindexing #31494).
- kernel: Separate UTXO set access from validation functions #32317 - move UTXO access to
SpendBlock(kernel API, Utreexo, SwiftSync).
Recently merged
- fuzz: Avoid dangling prevoutfetch threads after AFL fork #35767 - stop async prevout-fetch threads before AFL forks.
- test: cover unused mempool space in coins cache limit #35490 - cover unused mempool space in the coins-cache limit.
- coins: make cursor iteration DB-only #35572 - restrict coins cursor iteration to DB-backed views.
- refactor: Use u64 over size_t for all cache sizes to fix a 32-bit overflow #35616 - use 64-bit cache sizes and fix a 32-bit overflow.
- fuzz: cover async chainstate compaction #35594 - fuzz async chainstate compaction.
- fuzz: Speed up
dbwrapper_concurrent_readsharness #35521 - speed up concurrentCDBWrapperread fuzzing. - coins: compact chainstate regularly #35465 - compact chainstate regularly after seek compaction was disabled.
- fuzz: improve dbwrapper_concurrent_reads performance #35455 - improve the concurrent
CDBWrapperread fuzz harness. - kernel,node: add
dbcachesetter and clarify defaults #35205 - route node, Qt, and kernel through the shared two-tierdbcachedefault. - coins: group private cache helpers #35180 - narrow the public
CCoinsViewCacheAPI around reset internals. - coins: use SipHash-1-3-UJ for CCoinsMap keys #35215 - simplified in-memory utxo set key hashing
- validation: fetch block input prevouts in parallel during ConnectBlock #35295 - async input prefetch during
ConnectBlock. - node: smooth oversized
dbcachewarnings #35200 - replace the oversized-dbcachewarning cliff with a reserved-memory formula - fuzz: target CDBWrapper #34887 - compare
CDBWrapperagainst an in-memory oracle - fuzz: target concurrent leveldb reads #34866 - exercise LevelDB reads under concurrent index-like access.
- coins,refactor: Reduce
getblockstatsRPC UTXO overhead estimation #31449 -getblockstatsRPC UTXO overhead fix - validation: make
CCoinsViewa pure virtual interface #34124 - makeCCoinsViewpurely virtual, add explicitCCoinsViewEmpty. - Bump dbcache to 1 GiB #34692 - increase the default dbcache value from 450MiB to 1024MiB
- threadpool: add ranged Submit overload #34576 - batch ThreadPool submissions under one lock for input-fetcher prep
- fuzz: keep
coins_viewfuzzers within caller contracts #34655 - constrain coins-view fuzz inputs to valid cache caller states. - coins: don't mutate main cache when connecting block #34165 - add non-mutating
PeekCoin()to avoid polluting the main cache. - coins: use dirty entry count for flush warnings and disk space checks #33512 - track dirty entries so flush progress reflects actual writes.
- validation: do not wipe utxo cache for stats/scans/snapshots #33680 - split
FORCE_SYNC/FORCE_FLUSH, keep cache warm forscantxoutset/gettxoutsetinfo/snapshots. - validation: add reusable coins view for ConnectBlock #34164 - add
Reset()and reusable view to discard failed connects cheaply. - coins/refactor: enforce
GetCoin()returns only unspent coins #34207 - ensureGetCoin()only returns unspent coins, align tests with production. - validation: cache tip recency for lock-free
IsInitialBlockDownload()#34253 - cache IBD status so readers do not takecs_main. - refactor: Let CCoinsViewCache::BatchWrite return void #33866 - remove always-true return from
BatchWrite. - rest: allow reading partial block data from storage #33657 - allow reading partial block data (useful for bindex).
- [IBD] coins: reduce lookups in dbcache layer propagation #33602 - reduce map lookups in
BatchWrite. - coins: warn on oversized
-dbcache#33333 - warn when-dbcacheexceeds RAM cap.
Metadata
Metadata
Assignees
Labels
Tracking IssueTracks longer-running projects and releases. Gathers TODOs, issues, PRs, and status updates.
Activity
[-]Coins Cache Cleanup tracking issue[/-][+]Coins Cache Cleanup checklist[/+]sedited commentedon Jan 18, 2026
The issue seems a bit overladen - I don't think listing all these PRs is useful. Maybe distill this down to just the coins-related PRs? The benefit I would expect from this issue is that I can connect the various PRs touching the coins and see how they relate to each other. Maybe to add to the benefits in the opening paragraph a bit: Fewer error cases, more ergonomic cache layering, and preparation for asynchronous operations.
l0rinc commentedon Jan 18, 2026
Thanks for the suggestions @sedited and @andrewtoth.
Updated the tracker and grouped the PRs - hopefully this helps reviewers see the structure (though many conflict or overlap depending on merge order).
I put cleanups first since they'd let us avoid ugly hacks in the larger PRs, culminating in the parallel input fetcher.
Let me know what else to adjust.
l0rinc commentedon Mar 15, 2026
GitHub doesn't allow me to edit the issue anymore, wanted to try the close/reopen dance here, but apparently I can't reopen. Can someone please reopen and check if they can edit the issue?
Merge #34124: validation: make `CCoinsView` a pure virtual interface