MCPcopy Create free account
hub / github.com/LUX-Core/lux / InsertBlockIndex

Function InsertBlockIndex

src/main.cpp:5361–5380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5359}
5360
5361CBlockIndex* InsertBlockIndex(uint256 hash)
5362{
5363 if (hash == 0)
5364 return NULL;
5365
5366 // Return existing
5367 BlockMap::iterator mi = mapBlockIndex.find(hash);
5368 if (mi != mapBlockIndex.end())
5369 return (*mi).second;
5370
5371 // Create new
5372 CBlockIndex* pindexNew = new CBlockIndex();
5373 if (!pindexNew)
5374 throw runtime_error("LoadBlockIndex() : new CBlockIndex failed");
5375 mi = mapBlockIndex.emplace(hash, pindexNew).first;
5376
5377 pindexNew->phashBlock = &((*mi).first);
5378
5379 return pindexNew;
5380}
5381
5382bool static LoadBlockIndexDB()
5383{

Callers 1

LoadBlockIndexGutsMethod · 0.85

Calls 3

findMethod · 0.45
endMethod · 0.45
emplaceMethod · 0.45

Tested by

no test coverage detected