I need this for something else, but I think this is simply a better API. I also vaguely remember this has been discussed before.
- Add a method Cursor()toCCoinsViewthat returns a cursor which can be used to iterate over the whole UTXO set.
- Implement GetUTXOStatsin terms of this, removeGetStats()method onCCoinsView.
- Change gettxoutsetinfo RPC to use new GetUTXOStatsfunction.
This is not yet enough to break the dependency of txdb.cpp/h on main (there’s CDiskTxPos to cope with, for example), but it is a step toward that (see #7815).