MCPcopy Create free account
hub / github.com/ElementsProject/elements / InsertBlockIndex

Method InsertBlockIndex

src/node/blockstorage.cpp:198–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198CBlockIndex* BlockManager::InsertBlockIndex(const uint256& hash)
199{
200 AssertLockHeld(cs_main);
201
202 if (hash.IsNull()) {
203 return nullptr;
204 }
205
206 // Return existing
207 BlockMap::iterator mi = m_block_index.find(hash);
208 if (mi != m_block_index.end()) {
209 return (*mi).second;
210 }
211
212 // Create new
213 CBlockIndex* pindexNew = new CBlockIndex();
214 mi = m_block_index.insert(std::make_pair(hash, pindexNew)).first;
215 pindexNew->phashBlock = &((*mi).first);
216
217 return pindexNew;
218}
219
220bool BlockManager::LoadBlockIndex(
221 const Consensus::Params& consensus_params,

Callers 1

LoadBlockIndexMethod · 0.95

Calls 4

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

Tested by

no test coverage detected