MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / UnloadBlockIndex

Function UnloadBlockIndex

src/validation.cpp:4536–4563  ·  view source on GitHub ↗

May NOT be used after any connections are up as much of the peer-processing logic assumes a consistent block index state

Source from the content-addressed store, hash-verified

4534// of the peer-processing logic assumes a consistent
4535// block index state
4536void 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
4565bool LoadBlockIndex(const CChainParams& chainparams)
4566{

Callers 2

AppInitMainFunction · 0.85
~TestingSetupMethod · 0.85

Calls 4

SetTipMethod · 0.80
UnloadBlockIndexMethod · 0.80
clearMethod · 0.45
ClearMethod · 0.45

Tested by 1

~TestingSetupMethod · 0.68