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

Method InsertBlockIndex

src/validation.cpp:4065–4083  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4063}
4064
4065CBlockIndex * CChainState::InsertBlockIndex(const uint256& hash)
4066{
4067 AssertLockHeld(cs_main);
4068
4069 if (hash.IsNull())
4070 return nullptr;
4071
4072 // Return existing
4073 BlockMap::iterator mi = mapBlockIndex.find(hash);
4074 if (mi != mapBlockIndex.end())
4075 return (*mi).second;
4076
4077 // Create new
4078 CBlockIndex* pindexNew = new CBlockIndex();
4079 mi = mapBlockIndex.insert(std::make_pair(hash, pindexNew)).first;
4080 pindexNew->phashBlock = &((*mi).first);
4081
4082 return pindexNew;
4083}
4084
4085bool CChainState::LoadBlockIndex(const Consensus::Params& consensus_params, CBlockTreeDB& blocktree)
4086{

Callers 1

LoadBlockIndexMethod · 0.95

Calls 4

IsNullMethod · 0.45
findMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected