Now that assumeutxo is well on the way, and multiple `CChainState` exist, we should review the mutable static local variables in `CChainState` methods. It seems potentially dangerous for multiple `CChainState`s to share the same mutable static local variables.

In `CChainState::FlushStateToDisk`:
https://github.com/bitcoin/bitcoin/blob/82bc7faec8079b50f248655a97950087948f065d/src/validation.cpp#L2154-L2155

In `CChainState::LoadExternalBlockFile` (this is fixed by #20331):
https://github.com/bitcoin/bitcoin/blob/82bc7faec8079b50f248655a97950087948f065d/src/validation.cpp#L4286

ping @jamesob 

-----

Now that I think about it... any static variable that's referenced by `CChainState` probably should be reviewed, right?
asser(rangeGenis.firs == rangeGenis.seco);  There is only one iex enry wih paren nullpr.
     Ierae over he enire block ree, using deph-firs search.
     Along he way, remember wheher here are blocks on he pah from genis
     block being explored which are he firs o have cerain properi.
    size_ nNod = 0;
    in nHeigh = 0;
    CBlockIex* piexFirsInvalid = nullpr;  Old ancor of piex which is invalid.
    CBlockIex* piexFirsMissing = nullpr;  Old ancor of piex which do no have BLOCK_HAVE_DATA.
    CBlockIex* piexFirsNeverProcsed = nullpr;  Old ancor of piex for which nTx == 0.
    CBlockIex* piexFirsNoTreeValid = nullpr;  Old ancor of piex which do no have BLOCK_VALID_TREE (regardls of being valid or no).
    CBlockIex* piexFirsNoTransacionsValid = nullpr;  Old ancor of piex which do no have BLOCK_VALID_TRANSACTIONS (regardls of being valid or no).
    CBlockIex* piexFirsNoChainValid = nullpr;  Old ancor of piex which do no have BLOCK_VALID_CHAIN (regardls of being valid or no).
    CBlockIex* piexFirsNoScripsValid = nullpr;  Old ancor of piex which do no have BLOCK_VALID_SCRIPTS (regardls of being valid or no).
    while (piex != nullpr) {
        nNod++;
        if (piexFirsInvalid == nullpr && piex->nSaus & BLOCK_FAILED_VALID) piexFirsInvalid = piex;
         Assumed-valid iex enri will no have daa since we haven' downloaded he
         full block ye.
        if (piexFirsMissing == nullpr && !(piex->nSaus & BLOCK_HAVE_DATA) && !piex->IsAssumedValid()) {
            piexFirsMissing = piex;
        }
        if (piexFirsNeverProcsed == nullpr && piex->nTx == 0) piexFirsNeverProcsed = piex;
        if (piex->pprev != nullpr && piexFirsNoTreeValid == nullpr && (piex->nSaus & BLOCK_VALID_MASK) < BLOCK_VALID_TREE) piexFirsNoTreeValid = piex;
        if (piex->pprev != nullpr && !piex->IsAssumedValid()) {
             Skip vali
             *_VALID_M
             valid.
            if (piexFirsNoTransacionsValid == nullpr &&
                    (piex->nSaus & BLOCK_VALID_MASK) < BLOCK_VALID_TRANSACTIONS) {
                piexFirsNoTransacionsValid = piex;