| 5359 | } |
| 5360 | |
| 5361 | CBlockIndex* 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 | |
| 5382 | bool static LoadBlockIndexDB() |
| 5383 | { |
no test coverage detected