May NOT be used after any connections are up as much of the peer-processing logic assumes a consistent block index state
| 4534 | // of the peer-processing logic assumes a consistent |
| 4535 | // block index state |
| 4536 | void UnloadBlockIndex() |
| 4537 | { |
| 4538 | LOCK(cs_main); |
| 4539 | chainActive.SetTip(nullptr); |
| 4540 | pindexFinalized = nullptr; |
| 4541 | pindexBestInvalid = nullptr; |
| 4542 | pindexBestHeader = nullptr; |
| 4543 | pindexBestForkTip = nullptr; |
| 4544 | pindexBestForkBase = nullptr; |
| 4545 | mempool.clear(); |
| 4546 | mapBlocksUnlinked.clear(); |
| 4547 | vinfoBlockFile.clear(); |
| 4548 | nLastBlockFile = 0; |
| 4549 | setDirtyBlockIndex.clear(); |
| 4550 | setDirtyFileInfo.clear(); |
| 4551 | versionbitscache.Clear(); |
| 4552 | for (int b = 0; b < VERSIONBITS_NUM_BITS; b++) { |
| 4553 | warningcache[b].clear(); |
| 4554 | } |
| 4555 | |
| 4556 | for (BlockMap::value_type& entry : mapBlockIndex) { |
| 4557 | delete entry.second; |
| 4558 | } |
| 4559 | mapBlockIndex.clear(); |
| 4560 | fHavePruned = false; |
| 4561 | |
| 4562 | g_chainstate.UnloadBlockIndex(); |
| 4563 | } |
| 4564 | |
| 4565 | bool LoadBlockIndex(const CChainParams& chainparams) |
| 4566 | { |