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

Function InsertBlockIndex

src/main.cpp:3812–3830  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3810}
3811
3812CBlockIndex * InsertBlockIndex(uint256 hash)
3813{
3814 if (hash.IsNull())
3815 return NULL;
3816
3817 // Return existing
3818 BlockMap::iterator mi = mapBlockIndex.find(hash);
3819 if (mi != mapBlockIndex.end())
3820 return (*mi).second;
3821
3822 // Create new
3823 CBlockIndex* pindexNew = new CBlockIndex();
3824 if (!pindexNew)
3825 throw runtime_error("LoadBlockIndex(): new CBlockIndex failed");
3826 mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first;
3827 pindexNew->phashBlock = &((*mi).first);
3828
3829 return pindexNew;
3830}
3831
3832bool static LoadBlockIndexDB(bool* fRebuildRequired)
3833{

Callers 1

LoadBlockIndexGutsMethod · 0.85

Calls 4

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

Tested by

no test coverage detected